[R] Writing data frames

Andy Bunn abunn at montana.edu
Tue Dec 30 01:44:27 CET 2003


The key is in the error message:
"...can't coerce array into a data.frame"

Even if as.data.frame.default is unhappy you can coerce m into a
data.frame.

write.table(data.frame(m1 = m[1], m2 = m[2]), file="C:\\R\\tst.txt",
col.names=T, row.names=F, quote=F, append = FALSE)

There's probably a nicer way to do the coercion but this works.

HTH, Andy




More information about the R-help mailing list