1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-09 04:02:19 +02:00

(v0.7.1.9071) p_symbol()

This commit is contained in:
2019-09-03 09:47:39 +02:00
parent 06b6266366
commit b5d2a08401
18 changed files with 363 additions and 55 deletions

View File

@ -31,3 +31,10 @@ as.atc <- function(x) {
.Deprecated("ab_atc", package = "AMR")
AMR::ab_atc(x)
}
#' @rdname AMR-deprecated
#' @export
p.symbol <- function(...) {
.Deprecated("p_symbol", package = "AMR")
AMR::p_symbol(...)
}

View File

@ -27,34 +27,16 @@
#' @return Text
#' @inheritSection AMR Read more on our website!
#' @export
p.symbol <- function(p, emptychar = " ") {
setting.bak <- options()$scipen
options(scipen = 999)
s <- vector(mode = "character", length = length(p))
for (i in 1:length(p)) {
if (is.na(p[i])) {
s[i] <- NA_character_
next
}
if (p[i] > 1) {
s[i] <- NA_character_
next
} else {
p_test <- p[i]
}
p_symbol <- function(p, emptychar = " ") {
if (p_test > 0.1) {
s[i] <- emptychar
} else if (p_test > 0.05) {
s[i] <- '.'
} else if (p_test > 0.01) {
s[i] <- '*'
} else if (p_test > 0.001) {
s[i] <- '**'
} else if (p_test >= 0) {
s[i] <- '***'
}
}
options(scipen = setting.bak)
p <- as.double(p)
s <- rep(NA_character_, length(p))
s[p <= 1] <- emptychar
s[p <= 0.100] <- "."
s[p <= 0.050] <- "*"
s[p <= 0.010] <- "**"
s[p <= 0.001] <- "***"
s
}