[R] Output pairwise.t.test to data.frame
Peter Ehlers
ehlers at ucalgary.ca
Tue Oct 27 09:07:13 CET 2009
Sam,
The relevant part of the output is in test[["p.value"]]
which is a matrix. Use
write.table(test[["p.value"]], file="output.csv", sep=",")
and perhaps use the arguments row.names=FALSE and col.names=FALSE.
-Peter Ehlers
Sam Player wrote:
> # I'm doing a pairwise.t.test on a large dataset and need the output in a
> data frame so I can work further with it, e.g. so I can export it to a
> spreadsheet. Is there any way to coerce the results to an exportable format?
>
> # For example, if I do:
>
> test <- pairwise.t.test(numbers, factors, p.adj="bonferroni")
>
> # and then
>
> write.table(test, file="output.csv", sep=",")
>
> # I get the error
>
> # Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors =
> stringsAsFactors) :
> cannot coerce class "pairwise.htest" into a data.frame
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list