mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 21:22:01 +02:00
(v1.6.0.9014) as.rsi() for numeric values
This commit is contained in:
2
R/plot.R
2
R/plot.R
@ -586,6 +586,8 @@ barplot.rsi <- function(height,
|
||||
|
||||
if (length(colours_RSI) == 1) {
|
||||
colours_RSI <- rep(colours_RSI, 3)
|
||||
} else {
|
||||
colours_RSI <- c(colours_RSI[2], colours_RSI[3], colours_RSI[1])
|
||||
}
|
||||
main <- gsub(" +", " ", paste0(main, collapse = " "))
|
||||
|
||||
|
7
R/rsi.R
7
R/rsi.R
@ -259,9 +259,10 @@ as.rsi.default <- function(x, ...) {
|
||||
}
|
||||
|
||||
if (inherits(x, c("integer", "numeric", "double")) && all(x %in% c(1:3, NA))) {
|
||||
x[x == 1] <- "S"
|
||||
x[x == 2] <- "I"
|
||||
x[x == 3] <- "R"
|
||||
x <- as.character(x) # this is needed to prevent the vctrs pkg to throw an error
|
||||
x[x == "1"] <- "S"
|
||||
x[x == "2"] <- "I"
|
||||
x[x == "3"] <- "R"
|
||||
|
||||
} else if (!all(is.na(x)) && !identical(levels(x), c("S", "I", "R")) && !all(x %in% c("R", "S", "I", NA))) {
|
||||
|
||||
|
Reference in New Issue
Block a user