[R] write.csv to text string?

Thomas Nyberg tomuxiong at gmail.com
Thu Mar 12 18:15:43 CET 2015


I've found the following useful functionality:

> s <- 'cola,colb\n1,2\n2,3\n'
> read.csv(text=s)
  cola colb
1    1    2
2    2    3

But I haven't found a similar option in write.csv. I.e. I would like to
"write" a dataframe to a string. What would be the easiest way to go
about such a thing? Right now I can only think of using a file as an
intermediary, but that seems a bit silly. Thanks for any help.

Thomas Nyberg

More information about the R-help mailing list