[R] writing data to file

Gaurav Sood gsood07 at gmail.com
Thu Mar 22 17:23:42 CET 2012


look up dump

On Thu, Mar 22, 2012 at 11:35 AM, mail me <mailme842 at googlemail.com> wrote:
> 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
>
> ______________________________________________
> 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.



More information about the R-help mailing list