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 ______________________________________________ R-help@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.