[R] trouble with write.foreign
David Winsemius
dwinsemius at comcast.net
Fri Apr 19 01:39:49 CEST 2013
On Apr 18, 2013, at 2:39 PM, cmk087 wrote:
> I am trying to write a 10000x8 matrix into a text file so I can read it into
> SAS.
> When I tried using write.table I could not get just 8 columns and 10000 rows
> it would just write all the data in a line until it hit the end and went to
> the next line.
If it really is an R matrix, you should either look up `write.matrix` or perhaps more simply wrap as.data.frame(.) around that object.
> I tried instead using write.foreign and I got an error message: Error in if
> (varnames[v] != names(varnames)[v]) cat("LABEL ", varnames[v], :
> argument is of length zero
>
> I do not want any variable names at all I just want the data in a text file
> with 8 columns and 10000 rows. The code I used was: write.foreign(T1,
> "time1.txt", "time1.sas", package="SAS").
write.foreign specifies that its first argument be a dataframe.
>
> Is there any way in which I can write the matrix as is in a text (or csv)
> file without having any variable names?
There are arguments in write.table and its cvs wrappers to suppress column names. Please read this more carefully:
?write.table
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list