Created
December 4, 2015 01:52
-
-
Save artemklevtsov/5a9c321120704a34292e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
as.data.frame.htest <- function(x) { | |
res <- list() | |
if (grepl("correlation", x$method) && !is.null(x$estimate)) | |
res[names(x$estimate)] <- x$estimate | |
else if (!is.null(x$statistic)) | |
res[names(x$statistic)] <- x$statistic | |
if (!is.null(x$parameter)) | |
res[names(x$parameter)] = x$parameter | |
if (!is.null(x$p.value)) { | |
res$p.value <- x$p.value | |
res$sign <- ifelse(x$p.value > 0.05, "", ifelse(x$p.value > 0.01, "*", ifelse(x$p.value > 0.001, "**", "***"))) | |
} | |
if (!is.null(x$alternative)) | |
res["alternative"] = x$alternative | |
as.data.frame(res, stringsAsFactors = FALSE) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment