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@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.
______________________________________________ R-help@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.