[R] Simple question about export
Marc Schwartz
MSchwartz at medanalytics.com
Wed Mar 12 15:12:33 CET 2003
Michael Miettinen wrote:
> Hi,
>
> Sorry about making this stupid question, but I did not
> find the answer from documentation.
>
> I managed to read my spss .sav file into the R, no
> problem. Next I would like to write this data to a
> file in ascii-format. I tried to use write.table and I
> got no error messages, but no file either. What is the
> right way to make it?
>
> At least write.table("c:\foo\data.dat") does not
> work..
>
> Thanks in advance!
>
> Michael
Under Windows, you need to specify files paths using either "\\" or "/"
as the separator. This is referred to in R Windows FAQs 2.13 and 4.1.
Also, at least in the example you give above, you did not specify the
name of the data frame that you want to export, which is the first
argument to write.table().
Presuming that your dataframe is called 'spss" use:
write.table(spss, "c:\\foo\\data.dat")
or
write.table(spss, "c:/foo/data.dat")
See ?write.table, the R Windows FAQ and the R Data Import/Export
documentation.
Regards,
Marc Schwartz
More information about the R-help
mailing list