[R] writing data to file

mail me mailme842 at googlemail.com
Thu Mar 22 16:35:52 CET 2012


Hi:

I created a data frame

df <- data.frame( person = c('John','Bob','Mary'), team =
c('a','b','c'), stringsAsFactors = F);

and obtained the expected  output

 df
  person   team
1   John      a
2    Bob      b
3   Mary      c

now I want to save the whole content of df preserving its row and
column order to a file in disk with the following command:

write(df, file = "testfile",  append=FALSE, sep=" ");

and I get the error message

Error in cat(list(...), file, sep, fill, labels, append) :   argument
1 (type 'list') cannot be handled by 'cat'

Can you help to solve the problem? Thanks in advance.

deb



More information about the R-help mailing list