[R] basic statistics to csv

lanczos at fns.uniba.sk lanczos at fns.uniba.sk
Mon Oct 26 21:15:48 CET 2009

I know that my question is like a very newbie question, but at the moment
I stacked with it and I need a quick solution. I need to make an overall
statistical overview of various datasets, the summary() and numSummary()
functions are fully sufficient. My question is, how can I export results
to a spreadsheet-like file, as a .csv. For the summary() with an "x"
dataset I can use this way:

su <- summary(x)
write.csv(su, file = "summary.csv")

The problem with this is that the csv file is rather chaotic.

but when I apply the same for the numSummary(x) output like:

nsu <- numSummary(x[,c("a", "b", "c")], statistics=c("mean", "sd",
"quantiles"), quantiles=c(0,.25,.5,.75,1))

write.csv(nsu, file = "numsummary.csv")

I get the  "ERROR: cannot coerce class "numSummary" into a data.frame"

Is there a more convenient way to get a spreadsheet-like output for the
basic statistics?

Many thanks for any help


More information about the R-help mailing list