[R] How to save a data set as .txt on fly?

Philipp Pagel p.pagel at wzw.tum.de
Fri Nov 26 11:49:14 CET 2010

> > He is telling you that it is not surprising that 'aaa' does not exist,
> > if the object you saved was called DNase
> No, such a file.  Just rechecked it with Win7 search command. (Win7 has been 
> rebooted)

You are confusing two things here:

a) Files living in the filesystem 
b) Objects in your R workspace

When you saved your dataset you had to assign a filename, obviously.
But this has nothing to do with the name of the object(s) contained in
these files. So no matter what your file is called this has no effect
on the names of the objects you get upon loading the file.

I recommend reading ?save, ?load and ?save.image.

> > Again - you need to use the name of the object which happens to be
> > 'DNase' - not 'dnase', 'dnase.txt' or 'aaa'
> Thanks.
> I have this idea at the beginning.  A further thought changed my mind.
> On R console
> > DNase
> displays the content of the data set.
> If I save the file in the same name.  It may confuse me on running DNase whether 
> the output is the content of the data set OR from the file created.

R does not care about the file unless you load it and you can pick any
filename you like without affecting the name of the object(s). Once
loaded, there is no magical link between the two. Of course, when you
load objects from a file this will overwrite any objects of the same
names (object names, not file names!) that happen to live in your
workspace before the load command.


Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany

More information about the R-help mailing list