[R] Table question
Gabor Grothendieck
ggrothendieck at myway.com
Fri Oct 29 01:18:44 CEST 2004
Sean Davis <sdavis2 <at> mail.nih.gov> writes:
: I have a table (output from table(factor1,factor2)). I would like to
: use write.table to output that table to a file. However, it seems that
: as.data.frame converts such a table to three columns, Var1, Var2, and
: Freq rather than converting to the data.frame with equivalent numbers
: of rows and columns. I can use write.matrix from the MASS package, but
: then I get no rownames. Any hints here?
You could use captureOutput like this:
data(HairEyeColor)
capture.output(HairEyeColor, file = "myfile.txt")
See ?capture.output for more possibilities.
More information about the R-help
mailing list