Skip to content

Commit

Permalink
Merge 6d1eccc into 6244b20
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmbaazam authored May 4, 2023
2 parents 6244b20 + 6d1eccc commit 82053ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ CRAN-RELEASE
# C++ object files
inst/include/*.o
# avoid rstantools generated files
src
src

.DS_Store
21 changes: 10 additions & 11 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ make_conf <- function(value, CrI = 90, reverse = FALSE) {
#' "Likely decreasing" (< 0.95), "Decreasing" (<= 1)
#' @param var Numeric variable to be categorised
#'
#' @importFrom data.table fcase
#' @return A character variable.
#' @export
#' @examples
Expand All @@ -85,17 +86,15 @@ make_conf <- function(value, CrI = 90, reverse = FALSE) {
#'
#' map_prob_change(var)
map_prob_change <- function(var) {
# nolint start
var <- ifelse(var < 0.05, "Increasing",
ifelse(var < 0.4, "Likely increasing",
ifelse(var < 0.6, "Stable",
ifelse(var < 0.95, "Likely decreasing",
"Decreasing"
)
)
)
)
# nolint end

var <- data.table::fcase(
var < 0.05, "Increasing",
var >= 0.05 & var < 0.4, "Likely increasing",
var >= 0.4 & var < 0.6, "Stable",
var >= 0.6 & var < 0.95, "Likely decreasing",
var >= 0.95 & var <= 1, "Decreasing"
)

var <- factor(var, levels = c(
"Increasing", "Likely increasing", "Stable",
"Likely decreasing", "Decreasing"
Expand Down

0 comments on commit 82053ed

Please sign in to comment.