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]]
first of all, which is your code to export the data in R? did you use write.table? secondly, it is totally a waste of time to export data from R for use in spss. for whatever can be done by spss, r can handle better. On Jan 26, 2008 9:38 PM, Sudhindra Gadagkar <suragg8 at gmail.com> wrote:> 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]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- ==============================WenSui Liu Statistical Project Manager ChoicePoint Precision Marketing (http://spaces.msn.com/statcompute/blog)
Sudhindra, You should read the Posting Guide before asking for help: http://www.R-project.org/posting-guide.html It has greats hints on how to solve problems like this yourself, and you should try them before posting. It might suggest that this is a good thing to run in R if you need help with data 'export': RSiteSearch("export") The first hit produced is the manual 'R Data Import/Export', which is provided along with your installation. When you look there you will find this section: 1.2 Export to text files RSiteSearch() also gives hits from this newslist from people like yourself who could not figure out how to export their data. Reading those should help you. HTH, Chuck On Sat, 26 Jan 2008, Sudhindra Gadagkar wrote:> 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]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
"Sudhindra Gadagkar" <suragg8 at gmail.com> wrote in news:4726c6d80801261838u4b2aa3b2x118b6f5470bd9301 at mail.gmail.com:> 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 "sp","sex","index","FL","RW","CL","CW","BD" "1","B","M",1,8.1,6.7,16.1,19,7 "2","B","M",2,8.8,7.7,18.1,20.8,7.4 "3","B","M",3,9.2,7.8,19,22.4,7.7 "4","B","M",4,9.6,7.9,20.1,23.1,8.2 . . . 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