feat: updated operators for creating new variables

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-12-12 17:52:10 +01:00
parent f4f433ee84
commit 30f13c7232
No known key found for this signature in database

View file

@ -184,35 +184,44 @@ create_column_server <- function(id,
#' #'
#' @rdname create-column #' @rdname create-column
# @importFrom methods getGroupMembers # @importFrom methods getGroupMembers
list_allowed_operations <- function() { allowed_operations <- function() {
c( list(
"(", "c", "Misc" = c("(", "c",":","~"),
# getGroupMembers("Arith"), # getGroupMembers("Arith"),
c("+", "-", "*", "^", "%%", "%/%", "/"), "Arithmetics" = c("+", "-", "*", "^", "%%", "%/%", "/"),
# getGroupMembers("Compare"), # getGroupMembers("Compare"),
c("==", ">", "<", "!=", "<=", ">="), "Compare" = c("==", ">", "<", "!=", "<=", ">="),
# getGroupMembers("Logic"), # getGroupMembers("Logic"),
c("&", "|"), "Logic" = c("&", "|", "is.na", "ifelse", "any", "all"),
# getGroupMembers("Math"), # getGroupMembers("Math"),
c( "Math" = c(
"abs", "sign", "sqrt", "ceiling", "floor", "trunc", "cummax", "abs", "sign", "sqrt", "ceiling", "floor", "trunc", "cummax",
"cummin", "cumprod", "cumsum", "exp", "expm1", "log", "log10", "cummin", "cumprod", "cumsum", "exp", "expm1", "log", "log10",
"log2", "log1p", "cos", "cosh", "sin", "sinh", "tan", "tanh", "log2", "log1p", "cos", "cosh", "sin", "sinh", "tan", "tanh",
"acos", "acosh", "asin", "asinh", "atan", "atanh", "cospi", "sinpi", "acos", "acosh", "asin", "asinh", "atan", "atanh", "cospi", "sinpi",
"tanpi", "gamma", "lgamma", "digamma", "trigamma" "tanpi", "gamma", "lgamma", "digamma", "trigamma", "round", "signif"
), ),
# getGroupMembers("Math2"), # getGroupMembers("Math2"),
c("round", "signif"), # c("round", "signif"),
# getGroupMembers("Summary"), # getGroupMembers("Summary"),
c("max", "min", "range", "prod", "sum", "any", "all"), "Summary" = c(
"pmin", "pmax", "mean", "max", "min", "range", "prod", "sum", "length",
"pmin", "pmax", "mean"
),
"Text" = c(
"paste", "paste0", "substr", "nchar", "trimws", "paste", "paste0", "substr", "nchar", "trimws",
"gsub", "sub", "grepl", "ifelse", "length", "gsub", "sub", "grepl"
),
"Class" = c(
"as.numeric", "as.character", "as.integer", "as.Date", "as.POSIXct", "as.numeric", "as.character", "as.integer", "as.Date", "as.POSIXct",
"as.factor", "factor" "as.factor", "factor"
) )
)
} }
list_allowed_operations <- function(data=allowed_operations()) {
Reduce(c,data)
}
#' @inheritParams shiny::modalDialog #' @inheritParams shiny::modalDialog