Re: [R] need help opening a file

From: David Winsemius <>
Date: Sun, 27 Jan 2008 03:09:38 +0000 (UTC)

"Sudhindra Gadagkar" <> wrote in

> Hi, I can't believe I am unable to do this. I just installed R
> (never used it before, but want to learn it). At present, though.
> all I want to do is export a data file (specifically "crabs" in the
> MASS library) to a text file for use in SPSS. It allows me to peek
> into the dataset, using the command head(crabs) but I can neither
> view the entire file nor can I seem to export it to a text file. I
> have been trying to get help from the online help for several hours
> now! Maybe I just don't know what to search for. Frustrating! Help
> would be much appreciated. Thx, S.
> [[alternative HTML version deleted]]

write.table should provide the basic function. It is designed to write datafames:

 write.table(crabs, file="crab.out.csv", sep=",")

... will give you a comma separated file: ... first five lines



If you are working in Windows, and want to specify a directory, you need to use forward slashes in the full filename. The backslash character has special meaning in *NIX systems, which is where R was developed.

If you want to "see" the dataframe, crabs, just type the name. You should see 200 lines of data.

David Winsemius

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 27 Jan 2008 - 03:21:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Jan 2008 - 03:30:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive