[R] Using read.table to read file created with read.table and qmethod = "escape"

David Winsemius dwinsemius at comcast.net
Thu Apr 8 15:31:26 CEST 2010


On Apr 8, 2010, at 9:07 AM, Hadley Wickham wrote:

>> df <- data.frame(a = "a\"b", v = 4, z = "this is Z")
>> write.csv(df, "test.csv", row.names = FALSE, quote = FALSE)
>> read.csv("test.csv", quote = "")
>
> Unfortunately my real example is more like:
>
> df <- data.frame(a = "a\"b", v = 4, z = "this is: A, B, C")
>
> so quote = F won't work.
>
> Can write.table and read.table really be so asymmetric?

write() is a wrapper for cat() and read() is a wrapper for scan() so  
the question should really be can cat() and scan() be so asymmetric.  
Looking at their help pages, I would say that at least some degree of  
asymmetry is plausible. Perhaps using save() with load() , or dput()  
with dget(), which are pairings that promise to have symmetry?

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list