From 05f4deb36a06aa976fcd1dc17b9172907038160c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:13:12 +0100 Subject: [PATCH 01/62] chore: update to roxygen2 7.3.1 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 279c7562..eaab5461 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -58,4 +58,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0 +RoxygenNote: 7.3.1 From 7765c0b39dd9f021b7aeb0fb130fae7f9591342e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:33:59 +0100 Subject: [PATCH 02/62] examples ::: R/call_utils.R --- R/call_utils.R | 113 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 39 deletions(-) diff --git a/R/call_utils.R b/R/call_utils.R index 9b3bbd24..f7de81b7 100644 --- a/R/call_utils.R +++ b/R/call_utils.R @@ -49,12 +49,15 @@ call_check_parse_varname <- function(varname) { #' } #' #' @examples -#' teal.transform:::call_condition_choice("SEX", choices = c(1, 2)) -#' teal.transform:::call_condition_choice(as.name("SEX"), choices = "F") -#' teal.transform:::call_condition_choice("SEX", choices = c("F", "M")) -#' teal.transform:::call_condition_choice("SEX", choices = factor(c("F", "M"))) -#' teal.transform:::call_condition_choice("x$SEX", choices = Sys.Date()) -#' teal.transform:::call_condition_choice("trunc(x$SEX)", choices = Sys.time()) +#' # use non-exported function from teal.transform +#' call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") +#' +#' call_condition_choice("SEX", choices = c(1, 2)) +#' call_condition_choice(as.name("SEX"), choices = "F") +#' call_condition_choice("SEX", choices = c("F", "M")) +#' call_condition_choice("SEX", choices = factor(c("F", "M"))) +#' call_condition_choice("x$SEX", choices = Sys.Date()) +#' call_condition_choice("trunc(x$SEX)", choices = Sys.time()) #' @return a `call` #' @keywords internal call_condition_choice <- function(varname, choices) { @@ -95,10 +98,14 @@ call_condition_choice <- function(varname, choices) { #' #' @return call #' @examples -#' teal.transform:::call_condition_range("AGE", range = c(1, 2)) -#' teal.transform:::call_condition_range(as.name("AGE"), range = c(-1.2, 2.1)) -#' teal.transform:::call_condition_range( -#' teal.transform:::call_extract_list("ADSL", "AGE"), +#' # use non-exported function from teal.transform +#' call_condition_range <- getFromNamespace("call_condition_range", "teal.transform") +#' call_extract_list <- getFromNamespace("call_extract_list", "teal.transform") +#' +#' call_condition_range("AGE", range = c(1, 2)) +#' call_condition_range(as.name("AGE"), range = c(-1.2, 2.1)) +#' call_condition_range( +#' call_extract_list("ADSL", "AGE"), #' range = c(-1.2, 2.1) #' ) #' @return a `call` @@ -126,8 +133,11 @@ call_condition_range <- function(varname, range) { #' #' @return call #' @examples -#' teal.transform:::call_condition_logical("event", choice = TRUE) -#' teal.transform:::call_condition_logical("event", choice = FALSE) +#' # use non-exported function from teal.transform +#' call_condition_logical <- getFromNamespace("call_condition_logical", "teal.transform") +#' +#' call_condition_logical("event", choice = TRUE) +#' call_condition_logical("event", choice = FALSE) #' @return a `call` #' @keywords internal call_condition_logical <- function(varname, choice) { @@ -164,7 +174,12 @@ call_condition_logical <- function(varname, choice) { #' By default `Sys.timezone()` is used. #' #' @examples -#' teal.transform:::call_condition_range_posixct( +#' # use non-exported function from teal.transform +#' call_condition_range_posixct <- getFromNamespace( +#' "call_condition_range_posixct", "teal.transform" +#' ) +#' +#' call_condition_range_posixct( #' varname = as.name("datetime"), #' range = c(Sys.time(), Sys.time() + 1), #' timezone = "UTC" @@ -203,7 +218,10 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone #' range of the variable #' #' @examples -#' teal.transform:::call_condition_range_date( +#' # use non-exported function from teal.transform +#' call_condition_range_date <- getFromNamespace("call_condition_range_date", "teal.transform") +#' +#' call_condition_range_date( #' as.name("date"), #' range = c(Sys.Date(), Sys.Date() + 1) #' ) @@ -233,15 +251,19 @@ call_condition_range_date <- function(varname, range) { #' optional, name of the `row` or condition #' @return `[` call with all conditions included #' @examples -#' teal.transform:::call_extract_array( +#' # use non-exported function from teal.transform +#' call_extract_array <- getFromNamespace("call_extract_array", "teal.transform") +#' call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") +#' +#' call_extract_array( #' dataname = "my_array", -#' row = teal.transform:::call_condition_choice("my_array$SEX", "M"), +#' row = call_condition_choice("my_array$SEX", "M"), #' column = call("c", "SEX", "AGE"), #' aisle = "RNAseq_rnaaccess" #' ) -#' teal.transform:::call_extract_array( +#' call_extract_array( #' "mae_object", -#' column = teal.transform:::call_condition_choice("SEX", "M") +#' column = call_condition_choice("SEX", "M") #' ) #' @return specific \code{\link[base]{Extract}} `call` for 3-dimensional array #' @keywords internal @@ -291,14 +313,18 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle #' optional, name of the `column` or condition #' @return `[` call with all conditions included #' @examples -#' teal.transform:::call_extract_matrix( +#' # use non-exported function from teal.transform +#' call_extract_matrix <- getFromNamespace("call_extract_matrix", "teal.transform") +#' call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") +#' +#' call_extract_matrix( #' dataname = "my_array", -#' row = teal.transform:::call_condition_choice("my_array$SEX", "M"), +#' row = call_condition_choice("my_array$SEX", "M"), #' column = call("c", "SEX", "AGE") #' ) -#' teal.transform:::call_extract_matrix( +#' call_extract_matrix( #' "mae_object", -#' column = teal.transform:::call_condition_choice("SEX", "M") +#' column = call_condition_choice("SEX", "M") #' ) #' @return specific \code{\link[base]{Extract}} `call` for matrix #' @keywords internal @@ -348,11 +374,14 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { #' #' @return `$` or `[[` call #' @examples -#' teal.transform:::call_extract_list("ADSL", "SEX") -#' teal.transform:::call_extract_list("ADSL", "named element") -#' teal.transform:::call_extract_list(as.name("ADSL"), as.name("AGE")) -#' teal.transform:::call_extract_list(as.name("weird name"), as.name("AGE")) -#' teal.transform:::call_extract_list(as.name("ADSL"), "AGE", dollar = FALSE) +#' # use non-exported function from teal.transform +#' call_extract_list <- getFromNamespace("call_extract_list", "teal.transform") +#' +#' call_extract_list("ADSL", "SEX") +#' call_extract_list("ADSL", "named element") +#' call_extract_list(as.name("ADSL"), as.name("AGE")) +#' call_extract_list(as.name("weird name"), as.name("AGE")) +#' call_extract_list(as.name("ADSL"), "AGE", dollar = FALSE) #' @keywords internal call_extract_list <- function(dataname, varname, dollar = TRUE) { checkmate::assert_flag(dollar) @@ -386,23 +415,24 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) { #' @param unlist_args `list` extra arguments passed in a single list, #' avoids the use of `do.call` with this function #' @examples +#' # use non-exported function from teal.transform +#' call_with_colon <- getFromNamespace("call_with_colon", "teal.transform") #' -#' print_call_and_eval <- function(x) { -#' eval(print(x)) -#' } +#' print_call_and_eval <- function(x) eval(print(x)) #' #' print_call_and_eval( -#' teal.transform:::call_with_colon("glue::glue", "x = {x}", x = 10) +#' call_with_colon("glue::glue", "x = {x}", x = 10) #' ) +#' #' \dontrun{ #' # mtcars$cyl evaluated #' print_call_and_eval( -#' teal.transform:::call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6) +#' call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6) #' ) #' #' # mtcars$cyl argument not evaluated immediately (in call expression) #' print_call_and_eval( -#' teal.transform:::call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6)) +#' call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6)) #' ) #' #' # does not work because argument is evaluated and the @@ -414,11 +444,11 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) { #' #' nb_args <- function(...) nargs() #' print_call_and_eval( -#' teal.transform:::call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3)) +#' call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3)) #' ) #' # duplicate arguments #' print_call_and_eval( -#' teal.transform:::call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2)) +#' call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2)) #' ) #' } #' @keywords internal @@ -444,12 +474,17 @@ call_with_colon <- function(name, ..., unlist_args = list()) { #' #' @return call #' @examples -#' teal.transform:::calls_combine_by( +#' # use non-exported function from teal.transform +#' calls_combine_by <- getFromNamespace("calls_combine_by", "teal.transform") +#' call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") +#' call_condition_range <- getFromNamespace("call_condition_range", "teal.transform") +#' +#' calls_combine_by( #' "&", #' calls = list( -#' teal.transform:::call_condition_choice("SEX", "F"), -#' teal.transform:::call_condition_range("AGE", c(20, 50)), -#' teal.transform:::call_condition_choice("ARM", "ARM: A"), +#' call_condition_choice("SEX", "F"), +#' call_condition_range("AGE", c(20, 50)), +#' call_condition_choice("ARM", "ARM: A"), #' TRUE #' ) #' ) From 5597d3644720f6f312dc06af5eea5ec3627a130e Mon Sep 17 00:00:00 2001 From: "27856297+dependabot-preview[bot]@users.noreply.github.com" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 10:39:29 +0000 Subject: [PATCH 03/62] [skip actions] Roxygen Man Pages Auto Update --- man/call_condition_choice.Rd | 15 +++++++++------ man/call_condition_logical.Rd | 7 +++++-- man/call_condition_range.Rd | 12 ++++++++---- man/call_condition_range_date.Rd | 5 ++++- man/call_condition_range_posixct.Rd | 7 ++++++- man/call_extract_array.Rd | 12 ++++++++---- man/call_extract_list.Rd | 13 ++++++++----- man/call_extract_matrix.Rd | 12 ++++++++---- man/call_with_colon.Rd | 17 +++++++++-------- man/calls_combine_by.Rd | 13 +++++++++---- 10 files changed, 74 insertions(+), 39 deletions(-) diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd index 86effa2d..a2e7095d 100644 --- a/man/call_condition_choice.Rd +++ b/man/call_condition_choice.Rd @@ -32,11 +32,14 @@ a \code{call} Compose choices condition call from inputs. } \examples{ -teal.transform:::call_condition_choice("SEX", choices = c(1, 2)) -teal.transform:::call_condition_choice(as.name("SEX"), choices = "F") -teal.transform:::call_condition_choice("SEX", choices = c("F", "M")) -teal.transform:::call_condition_choice("SEX", choices = factor(c("F", "M"))) -teal.transform:::call_condition_choice("x$SEX", choices = Sys.Date()) -teal.transform:::call_condition_choice("trunc(x$SEX)", choices = Sys.time()) +# use non-exported function from teal.transform +call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") + +call_condition_choice("SEX", choices = c(1, 2)) +call_condition_choice(as.name("SEX"), choices = "F") +call_condition_choice("SEX", choices = c("F", "M")) +call_condition_choice("SEX", choices = factor(c("F", "M"))) +call_condition_choice("x$SEX", choices = Sys.Date()) +call_condition_choice("trunc(x$SEX)", choices = Sys.time()) } \keyword{internal} diff --git a/man/call_condition_logical.Rd b/man/call_condition_logical.Rd index 6b4f974f..63121eb9 100644 --- a/man/call_condition_logical.Rd +++ b/man/call_condition_logical.Rd @@ -22,7 +22,10 @@ a \code{call} Compose \code{logical} variable condition call from inputs } \examples{ -teal.transform:::call_condition_logical("event", choice = TRUE) -teal.transform:::call_condition_logical("event", choice = FALSE) +# use non-exported function from teal.transform +call_condition_logical <- getFromNamespace("call_condition_logical", "teal.transform") + +call_condition_logical("event", choice = TRUE) +call_condition_logical("event", choice = FALSE) } \keyword{internal} diff --git a/man/call_condition_range.Rd b/man/call_condition_range.Rd index 97daa588..864a7afc 100644 --- a/man/call_condition_range.Rd +++ b/man/call_condition_range.Rd @@ -22,10 +22,14 @@ a \code{call} Compose \code{numeric} range condition call from inputs } \examples{ -teal.transform:::call_condition_range("AGE", range = c(1, 2)) -teal.transform:::call_condition_range(as.name("AGE"), range = c(-1.2, 2.1)) -teal.transform:::call_condition_range( - teal.transform:::call_extract_list("ADSL", "AGE"), +# use non-exported function from teal.transform +call_condition_range <- getFromNamespace("call_condition_range", "teal.transform") +call_extract_list <- getFromNamespace("call_extract_list", "teal.transform") + +call_condition_range("AGE", range = c(1, 2)) +call_condition_range(as.name("AGE"), range = c(-1.2, 2.1)) +call_condition_range( + call_extract_list("ADSL", "AGE"), range = c(-1.2, 2.1) ) } diff --git a/man/call_condition_range_date.Rd b/man/call_condition_range_date.Rd index b0f41048..1f7886be 100644 --- a/man/call_condition_range_date.Rd +++ b/man/call_condition_range_date.Rd @@ -20,7 +20,10 @@ a \code{call} Compose \code{Date} range condition call from inputs } \examples{ -teal.transform:::call_condition_range_date( +# use non-exported function from teal.transform +call_condition_range_date <- getFromNamespace("call_condition_range_date", "teal.transform") + +call_condition_range_date( as.name("date"), range = c(Sys.Date(), Sys.Date() + 1) ) diff --git a/man/call_condition_range_posixct.Rd b/man/call_condition_range_posixct.Rd index 834be1dd..fb69a5c6 100644 --- a/man/call_condition_range_posixct.Rd +++ b/man/call_condition_range_posixct.Rd @@ -26,7 +26,12 @@ a \code{call} Compose \code{POSIXct} range condition call from inputs. } \examples{ -teal.transform:::call_condition_range_posixct( +# use non-exported function from teal.transform +call_condition_range_posixct <- getFromNamespace( + "call_condition_range_posixct", "teal.transform" +) + +call_condition_range_posixct( varname = as.name("datetime"), range = c(Sys.time(), Sys.time() + 1), timezone = "UTC" diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd index 49a925ac..afa48387 100644 --- a/man/call_extract_array.Rd +++ b/man/call_extract_array.Rd @@ -27,15 +27,19 @@ specific \code{\link[base]{Extract}} \code{call} for 3-dimensional array Get call to subset and select array } \examples{ -teal.transform:::call_extract_array( +# use non-exported function from teal.transform +call_extract_array <- getFromNamespace("call_extract_array", "teal.transform") +call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") + +call_extract_array( dataname = "my_array", - row = teal.transform:::call_condition_choice("my_array$SEX", "M"), + row = call_condition_choice("my_array$SEX", "M"), column = call("c", "SEX", "AGE"), aisle = "RNAseq_rnaaccess" ) -teal.transform:::call_extract_array( +call_extract_array( "mae_object", - column = teal.transform:::call_condition_choice("SEX", "M") + column = call_condition_choice("SEX", "M") ) } \keyword{internal} diff --git a/man/call_extract_list.Rd b/man/call_extract_list.Rd index e74fea2a..db23d32f 100644 --- a/man/call_extract_list.Rd +++ b/man/call_extract_list.Rd @@ -23,10 +23,13 @@ whether returned call should use \code{$} or \code{[[} operator} Compose extract call with \code{$} operator } \examples{ -teal.transform:::call_extract_list("ADSL", "SEX") -teal.transform:::call_extract_list("ADSL", "named element") -teal.transform:::call_extract_list(as.name("ADSL"), as.name("AGE")) -teal.transform:::call_extract_list(as.name("weird name"), as.name("AGE")) -teal.transform:::call_extract_list(as.name("ADSL"), "AGE", dollar = FALSE) +# use non-exported function from teal.transform +call_extract_list <- getFromNamespace("call_extract_list", "teal.transform") + +call_extract_list("ADSL", "SEX") +call_extract_list("ADSL", "named element") +call_extract_list(as.name("ADSL"), as.name("AGE")) +call_extract_list(as.name("weird name"), as.name("AGE")) +call_extract_list(as.name("ADSL"), "AGE", dollar = FALSE) } \keyword{internal} diff --git a/man/call_extract_matrix.Rd b/man/call_extract_matrix.Rd index 01b159a6..b0ead71a 100644 --- a/man/call_extract_matrix.Rd +++ b/man/call_extract_matrix.Rd @@ -24,14 +24,18 @@ specific \code{\link[base]{Extract}} \code{call} for matrix Get call to subset and select matrix } \examples{ -teal.transform:::call_extract_matrix( +# use non-exported function from teal.transform +call_extract_matrix <- getFromNamespace("call_extract_matrix", "teal.transform") +call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") + +call_extract_matrix( dataname = "my_array", - row = teal.transform:::call_condition_choice("my_array$SEX", "M"), + row = call_condition_choice("my_array$SEX", "M"), column = call("c", "SEX", "AGE") ) -teal.transform:::call_extract_matrix( +call_extract_matrix( "mae_object", - column = teal.transform:::call_condition_choice("SEX", "M") + column = call_condition_choice("SEX", "M") ) } \keyword{internal} diff --git a/man/call_with_colon.Rd b/man/call_with_colon.Rd index a92d80ed..adcbe612 100644 --- a/man/call_with_colon.Rd +++ b/man/call_with_colon.Rd @@ -19,23 +19,24 @@ avoids the use of \code{do.call} with this function} The arguments in ... need to be quoted because they will be evaluated otherwise } \examples{ +# use non-exported function from teal.transform +call_with_colon <- getFromNamespace("call_with_colon", "teal.transform") -print_call_and_eval <- function(x) { - eval(print(x)) -} +print_call_and_eval <- function(x) eval(print(x)) print_call_and_eval( - teal.transform:::call_with_colon("glue::glue", "x = {x}", x = 10) + call_with_colon("glue::glue", "x = {x}", x = 10) ) + \dontrun{ # mtcars$cyl evaluated print_call_and_eval( - teal.transform:::call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6) + call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6) ) # mtcars$cyl argument not evaluated immediately (in call expression) print_call_and_eval( - teal.transform:::call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6)) + call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6)) ) # does not work because argument is evaluated and the @@ -47,11 +48,11 @@ call("filter", as.name("mtcars"), mtcars$cyl == 6) nb_args <- function(...) nargs() print_call_and_eval( - teal.transform:::call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3)) + call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3)) ) # duplicate arguments print_call_and_eval( - teal.transform:::call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2)) + call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2)) ) } } diff --git a/man/calls_combine_by.Rd b/man/calls_combine_by.Rd index c03f5b26..47bd8705 100644 --- a/man/calls_combine_by.Rd +++ b/man/calls_combine_by.Rd @@ -22,12 +22,17 @@ a combined \code{call} Combine list of calls by specific operator } \examples{ -teal.transform:::calls_combine_by( +# use non-exported function from teal.transform +calls_combine_by <- getFromNamespace("calls_combine_by", "teal.transform") +call_condition_choice <- getFromNamespace("call_condition_choice", "teal.transform") +call_condition_range <- getFromNamespace("call_condition_range", "teal.transform") + +calls_combine_by( "&", calls = list( - teal.transform:::call_condition_choice("SEX", "F"), - teal.transform:::call_condition_range("AGE", c(20, 50)), - teal.transform:::call_condition_choice("ARM", "ARM: A"), + call_condition_choice("SEX", "F"), + call_condition_range("AGE", c(20, 50)), + call_condition_choice("ARM", "ARM: A"), TRUE ) ) From 2a826a6731cadde8e8bf5443cd78da895c32b25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:57:25 +0100 Subject: [PATCH 04/62] examples ::: R/data_extract_filter_module.R --- R/data_extract_filter_module.R | 10 ++++++++-- man/data_extract_filter_ui.Rd | 5 ++++- man/get_initial_filter_values.Rd | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/R/data_extract_filter_module.R b/R/data_extract_filter_module.R index 21dc2b73..ff2673a2 100644 --- a/R/data_extract_filter_module.R +++ b/R/data_extract_filter_module.R @@ -9,7 +9,10 @@ #' @return `shiny.tag` defining the `filter_spec`'s UI element #' @keywords internal #' @examples -#' teal.transform:::data_extract_filter_ui(filter = filter_spec(vars = "test_var"), id = "test_id") +#' # use non-exported function from teal.transform +#' data_extract_filter_ui <- getFromNamespace("data_extract_filter_ui", "teal.transform") +#' +#' data_extract_filter_ui(filter = filter_spec(vars = "test_var"), id = "test_id") data_extract_filter_ui <- function(filter, id = "filter") { checkmate::assert_class(filter, "filter_spec") checkmate::assert_string(id) @@ -134,11 +137,14 @@ data_extract_filter_srv <- function(id, datasets, filter) { #' @keywords internal #' #' @examples +#' # use non-exported function from teal.transform +#' get_initial_filter_values <- getFromNamespace("get_initial_filter_values", "teal.transform") +#' #' filtered_data_list <- list(iris = shiny::reactive(utils::head(iris))) #' filter <- filter_spec(vars = colnames(iris)[1]) #' filter$dataname <- "iris" #' shiny::isolate( -#' teal.transform:::get_initial_filter_values(filter = filter, datasets = filtered_data_list) +#' get_initial_filter_values(filter = filter, datasets = filtered_data_list) #' ) #' get_initial_filter_values <- function(filter, datasets) { diff --git a/man/data_extract_filter_ui.Rd b/man/data_extract_filter_ui.Rd index c3ec47d7..8bda37f0 100644 --- a/man/data_extract_filter_ui.Rd +++ b/man/data_extract_filter_ui.Rd @@ -22,6 +22,9 @@ Creates two \code{optionSelectInput} elements (one for column and one for values on a definition of a \code{\link[=filter_spec]{filter_spec()}} object. } \examples{ -teal.transform:::data_extract_filter_ui(filter = filter_spec(vars = "test_var"), id = "test_id") +# use non-exported function from teal.transform +data_extract_filter_ui <- getFromNamespace("data_extract_filter_ui", "teal.transform") + +data_extract_filter_ui(filter = filter_spec(vars = "test_var"), id = "test_id") } \keyword{internal} diff --git a/man/get_initial_filter_values.Rd b/man/get_initial_filter_values.Rd index 53e15a3e..4a0a072c 100644 --- a/man/get_initial_filter_values.Rd +++ b/man/get_initial_filter_values.Rd @@ -20,11 +20,14 @@ Returns the initial values for the \code{vals} widget of a \code{filter_spec} object. } \examples{ +# use non-exported function from teal.transform +get_initial_filter_values <- getFromNamespace("get_initial_filter_values", "teal.transform") + filtered_data_list <- list(iris = shiny::reactive(utils::head(iris))) filter <- filter_spec(vars = colnames(iris)[1]) filter$dataname <- "iris" shiny::isolate( - teal.transform:::get_initial_filter_values(filter = filter, datasets = filtered_data_list) + get_initial_filter_values(filter = filter, datasets = filtered_data_list) ) } From 0e17987d0617cfbba55d2ed19f60957d99fe3786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 11:59:36 +0100 Subject: [PATCH 05/62] examples ::: R/data_extract_module.R --- R/data_extract_module.R | 5 ++++- man/cond_data_extract_single_ui.Rd | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/data_extract_module.R b/R/data_extract_module.R index 9921ef00..eeccf5b8 100644 --- a/R/data_extract_module.R +++ b/R/data_extract_module.R @@ -21,7 +21,10 @@ id_for_dataset <- function(dataname) { #' @return (`shiny.tag`) the Shiny tag with the HTML code for the panel #' @keywords internal #' @examples -#' teal.transform:::cond_data_extract_single_ui( +#' # use non-exported function from teal.transform +#' cond_data_extract_single_ui <- getFromNamespace("cond_data_extract_single_ui", "teal.transform") +#' +#' cond_data_extract_single_ui( #' shiny::NS("TEST"), #' data_extract_spec(dataname = "test") #' ) diff --git a/man/cond_data_extract_single_ui.Rd b/man/cond_data_extract_single_ui.Rd index 797af6b4..e99c074c 100644 --- a/man/cond_data_extract_single_ui.Rd +++ b/man/cond_data_extract_single_ui.Rd @@ -22,7 +22,10 @@ Creates a panel that displays (with filter and column selection) conditionally on \code{input[ns("dataset")] == dataname}. } \examples{ -teal.transform:::cond_data_extract_single_ui( +# use non-exported function from teal.transform +cond_data_extract_single_ui <- getFromNamespace("cond_data_extract_single_ui", "teal.transform") + +cond_data_extract_single_ui( shiny::NS("TEST"), data_extract_spec(dataname = "test") ) From c32ae427f246a5c877d8743a396d2edb386fb6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:01:02 +0100 Subject: [PATCH 06/62] examples ::: R/data_extract_select_module.R --- R/data_extract_select_module.R | 5 ++++- man/data_extract_select_ui.Rd | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/data_extract_select_module.R b/R/data_extract_select_module.R index 79d84ef4..dc8f1549 100644 --- a/R/data_extract_select_module.R +++ b/R/data_extract_select_module.R @@ -7,7 +7,10 @@ #' @return `shiny.tag.list` with the UI #' @keywords internal #' @examples -#' teal.transform:::data_extract_select_ui( +#' # use non-exported function from teal.transform +#' data_extract_select_ui <- getFromNamespace("data_extract_select_ui", "teal.transform") +#' +#' data_extract_select_ui( #' select = select_spec(choices = "test_choice"), #' id = "test_id" #' ) diff --git a/man/data_extract_select_ui.Rd b/man/data_extract_select_ui.Rd index 6b945028..d038327c 100644 --- a/man/data_extract_select_ui.Rd +++ b/man/data_extract_select_ui.Rd @@ -20,7 +20,10 @@ selection order.} Returns a \code{shiny.tag.list} object with the UI for a \code{select_spec} object } \examples{ -teal.transform:::data_extract_select_ui( +# use non-exported function from teal.transform +data_extract_select_ui <- getFromNamespace("data_extract_select_ui", "teal.transform") + +data_extract_select_ui( select = select_spec(choices = "test_choice"), id = "test_id" ) From ccfeee65edc8c48b510f68fd722631f07bbd0229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:01:33 +0100 Subject: [PATCH 07/62] examples ::: R/data_extract_single_module.R --- R/data_extract_single_module.R | 5 ++++- man/data_extract_single_ui.Rd | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/data_extract_single_module.R b/R/data_extract_single_module.R index 8616b0e8..ffee27af 100644 --- a/R/data_extract_single_module.R +++ b/R/data_extract_single_module.R @@ -10,7 +10,10 @@ #' @keywords internal #' #' @examples -#' teal.transform:::data_extract_single_ui(id = "test", data_extract_spec("extract")) +#' # use non-exported function from teal.transform +#' data_extract_single_ui <- getFromNamespace("data_extract_single_ui", "teal.transform") +#' +#' data_extract_single_ui(id = "test", data_extract_spec("extract")) data_extract_single_ui <- function(id = NULL, single_data_extract_spec) { stopifnot(inherits(single_data_extract_spec, "data_extract_spec")) ns <- NS(id) diff --git a/man/data_extract_single_ui.Rd b/man/data_extract_single_ui.Rd index 2176516b..057425b0 100644 --- a/man/data_extract_single_ui.Rd +++ b/man/data_extract_single_ui.Rd @@ -22,6 +22,9 @@ Creates a \code{shiny.tag} element defining the UI elements corresponding a single \code{data_extract_spec} object. } \examples{ -teal.transform:::data_extract_single_ui(id = "test", data_extract_spec("extract")) +# use non-exported function from teal.transform +data_extract_single_ui <- getFromNamespace("data_extract_single_ui", "teal.transform") + +data_extract_single_ui(id = "test", data_extract_spec("extract")) } \keyword{internal} From 5cc3a76e9f715e51a97b9c5bda1ca24d8271da7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:11:48 +0100 Subject: [PATCH 08/62] examples ::: R/filter_spec.R --- R/filter_spec.R | 9 ++++++--- man/filter_spec_internal.Rd | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/R/filter_spec.R b/R/filter_spec.R index a54afacf..06a4b0d3 100644 --- a/R/filter_spec.R +++ b/R/filter_spec.R @@ -216,20 +216,23 @@ filter_spec <- function(vars, #' @seealso filter_spec #' #' @examples -#' teal.transform:::filter_spec_internal( +#' # use non-exported function from teal.transform +#' filter_spec_internal <- getFromNamespace("filter_spec_internal", "teal.transform") +#' +#' filter_spec_internal( #' vars_choices = c("PARAMCD", "AVISIT"), #' vars_selected = "PARAMCD", #' vars_multiple = TRUE #' ) #' #' ADRS <- teal.transform::rADRS -#' teal.transform:::filter_spec_internal( +#' filter_spec_internal( #' vars_choices = variable_choices(ADRS), #' vars_selected = "PARAMCD", #' vars_multiple = TRUE #' ) #' -#' teal.transform:::filter_spec_internal( +#' filter_spec_internal( #' vars_choices = variable_choices("ADRS"), #' vars_selected = "PARAMCD", #' vars_multiple = TRUE diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd index 6ff426f7..01c1f602 100644 --- a/man/filter_spec_internal.Rd +++ b/man/filter_spec_internal.Rd @@ -129,20 +129,23 @@ the configuration of filtering datasets (so called \code{filter_spec}), which th the UI element in the \code{teal} app. } \examples{ -teal.transform:::filter_spec_internal( +# use non-exported function from teal.transform +filter_spec_internal <- getFromNamespace("filter_spec_internal", "teal.transform") + +filter_spec_internal( vars_choices = c("PARAMCD", "AVISIT"), vars_selected = "PARAMCD", vars_multiple = TRUE ) ADRS <- teal.transform::rADRS -teal.transform:::filter_spec_internal( +filter_spec_internal( vars_choices = variable_choices(ADRS), vars_selected = "PARAMCD", vars_multiple = TRUE ) -teal.transform:::filter_spec_internal( +filter_spec_internal( vars_choices = variable_choices("ADRS"), vars_selected = "PARAMCD", vars_multiple = TRUE From 29acabf87c13435958494b361c8a0da18d5ea540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:12:01 +0100 Subject: [PATCH 09/62] examples ::: R/get_dplyr_call.R --- R/get_dplyr_call.R | 41 ++++++++++++++++++++++++++++------------- man/get_dplyr_call.Rd | 13 ++++++++----- man/get_filter_call.Rd | 7 +++++-- man/get_rename_call.Rd | 11 +++++++---- man/get_reshape_call.Rd | 5 ++++- man/get_select_call.Rd | 5 ++++- 6 files changed, 56 insertions(+), 26 deletions(-) diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R index a50fcd06..c65b9b16 100644 --- a/R/get_dplyr_call.R +++ b/R/get_dplyr_call.R @@ -129,8 +129,11 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' @keywords internal #' #' @examples +#' # use non-exported function from teal.transform +#' get_dplyr_call <- getFromNamespace("get_dplyr_call", "teal.transform") +#' #' # one dataset -#' teal.transform:::get_dplyr_call( +#' get_dplyr_call( #' list(list( #' dataname = "ADSL", #' filters = NULL, @@ -140,7 +143,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' internal_id = "test1" #' )) #' ) -#' teal.transform:::get_dplyr_call( +#' get_dplyr_call( #' list(list( #' dataname = "ADSL", #' filters = list(list(columns = "SEX", selected = list("F", "M"))), @@ -150,7 +153,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' internal_id = "test1" #' )) #' ) -#' teal.transform:::get_dplyr_call( +#' get_dplyr_call( #' list(list( #' dataname = "ADSL", #' filters = list(list(columns = "SEX", selected = list("F", "M"))), @@ -162,7 +165,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' ) #' #' # two datasets with rename part -#' teal.transform:::get_dplyr_call( +#' get_dplyr_call( #' list( #' list( #' dataname = "ADSL", @@ -185,7 +188,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' ) #' #' # long dataset with reshape part -#' teal.transform:::get_dplyr_call( +#' get_dplyr_call( #' list(list( #' dataname = "ADLB", #' filters = list(list( @@ -250,7 +253,10 @@ get_dplyr_call <- function(selector_list, #' @keywords internal #' #' @examples -#' teal.transform:::get_select_call(letters) +#' # use non-exported function from teal.transform +#' get_select_call <- getFromNamespace("get_select_call", "teal.transform") +#' +#' get_select_call(letters) get_select_call <- function(select) { logger::log_trace("get_select_call called with: { paste(select, collapse = ', ') } columns.") if (is.null(select) || length(select) == 0) { @@ -271,10 +277,13 @@ get_select_call <- function(select) { #' @keywords internal #' #' @examples -#' teal.transform:::get_filter_call( +#' # use non-exported function from teal.transform +#' get_filter_call <- getFromNamespace("get_filter_call", "teal.transform") +#' +#' get_filter_call( #' filter = list(list(columns = "SEX", selected = list(NA, "F", "M"))) #' ) -#' teal.transform:::get_filter_call(filter = list( +#' get_filter_call(filter = list( #' list(columns = "SEX", selected = list(NA, "F", "M")), #' list(columns = "VAR", selected = list("LEVEL1", "LEVEL2")) #' )) @@ -409,6 +418,9 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) { #' @references get_rename_dict #' #' @examples +#' # use non-exported function from teal.transform +#' get_rename_call <- getFromNamespace("get_rename_call", "teal.transform") +#' #' x <- list( #' list( #' dataname = "ADSL", @@ -443,10 +455,10 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) { #' internal_id = "test4" #' ) #' ) -#' teal.transform:::get_rename_call(x, 1L) -#' teal.transform:::get_rename_call(x, 2L) -#' teal.transform:::get_rename_call(x, 3L) -#' teal.transform:::get_rename_call(x, 4L) +#' get_rename_call(x, 1L) +#' get_rename_call(x, 2L) +#' get_rename_call(x, 3L) +#' get_rename_call(x, 4L) get_rename_call <- function(selector_list = list(), idx = 1L, join_keys = teal.data::join_keys(), @@ -483,6 +495,9 @@ get_rename_call <- function(selector_list = list(), #' @keywords internal #' #' @examples +#' # use non-exported function from teal.transform +#' get_reshape_call <- getFromNamespace("get_reshape_call", "teal.transform") +#' #' filters <- list( #' columns = c("PARAMCD", "AVISIT"), #' selected = list(c("ALT", "SCREENING"), c("ALT", "BASELINE")) @@ -504,7 +519,7 @@ get_rename_call <- function(selector_list = list(), #' internal_id = "test" #' ) #' ) -#' teal.transform:::get_reshape_call(x, 1L) +#' get_reshape_call(x, 1L) get_reshape_call <- function(selector_list = list(), idx = 1L, join_keys = teal.data::join_keys(), diff --git a/man/get_dplyr_call.Rd b/man/get_dplyr_call.Rd index 9c228814..9569ee16 100644 --- a/man/get_dplyr_call.Rd +++ b/man/get_dplyr_call.Rd @@ -34,8 +34,11 @@ selections, reshapes etc. All necessary data for merging} Parse filter, select, rename and reshape call } \examples{ +# use non-exported function from teal.transform +get_dplyr_call <- getFromNamespace("get_dplyr_call", "teal.transform") + # one dataset -teal.transform:::get_dplyr_call( +get_dplyr_call( list(list( dataname = "ADSL", filters = NULL, @@ -45,7 +48,7 @@ teal.transform:::get_dplyr_call( internal_id = "test1" )) ) -teal.transform:::get_dplyr_call( +get_dplyr_call( list(list( dataname = "ADSL", filters = list(list(columns = "SEX", selected = list("F", "M"))), @@ -55,7 +58,7 @@ teal.transform:::get_dplyr_call( internal_id = "test1" )) ) -teal.transform:::get_dplyr_call( +get_dplyr_call( list(list( dataname = "ADSL", filters = list(list(columns = "SEX", selected = list("F", "M"))), @@ -67,7 +70,7 @@ teal.transform:::get_dplyr_call( ) # two datasets with rename part -teal.transform:::get_dplyr_call( +get_dplyr_call( list( list( dataname = "ADSL", @@ -90,7 +93,7 @@ teal.transform:::get_dplyr_call( ) # long dataset with reshape part -teal.transform:::get_dplyr_call( +get_dplyr_call( list(list( dataname = "ADLB", filters = list(list( diff --git a/man/get_filter_call.Rd b/man/get_filter_call.Rd index db996ce0..57d50f4f 100644 --- a/man/get_filter_call.Rd +++ b/man/get_filter_call.Rd @@ -20,10 +20,13 @@ get_filter_call(filter, dataname = NULL, datasets = NULL) Returns \code{dplyr} filter call } \examples{ -teal.transform:::get_filter_call( +# use non-exported function from teal.transform +get_filter_call <- getFromNamespace("get_filter_call", "teal.transform") + +get_filter_call( filter = list(list(columns = "SEX", selected = list(NA, "F", "M"))) ) -teal.transform:::get_filter_call(filter = list( +get_filter_call(filter = list( list(columns = "SEX", selected = list(NA, "F", "M")), list(columns = "VAR", selected = list("LEVEL1", "LEVEL2")) )) diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd index 0ee5db6a..c40ef0f6 100644 --- a/man/get_rename_call.Rd +++ b/man/get_rename_call.Rd @@ -31,6 +31,9 @@ selections, reshapes etc. All necessary data for merging} Rename is used only if there are duplicated columns } \examples{ +# use non-exported function from teal.transform +get_rename_call <- getFromNamespace("get_rename_call", "teal.transform") + x <- list( list( dataname = "ADSL", @@ -65,10 +68,10 @@ x <- list( internal_id = "test4" ) ) -teal.transform:::get_rename_call(x, 1L) -teal.transform:::get_rename_call(x, 2L) -teal.transform:::get_rename_call(x, 3L) -teal.transform:::get_rename_call(x, 4L) +get_rename_call(x, 1L) +get_rename_call(x, 2L) +get_rename_call(x, 3L) +get_rename_call(x, 4L) } \references{ get_rename_dict diff --git a/man/get_reshape_call.Rd b/man/get_reshape_call.Rd index 24208368..027cd34f 100644 --- a/man/get_reshape_call.Rd +++ b/man/get_reshape_call.Rd @@ -31,6 +31,9 @@ selections, reshapes etc. All necessary data for merging} Returns \code{dplyr} reshape call } \examples{ +# use non-exported function from teal.transform +get_reshape_call <- getFromNamespace("get_reshape_call", "teal.transform") + filters <- list( columns = c("PARAMCD", "AVISIT"), selected = list(c("ALT", "SCREENING"), c("ALT", "BASELINE")) @@ -52,6 +55,6 @@ x <- list( internal_id = "test" ) ) -teal.transform:::get_reshape_call(x, 1L) +get_reshape_call(x, 1L) } \keyword{internal} diff --git a/man/get_select_call.Rd b/man/get_select_call.Rd index b15d514f..dfb3deb5 100644 --- a/man/get_select_call.Rd +++ b/man/get_select_call.Rd @@ -16,6 +16,9 @@ get_select_call(select) Parse \code{dplyr} select call } \examples{ -teal.transform:::get_select_call(letters) +# use non-exported function from teal.transform +get_select_call <- getFromNamespace("get_select_call", "teal.transform") + +get_select_call(letters) } \keyword{internal} From 7bbc7e80286cc5ec7fa4a68191245dcff4cd8659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:14:19 +0100 Subject: [PATCH 10/62] examples ::: R/merge_datasets.R --- R/merge_datasets.R | 6 ++++-- man/merge_selectors.Rd | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/R/merge_datasets.R b/R/merge_datasets.R index 93fa1da7..0e58e921 100644 --- a/R/merge_datasets.R +++ b/R/merge_datasets.R @@ -135,6 +135,9 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function = #' @keywords internal #' #' @examples +#' # use non-exported function from teal.transform +#' merge_selectors <- getFromNamespace("merge_selectors", "teal.transform") +#' #' selector_list <- list( #' # ADSL - SEX #' list( @@ -160,8 +163,7 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function = #' ) #' ) #' ) -#' merged_selectors <- teal.transform:::merge_selectors(selector_list) -#' merged_selectors +#' merge_selectors(selector_list) merge_selectors <- function(selector_list) { logger::log_trace("merge_selectors called with: { paste(names(selector_list), collapse = ', ') } selectors.") checkmate::assert_list(selector_list, min.len = 1) diff --git a/man/merge_selectors.Rd b/man/merge_selectors.Rd index abf2e0e6..b899800e 100644 --- a/man/merge_selectors.Rd +++ b/man/merge_selectors.Rd @@ -19,6 +19,9 @@ error or nothing Merge selectors - select item if all of \code{dataname}, reshape, filters and keys items are identical } \examples{ +# use non-exported function from teal.transform +merge_selectors <- getFromNamespace("merge_selectors", "teal.transform") + selector_list <- list( # ADSL - SEX list( @@ -44,7 +47,6 @@ selector_list <- list( ) ) ) -merged_selectors <- teal.transform:::merge_selectors(selector_list) -merged_selectors +merge_selectors(selector_list) } \keyword{internal} From 84ec4c9fee1d5afb59ff935ef78cdeb795c758c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:27:14 +0100 Subject: [PATCH 11/62] examples ::: R/resolve.R --- R/resolve.R | 15 +++++++++------ man/resolve.Rd | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/R/resolve.R b/R/resolve.R index b3986d76..3d15cc36 100644 --- a/R/resolve.R +++ b/R/resolve.R @@ -10,6 +10,9 @@ #' @return Resolved object. #' #' @examples +#' # use non-exported function from teal.transform +#' resolve <- getFromNamespace("resolve", "teal.transform") +#' #' ADSL <- teal.transform::rADSL #' attr(ADSL, "keys") <- c("STUDYID", "USUBJID") #' data_list <- list(ADSL = shiny::reactive(ADSL)) @@ -18,12 +21,12 @@ #' # value_choices example #' v1 <- value_choices("ADSL", "SEX", "SEX") #' v1 -#' teal.transform:::resolve(v1, data_list, keys) +#' resolve(v1, data_list, keys) #' #' # variable_choices example #' v2 <- variable_choices("ADSL", c("BMRKR1", "BMRKR2")) #' v2 -#' teal.transform:::resolve(v2, data_list, keys) +#' resolve(v2, data_list, keys) #' #' # data_extract_spec example #' adsl_filter <- filter_spec( @@ -49,9 +52,9 @@ #' filter = adsl_filter #' ) #' -#' teal.transform:::resolve(adsl_filter, data_list, keys) -#' teal.transform:::resolve(adsl_select, data_list, keys) -#' teal.transform:::resolve(adsl_de, data_list, keys) +#' resolve(adsl_filter, data_list, keys) +#' resolve(adsl_select, data_list, keys) +#' resolve(adsl_de, data_list, keys) #' #' # nested list (arm_ref_comp) #' arm_ref_comp <- list( @@ -61,7 +64,7 @@ #' ) #' ) #' -#' teal.transform:::resolve(arm_ref_comp, data_list, keys) +#' resolve(arm_ref_comp, data_list, keys) #' }) resolve <- function(x, datasets, keys = NULL) { checkmate::assert_list(datasets, types = "reactive", min.len = 1, names = "named") diff --git a/man/resolve.Rd b/man/resolve.Rd index c5676855..fceacde5 100644 --- a/man/resolve.Rd +++ b/man/resolve.Rd @@ -21,6 +21,9 @@ Resolved object. \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} } \examples{ +# use non-exported function from teal.transform +resolve <- getFromNamespace("resolve", "teal.transform") + ADSL <- teal.transform::rADSL attr(ADSL, "keys") <- c("STUDYID", "USUBJID") data_list <- list(ADSL = shiny::reactive(ADSL)) @@ -29,12 +32,12 @@ shiny::isolate({ # value_choices example v1 <- value_choices("ADSL", "SEX", "SEX") v1 - teal.transform:::resolve(v1, data_list, keys) + resolve(v1, data_list, keys) # variable_choices example v2 <- variable_choices("ADSL", c("BMRKR1", "BMRKR2")) v2 - teal.transform:::resolve(v2, data_list, keys) + resolve(v2, data_list, keys) # data_extract_spec example adsl_filter <- filter_spec( @@ -60,9 +63,9 @@ shiny::isolate({ filter = adsl_filter ) - teal.transform:::resolve(adsl_filter, data_list, keys) - teal.transform:::resolve(adsl_select, data_list, keys) - teal.transform:::resolve(adsl_de, data_list, keys) + resolve(adsl_filter, data_list, keys) + resolve(adsl_select, data_list, keys) + resolve(adsl_de, data_list, keys) # nested list (arm_ref_comp) arm_ref_comp <- list( @@ -72,6 +75,6 @@ shiny::isolate({ ) ) - teal.transform:::resolve(arm_ref_comp, data_list, keys) + resolve(arm_ref_comp, data_list, keys) }) } From 015b7266db0d6d78dff9bd1ab86a44fdebc5f7d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:37:04 +0100 Subject: [PATCH 12/62] keywords internal are last and have empty line after --- R/call_utils.R | 11 +++++++++++ R/data_extract_filter_module.R | 7 +++++-- R/data_extract_module.R | 4 +++- R/data_extract_select_module.R | 3 ++- R/data_extract_single_module.R | 4 +++- R/filter_spec.R | 3 ++- R/get_dplyr_call.R | 16 +++++++++++----- R/get_merge_call.R | 7 ++++++- R/include_css_js.R | 1 + R/merge_datasets.R | 6 +++++- R/resolve.R | 24 ++++++++++++++++-------- R/teal.transform-package.R | 1 + R/utils.R | 2 +- 13 files changed, 67 insertions(+), 22 deletions(-) diff --git a/R/call_utils.R b/R/call_utils.R index f7de81b7..e3d9776f 100644 --- a/R/call_utils.R +++ b/R/call_utils.R @@ -4,6 +4,7 @@ #' @param varname (`name`, `call` or `character(1)`)\cr #' name of the variable #' @keywords internal +#' call_check_parse_varname <- function(varname) { checkmate::assert( checkmate::check_string(varname), @@ -60,6 +61,7 @@ call_check_parse_varname <- function(varname) { #' call_condition_choice("trunc(x$SEX)", choices = Sys.time()) #' @return a `call` #' @keywords internal +#' call_condition_choice <- function(varname, choices) { varname <- call_check_parse_varname(varname) @@ -110,6 +112,7 @@ call_condition_choice <- function(varname, choices) { #' ) #' @return a `call` #' @keywords internal +#' call_condition_range <- function(varname, range) { checkmate::assert_numeric(range, len = 2, sorted = TRUE) @@ -140,6 +143,7 @@ call_condition_range <- function(varname, range) { #' call_condition_logical("event", choice = FALSE) #' @return a `call` #' @keywords internal +#' call_condition_logical <- function(varname, choice) { checkmate::assert_flag(choice) varname <- call_check_parse_varname(varname) @@ -186,6 +190,7 @@ call_condition_logical <- function(varname, choice) { #' ) #' @return a `call` #' @keywords internal +#' call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone()) { checkmate::assert_posixct(range, len = 2, sorted = TRUE) checkmate::assert_string(timezone) @@ -227,6 +232,7 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone #' ) #' @return a `call` #' @keywords internal +#' call_condition_range_date <- function(varname, range) { checkmate::assert_date(range, len = 2) checkmate::assert_true(range[2] >= range[1]) @@ -267,6 +273,7 @@ call_condition_range_date <- function(varname, range) { #' ) #' @return specific \code{\link[base]{Extract}} `call` for 3-dimensional array #' @keywords internal +#' call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle = NULL) { checkmate::assert( checkmate::check_string(dataname), @@ -328,6 +335,7 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle #' ) #' @return specific \code{\link[base]{Extract}} `call` for matrix #' @keywords internal +#' call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { checkmate::assert( checkmate::check_string(dataname), @@ -383,6 +391,7 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { #' call_extract_list(as.name("weird name"), as.name("AGE")) #' call_extract_list(as.name("ADSL"), "AGE", dollar = FALSE) #' @keywords internal +#' call_extract_list <- function(dataname, varname, dollar = TRUE) { checkmate::assert_flag(dollar) checkmate::assert( @@ -452,6 +461,7 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) { #' ) #' } #' @keywords internal +#' call_with_colon <- function(name, ..., unlist_args = list()) { checkmate::assert_string(name) checkmate::assert_list(unlist_args) @@ -490,6 +500,7 @@ call_with_colon <- function(name, ..., unlist_args = list()) { #' ) #' @return a combined `call` #' @keywords internal +#' calls_combine_by <- function(operator, calls) { checkmate::assert_string(operator) stopifnot( diff --git a/R/data_extract_filter_module.R b/R/data_extract_filter_module.R index ff2673a2..774afd8d 100644 --- a/R/data_extract_filter_module.R +++ b/R/data_extract_filter_module.R @@ -7,12 +7,13 @@ #' @param id (`character(1)`) the shiny `inputId` for the generated `shiny.tag` #' #' @return `shiny.tag` defining the `filter_spec`'s UI element -#' @keywords internal #' @examples #' # use non-exported function from teal.transform #' data_extract_filter_ui <- getFromNamespace("data_extract_filter_ui", "teal.transform") #' #' data_extract_filter_ui(filter = filter_spec(vars = "test_var"), id = "test_id") +#' @keywords internal +#' data_extract_filter_ui <- function(filter, id = "filter") { checkmate::assert_class(filter, "filter_spec") checkmate::assert_string(id) @@ -55,6 +56,7 @@ data_extract_filter_ui <- function(filter, id = "filter") { #' @param datasets (`named list`) a list of reactive `data.frame` type objects. #' @param filter (`filter_spec`) the filter generated by a call to [filter_spec()] #' @keywords internal +#' data_extract_filter_srv <- function(id, datasets, filter) { checkmate::assert_list(datasets, types = "reactive", names = "named") moduleServer( @@ -134,7 +136,6 @@ data_extract_filter_srv <- function(id, datasets, filter) { #' #' @inheritParams data_extract_filter_srv #' @return `named list` with two slots `choices` and `selected` -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform @@ -147,6 +148,8 @@ data_extract_filter_srv <- function(id, datasets, filter) { #' get_initial_filter_values(filter = filter, datasets = filtered_data_list) #' ) #' +#' @keywords internal +#' get_initial_filter_values <- function(filter, datasets) { initial_values <- list() if (is.null(filter$vars_selected)) { diff --git a/R/data_extract_module.R b/R/data_extract_module.R index eeccf5b8..2659b4f3 100644 --- a/R/data_extract_module.R +++ b/R/data_extract_module.R @@ -19,7 +19,6 @@ id_for_dataset <- function(dataname) { #' Generated by [data_extract_spec()]. #' #' @return (`shiny.tag`) the Shiny tag with the HTML code for the panel -#' @keywords internal #' @examples #' # use non-exported function from teal.transform #' cond_data_extract_single_ui <- getFromNamespace("cond_data_extract_single_ui", "teal.transform") @@ -28,6 +27,8 @@ id_for_dataset <- function(dataname) { #' shiny::NS("TEST"), #' data_extract_spec(dataname = "test") #' ) +#' @keywords internal +#' cond_data_extract_single_ui <- function(ns, single_data_extract_spec) { dataname <- single_data_extract_spec$dataname conditionalPanel( @@ -196,6 +197,7 @@ data_extract_ui <- function(id, label, data_extract_spec, is_single_dataset = FA #' #' @return `NULL` #' @keywords internal +#' check_data_extract_spec_react <- function(datasets, data_extract) { if (!all(unlist(lapply(data_extract, `[[`, "dataname")) %in% datasets$datanames())) { shiny::validate( diff --git a/R/data_extract_select_module.R b/R/data_extract_select_module.R index dc8f1549..d7cf0e72 100644 --- a/R/data_extract_select_module.R +++ b/R/data_extract_select_module.R @@ -5,7 +5,6 @@ #' selection order. #' @param id (`character(1)`) The shiny `inputId` of the element #' @return `shiny.tag.list` with the UI -#' @keywords internal #' @examples #' # use non-exported function from teal.transform #' data_extract_select_ui <- getFromNamespace("data_extract_select_ui", "teal.transform") @@ -14,6 +13,8 @@ #' select = select_spec(choices = "test_choice"), #' id = "test_id" #' ) +#' @keywords internal +#' data_extract_select_ui <- function(select, id = "select") { checkmate::assert_class(select, "select_spec") checkmate::assert_string(id) diff --git a/R/data_extract_single_module.R b/R/data_extract_single_module.R index ffee27af..828af509 100644 --- a/R/data_extract_single_module.R +++ b/R/data_extract_single_module.R @@ -7,13 +7,14 @@ #' @param single_data_extract_spec (`data_extract_spec`) the [data_extract_spec()] object to handle. #' #' @return `shiny.tag` the HTML element defining the UI -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform #' data_extract_single_ui <- getFromNamespace("data_extract_single_ui", "teal.transform") #' #' data_extract_single_ui(id = "test", data_extract_spec("extract")) +#' @keywords internal +#' data_extract_single_ui <- function(id = NULL, single_data_extract_spec) { stopifnot(inherits(single_data_extract_spec, "data_extract_spec")) ns <- NS(id) @@ -72,6 +73,7 @@ data_extract_single_ui <- function(id = NULL, single_data_extract_spec) { #' #' @return `NULL` #' @keywords internal +#' data_extract_single_srv <- function(id, datasets, single_data_extract_spec) { moduleServer( id, diff --git a/R/filter_spec.R b/R/filter_spec.R index 06a4b0d3..851cdf71 100644 --- a/R/filter_spec.R +++ b/R/filter_spec.R @@ -211,7 +211,6 @@ filter_spec <- function(vars, #' TRUE if this filter was already consumed by the server function; FALSE otherwise. #' #' @return `filter_spec` or `delayed_filter_spec` S3-class object. -#' @keywords internal #' #' @seealso filter_spec #' @@ -237,6 +236,8 @@ filter_spec <- function(vars, #' vars_selected = "PARAMCD", #' vars_multiple = TRUE #' ) +#' @keywords internal +#' filter_spec_internal <- function(vars_choices, vars_selected = NULL, vars_label = NULL, diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R index c65b9b16..2ed1c073 100644 --- a/R/get_dplyr_call.R +++ b/R/get_dplyr_call.R @@ -7,6 +7,7 @@ #' @return (\code{list}) simplified selectors with aggregated set of filters, #' selections, reshapes etc. All necessary data for merging #' @keywords internal +#' get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys()) { logger::log_trace("get_dplyr_call_data called with: { paste(names(selector_list), collapse = ', ') } selectors.") checkmate::assert_class(join_keys, "join_keys") @@ -126,7 +127,6 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' @param data (`NULL` or named `list`). #' #' @return (\code{call}) filter, select, rename and reshape call -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform @@ -201,6 +201,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' internal_id = "test1" #' )) #' ) +#' @keywords internal get_dplyr_call <- function(selector_list, idx = 1L, join_keys = teal.data::join_keys(), @@ -250,13 +251,13 @@ get_dplyr_call <- function(selector_list, #' @param select (\code{character}) vector of selected column names #' #' @return (\code{call}) \code{dplyr} select call -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform #' get_select_call <- getFromNamespace("get_select_call", "teal.transform") #' #' get_select_call(letters) +#' @keywords internal get_select_call <- function(select) { logger::log_trace("get_select_call called with: { paste(select, collapse = ', ') } columns.") if (is.null(select) || length(select) == 0) { @@ -274,7 +275,6 @@ get_select_call <- function(select) { #' @param dataname (\code{NULL} or \code{character}) name of dataset. #' @param datasets (\code{NULL} or \code{named `list`}). #' @return (\code{call}) \code{dplyr} filter call -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform @@ -287,6 +287,7 @@ get_select_call <- function(select) { #' list(columns = "SEX", selected = list(NA, "F", "M")), #' list(columns = "VAR", selected = list("LEVEL1", "LEVEL2")) #' )) +#' @keywords internal get_filter_call <- function(filter, dataname = NULL, datasets = NULL) { logger::log_trace( paste( @@ -414,7 +415,6 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) { #' @inheritParams get_dplyr_call #' #' @return (\code{call}) \code{dplyr} rename call -#' @keywords internal #' @references get_rename_dict #' #' @examples @@ -459,6 +459,8 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) { #' get_rename_call(x, 2L) #' get_rename_call(x, 3L) #' get_rename_call(x, 4L) +#' @keywords internal +#' get_rename_call <- function(selector_list = list(), idx = 1L, join_keys = teal.data::join_keys(), @@ -492,7 +494,6 @@ get_rename_call <- function(selector_list = list(), #' @inheritParams get_dplyr_call #' #' @return (\code{list}) list of multiple \code{dplyr} calls that reshape data -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform @@ -520,6 +521,8 @@ get_rename_call <- function(selector_list = list(), #' ) #' ) #' get_reshape_call(x, 1L) +#' @keywords internal +#' get_reshape_call <- function(selector_list = list(), idx = 1L, join_keys = teal.data::join_keys(), @@ -572,6 +575,7 @@ get_reshape_call <- function(selector_list = list(), #' Get values names which are spread into columns. #' @param selector one element of selector_list obtained by \code{get_dplyr_call_data}. #' @keywords internal +#' get_pivot_longer_col <- function(selector) { logger::log_trace("get_reshape_unite_col called with: { selector$internal_id } selector.") setdiff(selector$select, selector$keys) @@ -583,6 +587,7 @@ get_pivot_longer_col <- function(selector) { #' on keys which are in \code{filter_spec}. #' @inheritParams get_pivot_longer_col #' @keywords internal +#' get_reshape_unite_col <- function(selector) { logger::log_trace("get_reshape_unite_col called with: { selector$internal_id } selector.") intersect( @@ -596,6 +601,7 @@ get_reshape_unite_col <- function(selector) { #' Get key values (levels) of the unite columns. #' @inheritParams get_pivot_longer_col #' @keywords internal +#' get_reshape_unite_vals <- function(selector) { logger::log_trace("get_reshape_unite_vals called with: { selector$internal_id } selector.") unite_cols <- get_reshape_unite_col(selector) diff --git a/R/get_merge_call.R b/R/get_merge_call.R index 4d669d20..a000ca29 100644 --- a/R/get_merge_call.R +++ b/R/get_merge_call.R @@ -116,6 +116,7 @@ get_merge_call <- function(selector_list, #' @inheritParams get_merge_call #' @return list of key pairs between all datasets #' @keywords internal +#' get_merge_key_grid <- function(selector_list, join_keys = teal.data::join_keys()) { logger::log_trace( "get_merge_key_grid called with: { paste(names(selector_list), collapse = ', ') } selectors." @@ -138,7 +139,6 @@ get_merge_key_grid <- function(selector_list, join_keys = teal.data::join_keys() ) } - #' Gets keys vector from keys list #' #' @param selector_from (`list`) `data_extract_srv` @@ -160,6 +160,7 @@ get_merge_key_grid <- function(selector_list, join_keys = teal.data::join_keys() #' #' @return (`character`) #' @keywords internal +#' get_merge_key_pair <- function(selector_from, selector_to, key_from) { logger::log_trace( paste( @@ -199,6 +200,7 @@ get_merge_key_pair <- function(selector_from, selector_to, key_from) { #' #' @return (`call`) #' @keywords internal +#' get_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call_data(selector_list)) { checkmate::assert_integer(idx, len = 1, any.missing = FALSE, lower = 2L) @@ -286,6 +288,7 @@ get_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call #' @param merge_key keys obtained from `get_merge_key_i` #' @param idx optional (`integer`) current selector index in all selectors list #' @keywords internal +#' parse_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call_data(selector_list), @@ -310,6 +313,7 @@ parse_merge_key_i <- function(selector_list, #' @inheritParams get_pivot_longer_col #' @return names `character` of the filters which should be dropped from select call #' @keywords internal +#' get_dropped_filters <- function(selector) { logger::log_trace("get_dropped_filters called with { selector$internal_id } selector.") unlist( @@ -446,6 +450,7 @@ get_relabel_call <- function(labels) { #' @param dplyr_call_data `list` #' @return columns_source `list` without columns which has been reshaped #' @keywords internal +#' get_relabel_cols <- function(columns_source, dplyr_call_data) { logger::log_trace( "get_relabel_cols called with: { paste(names(columns_source), collapse = ', ') } columns_source." diff --git a/R/include_css_js.R b/R/include_css_js.R index 8a70158c..4af966ad 100644 --- a/R/include_css_js.R +++ b/R/include_css_js.R @@ -8,6 +8,7 @@ #' #' @return HTML code that includes `CSS` files #' @keywords internal +#' include_css_files <- function(pattern = "*") { css_files <- list.files( system.file("css", package = "teal.transform", mustWork = TRUE), diff --git a/R/merge_datasets.R b/R/merge_datasets.R index 0e58e921..9b84181a 100644 --- a/R/merge_datasets.R +++ b/R/merge_datasets.R @@ -132,7 +132,6 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function = #' @inheritParams merge_datasets #' #' @return error or nothing -#' @keywords internal #' #' @examples #' # use non-exported function from teal.transform @@ -164,6 +163,8 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function = #' ) #' ) #' merge_selectors(selector_list) +#' @keywords internal +#' merge_selectors <- function(selector_list) { logger::log_trace("merge_selectors called with: { paste(names(selector_list), collapse = ', ') } selectors.") checkmate::assert_list(selector_list, min.len = 1) @@ -222,6 +223,7 @@ merge_selectors <- function(selector_list) { #' @inheritParams merge_datasets #' @return \code{NULL} if check is successful #' @keywords internal +#' check_data_merge_selectors <- function(selector_list) { # check if reshape n empt select or just primary keys lapply(selector_list, function(x) { @@ -249,6 +251,7 @@ check_data_merge_selectors <- function(selector_list) { #' @return `TRUE` if the provided keys meet the requirements; the `shiny` #' validate error otherwise #' @keywords internal +#' validate_keys_sufficient <- function(join_keys, merged_selector_list) { validate( need( @@ -275,6 +278,7 @@ validate_keys_sufficient <- function(join_keys, merged_selector_list) { #' @return `TRUE` if all pairs of the slices have the corresponding keys; #' `FALSE` otherwise #' @keywords internal +#' are_needed_keys_provided <- function(join_keys, merged_selector_list) { # because one slice doesn't have to be merged with anything if (length(merged_selector_list) <= 1) { diff --git a/R/resolve.R b/R/resolve.R index 3d15cc36..a02dad34 100644 --- a/R/resolve.R +++ b/R/resolve.R @@ -182,7 +182,6 @@ resolve.default <- function(x, datasets, keys) { #' @param is_value_choices (`logical`) Determines which check of the returned value will be applied. #' #' @return Character vector - result of calling function `x` on dataset `ds`. -#' @keywords internal #' #' @examples #' \dontrun{ @@ -196,6 +195,8 @@ resolve.default <- function(x, datasets, keys) { #' is_value_choices = FALSE #' ) #' } +#' @keywords internal +#' resolve_delayed_expr <- function(x, ds, is_value_choices) { checkmate::assert_function(x, args = "data", nargs = 1) @@ -224,8 +225,9 @@ resolve_delayed_expr <- function(x, ds, is_value_choices) { return(res) } -#' @keywords internal #' @export +#' @keywords internal +#' print.delayed_variable_choices <- function(x, indent = 0L, ...) { cat(indent_msg(indent, paste("variable_choices with delayed data:", x$data))) cat("\n") @@ -233,8 +235,9 @@ print.delayed_variable_choices <- function(x, indent = 0L, ...) { return(invisible(NULL)) } -#' @keywords internal #' @export +#' @keywords internal +#' print.delayed_value_choices <- function(x, indent = 0L, ...) { cat(indent_msg(indent, paste("value_choices with delayed data: ", x$data))) cat("\n") @@ -242,8 +245,9 @@ print.delayed_value_choices <- function(x, indent = 0L, ...) { return(invisible(NULL)) } -#' @keywords internal #' @export +#' @keywords internal +#' print.delayed_choices_selected <- function(x, indent = 0L, ...) { cat(indent_msg(indent, paste("choices_selected with delayed data: ", x$choices$data))) cat("\n") @@ -251,8 +255,9 @@ print.delayed_choices_selected <- function(x, indent = 0L, ...) { return(invisible(NULL)) } -#' @keywords internal #' @export +#' @keywords internal +#' print.delayed_select_spec <- function(x, indent = 0L, ...) { cat(indent_msg(indent, paste("select_spec with delayed data:", x$choices$data))) cat("\n") @@ -260,8 +265,9 @@ print.delayed_select_spec <- function(x, indent = 0L, ...) { return(invisible(NULL)) } -#' @keywords internal #' @export +#' @keywords internal +#' print.filter_spec <- function(x, indent = 0L, ...) { cat(indent_msg(indent, "filter_spec with delayed data:")) cat("\n") @@ -269,8 +275,9 @@ print.filter_spec <- function(x, indent = 0L, ...) { return(invisible(NULL)) } -#' @keywords internal #' @export +#' @keywords internal +#' print.delayed_filter_spec <- function(x, indent = 0L, ...) { cat(indent_msg(indent, "filter_spec with delayed data:")) cat("\n") @@ -278,8 +285,9 @@ print.delayed_filter_spec <- function(x, indent = 0L, ...) { return(invisible(NULL)) } -#' @keywords internal #' @export +#' @keywords internal +#' print.delayed_data_extract_spec <- function(x, indent = 0L, ...) { cat(paste("data_extract_spec with delayed data:", x$dataname)) cat("\n\n") diff --git a/R/teal.transform-package.R b/R/teal.transform-package.R index 00379641..e4a48cd1 100644 --- a/R/teal.transform-package.R +++ b/R/teal.transform-package.R @@ -1,5 +1,6 @@ #' teal.transform: Functions for extracting and merging data in the `teal` framework #' @keywords internal +#' "_PACKAGE" #' @import shiny diff --git a/R/utils.R b/R/utils.R index ca3d9189..2e1ed876 100644 --- a/R/utils.R +++ b/R/utils.R @@ -22,6 +22,7 @@ split_by_sep <- function(x, sep) { #' #' @return (`character`) vector with labels #' @keywords internal +#' extract_choices_labels <- function(choices, values = NULL) { res <- if (inherits(choices, "choices_labeled")) { attr(choices, "raw_labels") @@ -39,7 +40,6 @@ extract_choices_labels <- function(choices, values = NULL) { return(res) } - #' Function to compose `validators` from `data_extract_multiple_srv` #' #' This function takes the output from `data_extract_multiple_srv` and From de7c16c027e04c1958568ad65e6f2a69261ad0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:55:01 +0100 Subject: [PATCH 13/62] Make sure all teal.* mentions are lower-cased and quoted --- R/data_extract_module.R | 4 ++-- R/data_extract_spec.R | 4 ++-- R/filter_spec.R | 4 ++-- R/select_spec.R | 2 +- R/teal.transform-package.R | 3 +-- man/data_extract_spec.Rd | 4 ++-- man/data_extract_ui.Rd | 4 ++-- man/filter_spec_internal.Rd | 2 +- man/select_spec.Rd | 2 +- man/teal.transform-package.Rd | 2 +- 10 files changed, 15 insertions(+), 16 deletions(-) diff --git a/R/data_extract_module.R b/R/data_extract_module.R index 2659b4f3..82cb57ad 100644 --- a/R/data_extract_module.R +++ b/R/data_extract_module.R @@ -40,12 +40,12 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) { ) } -#' teal data extraction module user-interface +#' `teal` data extraction module user-interface #' #' @description `r lifecycle::badge("experimental")` #' This functionality should be used in the encoding panel of your `teal` app. It will #' allow app-developers to specify a [data_extract_spec] object. This object should be used -#' to teal module variables being filtered data from `CDISC` datasets. You can use this function in the same way as any +#' to `teal` module variables being filtered data from `CDISC` datasets. You can use this function in the same way as any #' [shiny module](https://shiny.rstudio.com/articles/modules.html) UI. The corresponding server module #' can be found in [data_extract_srv()]. #' diff --git a/R/data_extract_spec.R b/R/data_extract_spec.R index 8bcdb78b..09ffccfd 100644 --- a/R/data_extract_spec.R +++ b/R/data_extract_spec.R @@ -1,9 +1,9 @@ -#' Data Extract input for teal modules +#' Data Extract input for `teal` modules #' #' @description `r lifecycle::badge("stable")` #' #' The Data Extract input can be used to filter and select columns from a data -#' set. This function enables such an input in teal. +#' set. This function enables such an input in `teal`. #' Please use the constructor function [data_extract_spec] to set it up. #' #' Note that no checks based on columns can be done because the data is only referred to by name. diff --git a/R/filter_spec.R b/R/filter_spec.R index 851cdf71..8225ca99 100644 --- a/R/filter_spec.R +++ b/R/filter_spec.R @@ -48,7 +48,7 @@ #' #' @details #' -#' The \code{filter_spec} is used inside \code{teal} apps to allow filtering datasets +#' The \code{filter_spec} is used inside `teal` apps to allow filtering datasets #' for their key variables. Imagine having an adverse events table. It has #' the columns \code{PARAMCD} and \code{CNSR}. \code{PARAMCD} contains the levels #' \code{"OS"}, \code{"PFS"}, \code{"EFS"}. \code{CNSR} contains the levels \code{"0"} and \code{"1"}. @@ -205,7 +205,7 @@ filter_spec <- function(vars, #' @param fixed (`logical`)\cr #' if true allow to change the initially selected values of the variables; otherwise, do not allow. #' @param dataname (`character`)\cr -#' the name of the dataset this filter covers. Set during the initialization of the teal application. +#' the name of the dataset this filter covers. Set during the initialization of the `teal` application. #' @param initialized (`logical`)\cr #' indicates whether this filter was already initialized in the application. #' TRUE if this filter was already consumed by the server function; FALSE otherwise. diff --git a/R/select_spec.R b/R/select_spec.R index 6da0d183..fa03729b 100644 --- a/R/select_spec.R +++ b/R/select_spec.R @@ -1,7 +1,7 @@ #' Column selection input specification #' #' @description `r lifecycle::badge("stable")` -#' \code{select_spec} is used inside teal to create a \code{\link[shiny]{selectInput}} +#' \code{select_spec} is used inside `teal` to create a \code{\link[shiny]{selectInput}} #' that will select columns from a dataset. #' #' @param choices (\code{character}) or (\code{delayed_data}) object. diff --git a/R/teal.transform-package.R b/R/teal.transform-package.R index e4a48cd1..27b4722f 100644 --- a/R/teal.transform-package.R +++ b/R/teal.transform-package.R @@ -1,6 +1,5 @@ -#' teal.transform: Functions for extracting and merging data in the `teal` framework +#' `teal.transform`: Functions for extracting and merging data in the `teal` framework #' @keywords internal -#' "_PACKAGE" #' @import shiny diff --git a/man/data_extract_spec.Rd b/man/data_extract_spec.Rd index 22fb034e..128f2328 100644 --- a/man/data_extract_spec.Rd +++ b/man/data_extract_spec.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/data_extract_spec.R \name{data_extract_spec} \alias{data_extract_spec} -\title{Data Extract input for teal modules} +\title{Data Extract input for \code{teal} modules} \usage{ data_extract_spec(dataname, select = NULL, filter = NULL, reshape = FALSE) } @@ -28,7 +28,7 @@ keys selected in filter part.} \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} The Data Extract input can be used to filter and select columns from a data -set. This function enables such an input in teal. +set. This function enables such an input in \code{teal}. Please use the constructor function \link{data_extract_spec} to set it up. Note that no checks based on columns can be done because the data is only referred to by name. diff --git a/man/data_extract_ui.Rd b/man/data_extract_ui.Rd index 7d1fb26f..48c3773c 100644 --- a/man/data_extract_ui.Rd +++ b/man/data_extract_ui.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/data_extract_module.R \name{data_extract_ui} \alias{data_extract_ui} -\title{teal data extraction module user-interface} +\title{\code{teal} data extraction module user-interface} \usage{ data_extract_ui(id, label, data_extract_spec, is_single_dataset = FALSE) } @@ -42,7 +42,7 @@ The output can be analyzed using \code{data_extract_srv(...)}. \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} This functionality should be used in the encoding panel of your \code{teal} app. It will allow app-developers to specify a \link{data_extract_spec} object. This object should be used -to teal module variables being filtered data from \code{CDISC} datasets. You can use this function in the same way as any +to \code{teal} module variables being filtered data from \code{CDISC} datasets. You can use this function in the same way as any \href{https://shiny.rstudio.com/articles/modules.html}{shiny module} UI. The corresponding server module can be found in \code{\link[=data_extract_srv]{data_extract_srv()}}. } diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd index 01c1f602..4224751d 100644 --- a/man/filter_spec_internal.Rd +++ b/man/filter_spec_internal.Rd @@ -114,7 +114,7 @@ shiny \code{\link[shiny]{selectInput}}.} \code{TRUE} on default.} \item{dataname}{(\code{character})\cr -the name of the dataset this filter covers. Set during the initialization of the teal application.} +the name of the dataset this filter covers. Set during the initialization of the \code{teal} application.} \item{initialized}{(\code{logical})\cr indicates whether this filter was already initialized in the application. diff --git a/man/select_spec.Rd b/man/select_spec.Rd index 55a83d0f..e1eaae60 100644 --- a/man/select_spec.Rd +++ b/man/select_spec.Rd @@ -71,7 +71,7 @@ If \code{select_spec}, then the function double checks the \code{choices} and \c } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -\code{select_spec} is used inside teal to create a \code{\link[shiny]{selectInput}} +\code{select_spec} is used inside \code{teal} to create a \code{\link[shiny]{selectInput}} that will select columns from a dataset. } \examples{ diff --git a/man/teal.transform-package.Rd b/man/teal.transform-package.Rd index de709428..85a9dc90 100644 --- a/man/teal.transform-package.Rd +++ b/man/teal.transform-package.Rd @@ -4,7 +4,7 @@ \name{teal.transform-package} \alias{teal.transform} \alias{teal.transform-package} -\title{teal.transform: Functions for extracting and merging data in the \code{teal} framework} +\title{\code{teal.transform}: Functions for extracting and merging data in the \code{teal} framework} \description{ A standardized user interface for column selection, that facilitates dataset merging in 'teal' framework. } From dd7e97dafcbf2c140a4b0dbb45acd659b5fd8346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:58:24 +0100 Subject: [PATCH 14/62] update installation instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5a40e78..1b7d8956 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This package contains functions and shiny modules for extracting and merging dat ```r # stable versions -install.packages('teal.transform', repos = c('https://insightsengineering.r-universe.dev', getOption('repos'))) +install.packages('teal.slice') # install.packages("pak") pak::pak("insightsengineering/teal.transform@*release") From f433a4e43804ea3db8c0f14c2a07e9e2d5e509ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 13:01:04 +0100 Subject: [PATCH 15/62] lint: correct long line --- R/data_extract_module.R | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/R/data_extract_module.R b/R/data_extract_module.R index 82cb57ad..959ad2ed 100644 --- a/R/data_extract_module.R +++ b/R/data_extract_module.R @@ -43,11 +43,12 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) { #' `teal` data extraction module user-interface #' #' @description `r lifecycle::badge("experimental")` -#' This functionality should be used in the encoding panel of your `teal` app. It will -#' allow app-developers to specify a [data_extract_spec] object. This object should be used -#' to `teal` module variables being filtered data from `CDISC` datasets. You can use this function in the same way as any -#' [shiny module](https://shiny.rstudio.com/articles/modules.html) UI. The corresponding server module -#' can be found in [data_extract_srv()]. +#' This functionality should be used in the encoding panel of your `teal` app. +#' It will allow app-developers to specify a [data_extract_spec] object. +#' This object should be used to `teal` module variables being filtered data +#' from `CDISC` datasets. You can use this function in the same way as any +#' [shiny module](https://shiny.rstudio.com/articles/modules.html) UI. +#' The corresponding server module can be found in [data_extract_srv()]. #' #' @param id (`character`) shiny input unique identifier #' @param label (`character`) Label above the data extract input From 52eb3e5f116c0aafa2f49b90d94ad13ce373ae2f Mon Sep 17 00:00:00 2001 From: "27856297+dependabot-preview[bot]@users.noreply.github.com" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:03:57 +0000 Subject: [PATCH 16/62] [skip actions] Roxygen Man Pages Auto Update --- man/data_extract_ui.Rd | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/man/data_extract_ui.Rd b/man/data_extract_ui.Rd index 48c3773c..4bf131a1 100644 --- a/man/data_extract_ui.Rd +++ b/man/data_extract_ui.Rd @@ -40,11 +40,12 @@ The output can be analyzed using \code{data_extract_srv(...)}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} -This functionality should be used in the encoding panel of your \code{teal} app. It will -allow app-developers to specify a \link{data_extract_spec} object. This object should be used -to \code{teal} module variables being filtered data from \code{CDISC} datasets. You can use this function in the same way as any -\href{https://shiny.rstudio.com/articles/modules.html}{shiny module} UI. The corresponding server module -can be found in \code{\link[=data_extract_srv]{data_extract_srv()}}. +This functionality should be used in the encoding panel of your \code{teal} app. +It will allow app-developers to specify a \link{data_extract_spec} object. +This object should be used to \code{teal} module variables being filtered data +from \code{CDISC} datasets. You can use this function in the same way as any +\href{https://shiny.rstudio.com/articles/modules.html}{shiny module} UI. +The corresponding server module can be found in \code{\link[=data_extract_srv]{data_extract_srv()}}. } \examples{ library(shiny) From 206c14e3c3f502886e7819cbe3524fca7f9a209e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:28:49 +0100 Subject: [PATCH 17/62] remove dontrun sections on examples --- R/call_utils.R | 2 -- R/choices_labeled.R | 40 +++++++++++---------- R/choices_selected.R | 4 +-- R/merge_datasets.R | 66 +++++++++++++++++++++++++++------- R/merge_expression_module.R | 8 ++--- R/resolve.R | 5 +-- man/call_with_colon.Rd | 2 -- man/choices_labeled.Rd | 40 +++++++++++---------- man/choices_selected.Rd | 4 +-- man/merge_datasets.Rd | 49 ++++++++++++++++++++++--- man/merge_expression_module.Rd | 4 +-- man/merge_expression_srv.Rd | 4 +-- man/resolve_delayed_expr.Rd | 5 +-- 13 files changed, 159 insertions(+), 74 deletions(-) diff --git a/R/call_utils.R b/R/call_utils.R index e3d9776f..27861049 100644 --- a/R/call_utils.R +++ b/R/call_utils.R @@ -433,7 +433,6 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) { #' call_with_colon("glue::glue", "x = {x}", x = 10) #' ) #' -#' \dontrun{ #' # mtcars$cyl evaluated #' print_call_and_eval( #' call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6) @@ -459,7 +458,6 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) { #' print_call_and_eval( #' call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2)) #' ) -#' } #' @keywords internal #' call_with_colon <- function(name, ..., unlist_args = list()) { diff --git a/R/choices_labeled.R b/R/choices_labeled.R index bf44ddaa..45aff8e5 100644 --- a/R/choices_labeled.R +++ b/R/choices_labeled.R @@ -24,35 +24,37 @@ #' #' ADSL <- teal.transform::rADSL #' ADTTE <- teal.transform::rADTTE +#' #' choices1 <- choices_labeled(names(ADSL), teal.data::col_labels(ADSL, fill = FALSE)) #' choices2 <- choices_labeled(ADTTE$PARAMCD, ADTTE$PARAM) +#' #' # if only a subset of variables are needed, use subset argument #' choices3 <- choices_labeled( #' names(ADSL), #' teal.data::col_labels(ADSL, fill = FALSE), #' subset = c("ARMCD", "ARM") #' ) -#' \dontrun{ -#' shinyApp( -#' ui = fluidPage( -#' selectInput("c1", -#' label = "Choices from ADSL", -#' choices = choices1, -#' selected = choices1[1] -#' ), -#' selectInput("c2", -#' label = "Choices from ADTTE", -#' choices = choices2, -#' selected = choices2[1] -#' ), -#' selectInput("c3", -#' label = "Arm choices from ADSL", -#' choices = choices3, -#' selected = choices3[1] -#' ) +#' +#' ui <- fluidPage( +#' selectInput("c1", +#' label = "Choices from ADSL", +#' choices = choices1, +#' selected = choices1[1] #' ), -#' server = function(input, output) {} +#' selectInput("c2", +#' label = "Choices from ADTTE", +#' choices = choices2, +#' selected = choices2[1] +#' ), +#' selectInput("c3", +#' label = "Arm choices from ADSL", +#' choices = choices3, +#' selected = choices3[1] +#' ) #' ) +#' +#' if (interactive()) { +#' shinyApp(ui = ui, server = function(input, output) {}) #' } choices_labeled <- function(choices, labels, subset = NULL, types = NULL) { if (is.factor(choices)) { diff --git a/R/choices_selected.R b/R/choices_selected.R index 5c182015..d90e25f7 100644 --- a/R/choices_selected.R +++ b/R/choices_selected.R @@ -115,8 +115,8 @@ no_select_keyword <- "-- no selection --" #' selected = cs$selected #' ) #' ) -#' \dontrun{ -#' shinyApp(ui, server = function(input, output, session) {}) +#' if (interactive()) { +#' shinyApp(ui, server = function(input, output, session) {}) #' } choices_selected <- function(choices, selected = if (inherits(choices, "delayed_data")) NULL else choices[1], diff --git a/R/merge_datasets.R b/R/merge_datasets.R index 9b84181a..d987ca5a 100644 --- a/R/merge_datasets.R +++ b/R/merge_datasets.R @@ -6,6 +6,25 @@ #' #' @details Internally this function uses calls to allow reproducibility. #' +#' This function is often used inside a `teal` module server function with the +#' `selectors` being the output of `data_extract_srv` or `data_extract_multiple_srv`. +#' +#' ``` +#' # inside teal module server function +#' +#' response <- data_extract_srv( +#' id = "reponse", +#' data_extract_spec = response_spec, +#' datasets = datasets +#' ) +#' regressor <- data_extract_srv( +#' id = "regressor", +#' data_extract_spec = regressor_spec, +#' datasets = datasets +#' ) +#' merged_data <- merge_datasets(list(regressor(), response())) +#' ``` +#' #' @inheritParams merge_expression_srv #' @return merged_dataset (`list`) containing: #' - `expr` (`list` of `call`) code needed to replicate merged dataset. @@ -24,20 +43,43 @@ #' @export #' #' @examples -#' \dontrun{ -#' # inside teal module server function -#' response <- data_extract_srv( -#' id = "reponse", -#' data_extract_spec = response_spec, -#' datasets = datasets +#' library(shiny) +#' +#' X <- data.frame(A = c(1, 1:3), B = 2:5, D = 1:4, E = letters[1:4], G = letters[6:9]) +#' Y <- data.frame(A = c(1, 1, 2), B = 2:4, C = c(4, 4:5), E = letters[4:6], G = letters[1:3]) +#' join_keys <- teal.data::join_keys(teal.data::join_key("X", "Y", c("A", "B"))) +#' +#' selector_list <- list( +#' list( +#' dataname = "X", +#' filters = NULL, +#' select = "E", +#' keys = c("A", "B"), +#' reshape = FALSE, +#' internal_id = "x" +#' ), +#' list( +#' dataname = "Y", +#' filters = NULL, +#' select = "G", +#' keys = c("A", "C"), +#' reshape = FALSE, +#' internal_id = "y" +#' ) #' ) -#' regressor <- data_extract_srv( -#' id = "regressor", -#' data_extract_spec = regressor_spec, -#' datasets = datasets +#' +#' data_list <- list(X = reactive(X), Y = reactive(Y)) +#' +#' merged_datasets <- isolate( +#' merge_datasets( +#' selector_list = selector_list, +#' datasets = data_list, +#' join_keys = join_keys +#' ) #' ) -#' merged_data <- merge_datasets(list(regressor(), response())) -#' } +#' +#' paste(merged_datasets$expr) +#' merge_datasets <- function(selector_list, datasets, join_keys, merge_function = "dplyr::full_join", anl_name = "ANL") { logger::log_trace( paste( diff --git a/R/merge_expression_module.R b/R/merge_expression_module.R index 6696671d..7c0a9250 100644 --- a/R/merge_expression_module.R +++ b/R/merge_expression_module.R @@ -129,8 +129,8 @@ #' output$data <- renderDataTable(code_merge()[["ANL"]]) #' } #' ) -#' \dontrun{ -#' shinyApp(app$ui, app$server) +#' if (interactive()) { +#' shinyApp(app$ui, app$server) #' } #' @export merge_expression_module <- function(datasets, @@ -331,8 +331,8 @@ merge_expression_module.list <- function(datasets, #' output$data <- renderDataTable(code_merge()[["ANL"]]) #' } #' ) -#' \dontrun{ -#' shinyApp(app$ui, app$server) +#' if (interactive()) { +#' shinyApp(app$ui, app$server) #' } merge_expression_srv <- function(id = "merge_id", selector_list, diff --git a/R/resolve.R b/R/resolve.R index a02dad34..24d4f292 100644 --- a/R/resolve.R +++ b/R/resolve.R @@ -184,7 +184,9 @@ resolve.default <- function(x, datasets, keys) { #' @return Character vector - result of calling function `x` on dataset `ds`. #' #' @examples -#' \dontrun{ +#' # use non-exported function from teal.transform +#' resolve_delayed_expr <- getFromNamespace("resolve_delayed_expr", "teal.transform") +#' #' # get only possible factor variables from mtcars dataset #' resolve_delayed_expr( #' function(data) { @@ -194,7 +196,6 @@ resolve.default <- function(x, datasets, keys) { #' ds = mtcars, #' is_value_choices = FALSE #' ) -#' } #' @keywords internal #' resolve_delayed_expr <- function(x, ds, is_value_choices) { diff --git a/man/call_with_colon.Rd b/man/call_with_colon.Rd index adcbe612..a617166d 100644 --- a/man/call_with_colon.Rd +++ b/man/call_with_colon.Rd @@ -28,7 +28,6 @@ print_call_and_eval( call_with_colon("glue::glue", "x = {x}", x = 10) ) -\dontrun{ # mtcars$cyl evaluated print_call_and_eval( call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6) @@ -55,5 +54,4 @@ print_call_and_eval( call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2)) ) } -} \keyword{internal} diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd index 9e41b98e..6e592626 100644 --- a/man/choices_labeled.Rd +++ b/man/choices_labeled.Rd @@ -45,34 +45,36 @@ library(shiny) ADSL <- teal.transform::rADSL ADTTE <- teal.transform::rADTTE + choices1 <- choices_labeled(names(ADSL), teal.data::col_labels(ADSL, fill = FALSE)) choices2 <- choices_labeled(ADTTE$PARAMCD, ADTTE$PARAM) + # if only a subset of variables are needed, use subset argument choices3 <- choices_labeled( names(ADSL), teal.data::col_labels(ADSL, fill = FALSE), subset = c("ARMCD", "ARM") ) -\dontrun{ -shinyApp( - ui = fluidPage( - selectInput("c1", - label = "Choices from ADSL", - choices = choices1, - selected = choices1[1] - ), - selectInput("c2", - label = "Choices from ADTTE", - choices = choices2, - selected = choices2[1] - ), - selectInput("c3", - label = "Arm choices from ADSL", - choices = choices3, - selected = choices3[1] - ) + +ui <- fluidPage( + selectInput("c1", + label = "Choices from ADSL", + choices = choices1, + selected = choices1[1] ), - server = function(input, output) {} + selectInput("c2", + label = "Choices from ADTTE", + choices = choices2, + selected = choices2[1] + ), + selectInput("c3", + label = "Arm choices from ADSL", + choices = choices3, + selected = choices3[1] + ) ) + +if (interactive()) { + shinyApp(ui = ui, server = function(input, output) {}) } } diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd index a1ee8209..c57a76b8 100644 --- a/man/choices_selected.Rd +++ b/man/choices_selected.Rd @@ -134,7 +134,7 @@ ui <- fluidPage( selected = cs$selected ) ) -\dontrun{ -shinyApp(ui, server = function(input, output, session) {}) +if (interactive()) { + shinyApp(ui, server = function(input, output, session) {}) } } diff --git a/man/merge_datasets.Rd b/man/merge_datasets.Rd index 9b9ca000..70c8bf4c 100644 --- a/man/merge_datasets.Rd +++ b/man/merge_datasets.Rd @@ -59,10 +59,12 @@ It combines/merges multiple datasets with specified keys attribute. } \details{ Internally this function uses calls to allow reproducibility. -} -\examples{ -\dontrun{ -# inside teal module server function + +This function is often used inside a \code{teal} module server function with the +\code{selectors} being the output of \code{data_extract_srv} or \code{data_extract_multiple_srv}. + +\if{html}{\out{
}}\preformatted{# inside teal module server function + response <- data_extract_srv( id = "reponse", data_extract_spec = response_spec, @@ -74,5 +76,44 @@ regressor <- data_extract_srv( datasets = datasets ) merged_data <- merge_datasets(list(regressor(), response())) +}\if{html}{\out{
}} } +\examples{ +library(shiny) + +X <- data.frame(A = c(1, 1:3), B = 2:5, D = 1:4, E = letters[1:4], G = letters[6:9]) +Y <- data.frame(A = c(1, 1, 2), B = 2:4, C = c(4, 4:5), E = letters[4:6], G = letters[1:3]) +join_keys <- teal.data::join_keys(teal.data::join_key("X", "Y", c("A", "B"))) + +selector_list <- list( + list( + dataname = "X", + filters = NULL, + select = "E", + keys = c("A", "B"), + reshape = FALSE, + internal_id = "x" + ), + list( + dataname = "Y", + filters = NULL, + select = "G", + keys = c("A", "C"), + reshape = FALSE, + internal_id = "y" + ) +) + +data_list <- list(X = reactive(X), Y = reactive(Y)) + +merged_datasets <- isolate( + merge_datasets( + selector_list = selector_list, + datasets = data_list, + join_keys = join_keys + ) +) + +paste(merged_datasets$expr) + } diff --git a/man/merge_expression_module.Rd b/man/merge_expression_module.Rd index e46090b7..34c13e90 100644 --- a/man/merge_expression_module.Rd +++ b/man/merge_expression_module.Rd @@ -171,8 +171,8 @@ app <- shinyApp( output$data <- renderDataTable(code_merge()[["ANL"]]) } ) -\dontrun{ -shinyApp(app$ui, app$server) +if (interactive()) { + shinyApp(app$ui, app$server) } } \seealso{ diff --git a/man/merge_expression_srv.Rd b/man/merge_expression_srv.Rd index 58235caa..2b689383 100644 --- a/man/merge_expression_srv.Rd +++ b/man/merge_expression_srv.Rd @@ -180,8 +180,8 @@ app <- shinyApp( output$data <- renderDataTable(code_merge()[["ANL"]]) } ) -\dontrun{ -shinyApp(app$ui, app$server) +if (interactive()) { + shinyApp(app$ui, app$server) } } \seealso{ diff --git a/man/resolve_delayed_expr.Rd b/man/resolve_delayed_expr.Rd index 45b36a90..bcac61dc 100644 --- a/man/resolve_delayed_expr.Rd +++ b/man/resolve_delayed_expr.Rd @@ -21,7 +21,9 @@ Character vector - result of calling function \code{x} on dataset \code{ds}. Resolve expression after delayed data are loaded } \examples{ -\dontrun{ +# use non-exported function from teal.transform +resolve_delayed_expr <- getFromNamespace("resolve_delayed_expr", "teal.transform") + # get only possible factor variables from mtcars dataset resolve_delayed_expr( function(data) { @@ -32,5 +34,4 @@ resolve_delayed_expr( is_value_choices = FALSE ) } -} \keyword{internal} From c5e475e2c89849e80a11d07e0436448358f9bbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:45:46 +0100 Subject: [PATCH 18/62] no old Rd tags - partial --- R/call_utils.R | 153 +++++++++++++------------- R/choices_selected.R | 30 ++--- R/column_functions.R | 8 +- R/data_extract_datanames.R | 24 ++-- R/filter_spec.R | 110 +++++++++--------- man/call_condition_choice.Rd | 24 ++-- man/call_condition_logical.Rd | 8 +- man/call_condition_range.Rd | 8 +- man/call_condition_range_date.Rd | 4 +- man/call_condition_range_posixct.Rd | 11 +- man/call_extract_array.Rd | 12 +- man/call_extract_list.Rd | 4 +- man/call_extract_matrix.Rd | 10 +- man/calls_combine_by.Rd | 8 +- man/choices_selected.Rd | 15 ++- man/datanames_input.Rd | 1 + man/filter_spec.Rd | 23 ++-- man/filter_spec_internal.Rd | 39 ++++--- man/get_dataset_prefixed_col_names.Rd | 4 +- man/get_extract_datanames.Rd | 8 +- man/no_selected_as_NULL.Rd | 5 +- 21 files changed, 259 insertions(+), 250 deletions(-) diff --git a/R/call_utils.R b/R/call_utils.R index 27861049..2583a864 100644 --- a/R/call_utils.R +++ b/R/call_utils.R @@ -31,23 +31,24 @@ call_check_parse_varname <- function(varname) { #' #' Compose choices condition call from inputs. #' -#' @param varname (`name`, `call` or `character(1)`)\cr -#' name of the variable +#' @param varname (`name`, `call` or `character(1)`) +#' name of the variable +#' @param choices (`vector`) +#' `varname` values to match using the `==` (single value) or `%in%` (vector) +#' condition. +#' `choices` can be vector of any type but for some output might be converted: +#' * `factor` call is composed on choices converted to `character` +#' * `Date` call is composed on choices converted to `character` using +#' `format(choices)` +#' * `POSIXct`, `POSIXlt` Call is composed on choices converted to `character` using +#' `format(choices)`. +#' +#' One has to be careful here as formatted date-time variable might loose +#' some precision (see `format` argument in [format.POSIXlt()] and output call +#' could be insufficient for exact comparison. In this case one should specify +#' `varname = trunc()` and possibly convert `choices` to `character`) #' -#' @param choices (`vector`)\cr -#' `varname` values to match using the `==` (single value) or -#' `%in%` (vector) condition. `choices` can be vector of any type -#' but for some output might be converted: -#' \itemize{ -#' \item{`factor`}{ call is composed on choices converted to `character`} -#' \item{`Date`}{ call is composed on choices converted to `character` using `format(choices)`} -#' \item{`POSIXct`, `POSIXlt`}{ Call is composed on choices converted to `character` using -#' `format(choices)`. One has to be careful here as formatted date-time variable might loose -#' some precision (see `format` argument in \code{\link{format.POSIXlt}}) and output call -#' could be insufficient for exact comparison. In this case one should specify -#' `varname = trunc()` and possibly convert `choices` to `character`) -#' } -#' } +#' @return a `call` #' #' @examples #' # use non-exported function from teal.transform @@ -59,7 +60,6 @@ call_check_parse_varname <- function(varname) { #' call_condition_choice("SEX", choices = factor(c("F", "M"))) #' call_condition_choice("x$SEX", choices = Sys.Date()) #' call_condition_choice("trunc(x$SEX)", choices = Sys.time()) -#' @return a `call` #' @keywords internal #' call_condition_choice <- function(varname, choices) { @@ -92,13 +92,16 @@ call_condition_choice <- function(varname, choices) { #' #' Compose `numeric` range condition call from inputs #' -#' @param varname (`name` or `character(1)`)\cr -#' name of the variable +#' @param varname (`name` or `character(1)`) #' -#' @param range (`numeric(2)`)\cr -#' range of the variable +#' name of the variable +#' +#' @param range (`numeric(2)`) +#' +#' range of the variable +#' +#' @return a `call` #' -#' @return call #' @examples #' # use non-exported function from teal.transform #' call_condition_range <- getFromNamespace("call_condition_range", "teal.transform") @@ -110,7 +113,6 @@ call_condition_choice <- function(varname, choices) { #' call_extract_list("ADSL", "AGE"), #' range = c(-1.2, 2.1) #' ) -#' @return a `call` #' @keywords internal #' call_condition_range <- function(varname, range) { @@ -128,20 +130,22 @@ call_condition_range <- function(varname, range) { #' #' Compose `logical` variable condition call from inputs #' -#' @param varname (`name` or `character(1)`)\cr -#' name of the variable +#' @param varname (`name` or `character(1)`) +#' +#' name of the variable #' -#' @param choice (`logical(1)`)\cr -#' chosen value +#' @param choice (`logical(1)`) +#' +#' chosen value +#' +#' @return a `call` #' -#' @return call #' @examples #' # use non-exported function from teal.transform #' call_condition_logical <- getFromNamespace("call_condition_logical", "teal.transform") #' #' call_condition_logical("event", choice = TRUE) #' call_condition_logical("event", choice = FALSE) -#' @return a `call` #' @keywords internal #' call_condition_logical <- function(varname, choice) { @@ -165,17 +169,16 @@ call_condition_logical <- function(varname, choice) { #' #' Compose `POSIXct` range condition call from inputs. #' -#' @param varname (`name` or `character(1)`)\cr -#' name of the variable +#' @param varname (`name` or `character(1)`) +#' name of the variable #' -#' @param range (`POSIXct`)\cr -#' range of the variable. Be aware that output -#' uses truncated range format `"%Y-%m-%d %H:%M:%S"`, which means that -#' some precision might be lost. +#' @param range (`POSIXct`) +#' range of the variable. Be aware that output uses truncated range format +#' `"%Y-%m-%d %H:%M:%S"`, which means that some precision might be lost. #' -#' @param timezone (`character(1)`)\cr -#' specifies the time zone to be used for the conversion. -#' By default `Sys.timezone()` is used. +#' @param timezone (`character(1)`) +#' specifies the time zone to be used for the conversion. +#' By default `Sys.timezone()` is used. #' #' @examples #' # use non-exported function from teal.transform @@ -216,11 +219,13 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone #' #' Compose `Date` range condition call from inputs #' -#' @param varname (`name` or `character(1)`)\cr -#' name of the variable +#' @param varname (`name` or `character(1)`) +#' name of the variable #' -#' @param range (`Date`)\cr -#' range of the variable +#' @param range (`Date`) +#' range of the variable +#' +#' @return a `call` #' #' @examples #' # use non-exported function from teal.transform @@ -230,7 +235,6 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone #' as.name("date"), #' range = c(Sys.Date(), Sys.Date() + 1) #' ) -#' @return a `call` #' @keywords internal #' call_condition_range_date <- function(varname, range) { @@ -247,15 +251,16 @@ call_condition_range_date <- function(varname, range) { #' Get call to subset and select array #' -#' Get call to subset and select array -#' @param dataname (`character(1)` or `name`)\cr -#' @param row (`name`, `call`, `logical`, `integer`, `character`)\cr -#' optional, name of the `row` or condition -#' @param column (`name`, `call`, `logical`, `integer`, `character`)\cr -#' optional, name of the `column` or condition -#' @param aisle (`name`, `call`, `logical`, `integer`, `character`)\cr -#' optional, name of the `row` or condition -#' @return `[` call with all conditions included +#' @param dataname (`character(1)` or `name`) +#' @param row (`name`, `call`, `logical`, `integer`, `character`) +#' optional, name of the `row` or condition +#' @param column (`name`, `call`, `logical`, `integer`, `character`) +#' optional, name of the `column` or condition +#' @param aisle (`name`, `call`, `logical`, `integer`, `character`) +#' optional, name of the `row` or condition +#' +#' @return specific [Extract()] `call` for 3-dimensional array +#' #' @examples #' # use non-exported function from teal.transform #' call_extract_array <- getFromNamespace("call_extract_array", "teal.transform") @@ -271,7 +276,6 @@ call_condition_range_date <- function(varname, range) { #' "mae_object", #' column = call_condition_choice("SEX", "M") #' ) -#' @return specific \code{\link[base]{Extract}} `call` for 3-dimensional array #' @keywords internal #' call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle = NULL) { @@ -312,13 +316,14 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle #' Get call to subset and select matrix #' -#' Get call to subset and select matrix -#' @param dataname (`character(1)` or `name`)\cr -#' @param row (`name`, `call`, `logical`, `integer`, `character`)\cr -#' optional, name of the `row` or condition -#' @param column (`name`, `call`, `logical`, `integer`, `character`)\cr -#' optional, name of the `column` or condition -#' @return `[` call with all conditions included +#' @param dataname (`character(1)` or `name`) +#' @param row (`name`, `call`, `logical`, `integer`, `character`) +#' optional, name of the `row` or condition +#' @param column (`name`, `call`, `logical`, `integer`, `character`) +#' optional, name of the `column` or condition +#' +#' @return specific [Extract()] `call` for matrix +#' #' @examples #' # use non-exported function from teal.transform #' call_extract_matrix <- getFromNamespace("call_extract_matrix", "teal.transform") @@ -333,7 +338,6 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle #' "mae_object", #' column = call_condition_choice("SEX", "M") #' ) -#' @return specific \code{\link[base]{Extract}} `call` for matrix #' @keywords internal #' call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { @@ -369,18 +373,15 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { #' Compose extract call with `$` operator #' -#' Compose extract call with `$` operator -#' -#' @param dataname (`character(1)` or `name`)\cr -#' name of the object -#' -#' @param varname (`character(1)` or `name`)\cr -#' name of the slot in data -#' +#' @param dataname (`character(1)` or `name`) +#' name of the object +#' @param varname (`character(1)` or `name`) +#' name of the slot in data #' @param dollar (`logical(1)`)\cr -#' whether returned call should use `$` or `[[` operator +#' whether returned call should use `$` or `[[` operator #' #' @return `$` or `[[` call +#' #' @examples #' # use non-exported function from teal.transform #' call_extract_list <- getFromNamespace("call_extract_list", "teal.transform") @@ -474,13 +475,14 @@ call_with_colon <- function(name, ..., unlist_args = list()) { #' #' Combine list of calls by specific operator #' -#' @param operator (`character(1)` or `name`)\cr -#' name/symbol of the operator. +#' @param operator (`character(1)` or `name`) +#' name / symbol of the operator. +#' +#' @param calls (`list` of calls) +#' list containing calls to be combined by `operator` #' -#' @param calls (`list` of calls)\cr -#' list containing calls to be combined by `operator` +#' @return a combined `call` #' -#' @return call #' @examples #' # use non-exported function from teal.transform #' calls_combine_by <- getFromNamespace("calls_combine_by", "teal.transform") @@ -496,7 +498,6 @@ call_with_colon <- function(name, ..., unlist_args = list()) { #' TRUE #' ) #' ) -#' @return a combined `call` #' @keywords internal #' calls_combine_by <- function(operator, calls) { diff --git a/R/choices_selected.R b/R/choices_selected.R index d90e25f7..08b062ca 100644 --- a/R/choices_selected.R +++ b/R/choices_selected.R @@ -8,16 +8,19 @@ no_select_keyword <- "-- no selection --" #' or whether to block the user from making selections. Can be used in `ui` input elements #' such as [teal.widgets::optionalSelectInput()] #' -#' @param choices (`character`) vector of possible choices or `delayed_data` object\cr -#' See [variable_choices()] and [value_choices()]. +#' @param choices (`character`) vector of possible choices or `delayed_data` object +#' +#' See [variable_choices()] and [value_choices()]. #' @param selected (`character`) vector of preselected options, (`all_choices`) object -#' or (`delayed_data`) object. If `delayed_data` object then `choices` must also be -#' a `delayed_data` object. If not supplied it will default to the first element of -#' `choices` if `choices` is a vector, or `NULL` if `choices` is a `delayed_data` object. -#' @param keep_order (`logical`)\cr -#' In case of `FALSE` the selected variables will be on top of the drop-down field. -#' @param fixed optional, (`logical`)\cr -#' Whether to block user to select choices +#' or (`delayed_data`) object. +#' +#' If `delayed_data` object then `choices` must also be `delayed_data` object. +#' If not supplied it will default to the first element of `choices` if +#' `choices` is a vector, or `NULL` if `choices` is a `delayed_data` object. +#' @param keep_order (`logical`) +#' In case of `FALSE` the selected variables will be on top of the drop-down field. +#' @param fixed optional, (`logical`) +#' Whether to block user to select choices #' #' @details #' @@ -183,8 +186,8 @@ is.choices_selected <- function(x) { # nolint #' #' @description `r lifecycle::badge("stable")` #' -#' @param x (\code{choices_selected}) output -#' @param multiple (\code{logical}) whether multiple selections are allowed or not +#' @param x (`choices_selected`) output +#' @param multiple (`logical`) whether multiple selections are allowed or not #' #' @export add_no_selected_choices <- function(x, multiple = FALSE) { @@ -206,10 +209,9 @@ add_no_selected_choices <- function(x, multiple = FALSE) { #' #' @description `r lifecycle::badge("stable")` #' -#' @param x (\code{character}) Word that shall be checked for -#' NULL, empty, "--no-selection" +#' @param x (`character`) Word that shall be checked for `NULL`, empty, "--no-selection" #' -#' @return the word or NULL +#' @return the word or `NULL` #' #' @export no_selected_as_NULL <- function(x) { # nolint diff --git a/R/column_functions.R b/R/column_functions.R index 146bb1f2..171c4e2f 100644 --- a/R/column_functions.R +++ b/R/column_functions.R @@ -3,12 +3,12 @@ #' @description `r lifecycle::badge("stable")` #' @export #' -#' @param data (\code{data.frame}) Data with attribute \code{filter_and_columns}. This can only be -#' created by \code{\link{data_extract_srv}}. which returns a shiny \code{\link[shiny]{reactive}}. +#' @param data (`data.frame`) Data with attribute `filter_and_columns`. This can only be +#' created by [data_extract_srv()]. which returns a shiny [shiny::reactive()]. #' -#' @return A named character vector with the non-key columns of the \code{data}.. +#' @return A named character vector with the non-key columns of the `data`. #' -#' @references \link{data_extract_srv} +#' @references [data_extract_srv] get_dataset_prefixed_col_names <- function(data) { if (!is.null(attr(data, "filter_and_columns")$columns) && attr(data, "filter_and_columns")$columns != "") { paste(attr(data, "dataname"), attr(data, "filter_and_columns")$columns, sep = ".") diff --git a/R/data_extract_datanames.R b/R/data_extract_datanames.R index 0d2d156b..c5394950 100644 --- a/R/data_extract_datanames.R +++ b/R/data_extract_datanames.R @@ -1,9 +1,13 @@ #' Available datasets input #' -#' @description `r lifecycle::badge("stable")` +#' @description +#' `r lifecycle::badge("stable")` +#' #' Creates \link[shiny]{helpText} with the names of datasets #' available for current module. +#' #' @param data_extracts list of data extracts for single variable +#' #' @export datanames_input <- function(data_extracts) { datanames <- get_extract_datanames(data_extracts) @@ -15,11 +19,14 @@ datanames_input <- function(data_extracts) { #' Gets names of the datasets from a list of `data_extract_spec` objects #' -#' @description `r lifecycle::badge("stable")` -#' Fetches `dataname` slot per \code{data_extract_spec} from a list of \code{data_extract_spec} -#' and returns the unique `dataname` set. +#' @description +#' `r lifecycle::badge("stable")` +#' +#' Fetches `dataname` slot per `data_extract_spec` from a list of +#' `data_extract_spec` and returns the unique `dataname` set. #' -#' @param data_extracts A single \code{data_extract_spec} object or a list (of lists) of \code{data_extract_spec} +#' @param data_extracts A single `data_extract_spec` object or a list (of lists) +#' of `data_extract_spec` #' #' @export get_extract_datanames <- function(data_extracts) { @@ -53,10 +60,13 @@ get_extract_datanames <- function(data_extracts) { #' Checks if the input `data_extract_spec` objects all come from the same dataset #' -#' @description `r lifecycle::badge("stable")` -#' @param ... either \code{data_extract_spec} objects or lists of \code{data_extract_spec} objects that do not contain +#' `r lifecycle::badge("stable")` +#' +#' @param ... either `data_extract_spec` objects or lists of `data_extract_spec` objects that do not contain #' NULL +#' #' @return logical +#' #' @export is_single_dataset <- function(...) { data_extract_spec <- list(...) diff --git a/R/filter_spec.R b/R/filter_spec.R index 8225ca99..42059b2c 100644 --- a/R/filter_spec.R +++ b/R/filter_spec.R @@ -3,56 +3,52 @@ #' @description `r lifecycle::badge("stable")` #' It consists in choices and additionally the variable names for the choices #' -#' @export -#' #' @inheritParams select_spec +#' @param vars (`character`) or (`delayed_data`) object. +#' Character vector giving the columns to be filtered. These should be +#' key variables of the data set to be filtered. +#' `delayed_data` objects can be created via [variable_choices()], [value_choices()], +#' or [choices_selected()]. +#' @param sep (`character`) A separator string to split the `choices` or +#' `selected` inputs into the values of the different columns +#' @param choices (`character` or `numeric` or `logical` or (`delayed_data`) object. +#' Named character vector to define the choices +#' of a shiny [shiny::selectInput()]. These choices will be used to filter the +#' dataset. #' -#' @param vars (\code{character}) or (\code{delayed_data}) object. -#' Character vector giving the columns to be filtered. These should be -#' key variables of the data set to be filtered. -#' \code{delayed_data} objects can be created via [variable_choices()], [value_choices()], -#' or \code{\link{choices_selected}}. -#' @param sep (\code{character}) A separator string to split the \code{choices} or -#' \code{selected} inputs into the values of the different columns -#' @param choices (\code{character} or \code{numeric} or \code{logical} or (\code{delayed_data}) object. -#' Named character vector to define the choices -#' of a shiny \code{\link[shiny]{selectInput}}. These choices will be used to filter the -#' dataset. -#' -#' These shall be filter values of the \code{vars} input separated by the separator(\code{sep}). Please -#' watch out that the filter values have to follow the order of the \code{vars} input. In the following -#' example we will show how to filter two columns: +#' These shall be filter values of the `vars` input separated by the separator(`sep`). Please +#' watch out that the filter values have to follow the order of the `vars` input. In the following +#' example we will show how to filter two columns: #' -#' \code{vars = c("PARAMCD","AVISIT")} and \code{choices = c("CRP - BASELINE", "ALT - BASELINE")} -#' will lead to a filtering of -#' \code{(PARAMCD == "CRP" & AVISIT == "BASELINE") | (PARAMCD == "ALT" & AVISIT == "BASELINE")}. +#' `vars = c("PARAMCD","AVISIT")` and `choices = c("CRP - BASELINE", "ALT - BASELINE")` +#' will lead to a filtering of +#' `(PARAMCD == "CRP" & AVISIT == "BASELINE") | (PARAMCD == "ALT" & AVISIT == "BASELINE")`. #' -#' The \code{sep} input has to be \code{" - "} in this case. +#' The `sep` input has to be `" - "` in this case. #' -#' \code{delayed_data} objects can be created via \code{\link{variable_choices}} or \code{\link{value_choices}}. +#' `delayed_data` objects can be created via [variable_choices()] or [value_choices()]. #' -#' @param selected (\code{character} or \code{numeric} or \code{logical} or -#' (\code{delayed_data} or (\code{all_choices})) object. -#' Named character vector to define the selected -#' values of a shiny \code{\link[shiny]{selectInput}} (default values). This value will -#' be displayed inside the shiny app upon start. The `all_choices` object indicates selecting -#' all possible choices. +#' @param selected (`character` or `numeric` or `logical` or (`delayed_data` or `all_choices`) object. +#' Named character vector to define the selected values of a shiny [shiny::selectInput()] +#' (default values). +#' This value will be displayed inside the shiny app upon start. The `all_choices` +#' object indicates selecting all possible choices. #' -#' @param drop_keys optional, (\code{logical}) whether to drop filter column from the dataset keys, -#' \code{TRUE} on default. +#' @param drop_keys optional, (`logical`) +#' whether to drop filter column from the dataset keys, `TRUE` on default. #' -#' @param label optional (\code{character}). Define a label on top of this specific -#' shiny \code{\link[shiny]{selectInput}}. The default value is \code{"Filter by"}. +#' @param label optional (`character`). Define a label on top of this specific +#' shiny [shiny::selectInput()]. The default value is `"Filter by"`. #' -#' @return \code{filter_spec}-S3-class object or \code{delayed_filter_spec}-S3-class object. +#' @return `filter_spec`-S3-class object or `delayed_filter_spec`-S3-class object. #' #' @details #' -#' The \code{filter_spec} is used inside `teal` apps to allow filtering datasets +#' The `filter_spec` is used inside `teal` apps to allow filtering datasets #' for their key variables. Imagine having an adverse events table. It has -#' the columns \code{PARAMCD} and \code{CNSR}. \code{PARAMCD} contains the levels -#' \code{"OS"}, \code{"PFS"}, \code{"EFS"}. \code{CNSR} contains the levels \code{"0"} and \code{"1"}. -#' The first example should show how a \code{filter_spec} setup will influence +#' the columns `PARAMCD` and `CNSR`. `PARAMCD` contains the levels +#' `"OS"`, `"PFS"`, `"EFS"`. `CNSR` contains the levels `"0"` and `"1"`. +#' The first example should show how a `filter_spec` setup will influence #' the drop-down menu the app user will see. #' #' @@ -113,6 +109,8 @@ #' choices = value_choices("ADSL", "SEX"), #' selected = all_choices() #' ) +#' @export +#' filter_spec <- function(vars, choices = NULL, selected = `if`(inherits(choices, "delayed_data"), NULL, choices[1]), @@ -186,29 +184,29 @@ filter_spec <- function(vars, #' Data extract dynamic filter specification #' -#' This function returns a configuration for the \code{data_extract_ui} module. This function covers +#' This function returns a configuration for the `data_extract_ui` module. This function covers #' the configuration of filtering datasets (so called `filter_spec`), which then is used to build #' the UI element in the `teal` app. #' #' @inheritParams filter_spec -#' @param vars_choices (`character` or `delayed_data`) \cr -#' the vector of dataset column names available to build dynamic filter -#' \code{delayed_data} objects can be created via \code{\link{variable_choices}}. -#' @param vars_selected (`NULL` or named `character`) \cr -#' the selected column name out from `choices`. -#' @param vars_label (`character`)\cr -#' the title printed on the UI element generated on the basis of this \code{filter_spec}. -#' @param vars_fixed (`logical`)\cr -#' if true allow to change the selected variables in the UI element; otherwise, do not allow. -#' @param vars_multiple (`logical`)\cr -#' if true allow to select multiple variables in the UI elements; otherwise, do not allow. -#' @param fixed (`logical`)\cr -#' if true allow to change the initially selected values of the variables; otherwise, do not allow. -#' @param dataname (`character`)\cr -#' the name of the dataset this filter covers. Set during the initialization of the `teal` application. -#' @param initialized (`logical`)\cr -#' indicates whether this filter was already initialized in the application. -#' TRUE if this filter was already consumed by the server function; FALSE otherwise. +#' @param vars_choices (`character` or `delayed_data`) +#' the vector of dataset column names available to build dynamic filter +#' `delayed_data` objects can be created via [variable_choices()]. +#' @param vars_selected (`NULL` or named `character`) +#' the selected column name out from `choices`. +#' @param vars_label (`character`) +#' the title printed on the UI element generated on the basis of this `filter_spec`. +#' @param vars_fixed (`logical`) +#' if true allow to change the selected variables in the UI element; otherwise, do not allow. +#' @param vars_multiple (`logical`) +#' if true allow to select multiple variables in the UI elements; otherwise, do not allow. +#' @param fixed (`logical`) +#' if true allow to change the initially selected values of the variables; otherwise, do not allow. +#' @param dataname (`character`) +#' the name of the dataset this filter covers. Set during the initialization of the `teal` application. +#' @param initialized (`logical`) +#' indicates whether this filter was already initialized in the application. +#' TRUE if this filter was already consumed by the server function; FALSE otherwise. #' #' @return `filter_spec` or `delayed_filter_spec` S3-class object. #' diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd index a2e7095d..9336fe00 100644 --- a/man/call_condition_choice.Rd +++ b/man/call_condition_choice.Rd @@ -7,22 +7,24 @@ call_condition_choice(varname, choices) } \arguments{ -\item{varname}{(\code{name}, \code{call} or \code{character(1)})\cr +\item{varname}{(\code{name}, \code{call} or \code{character(1)}) name of the variable} -\item{choices}{(\code{vector})\cr -\code{varname} values to match using the \code{==} (single value) or -\code{\%in\%} (vector) condition. \code{choices} can be vector of any type -but for some output might be converted: +\item{choices}{(\code{vector}) +\code{varname} values to match using the \code{==} (single value) or \code{\%in\%} (vector) +condition. +\code{choices} can be vector of any type but for some output might be converted: \itemize{ -\item{\code{factor}}{ call is composed on choices converted to \code{character}} -\item{\code{Date}}{ call is composed on choices converted to \code{character} using \code{format(choices)}} -\item{\code{POSIXct}, \code{POSIXlt}}{ Call is composed on choices converted to \code{character} using -\code{format(choices)}. One has to be careful here as formatted date-time variable might loose -some precision (see \code{format} argument in \code{\link{format.POSIXlt}}) and output call +\item \code{factor} call is composed on choices converted to \code{character} +\item \code{Date} call is composed on choices converted to \code{character} using +\code{format(choices)} +\item \code{POSIXct}, \code{POSIXlt} Call is composed on choices converted to \code{character} using +\code{format(choices)}. + +One has to be careful here as formatted date-time variable might loose +some precision (see \code{format} argument in \code{\link[=format.POSIXlt]{format.POSIXlt()}} and output call could be insufficient for exact comparison. In this case one should specify \verb{varname = trunc()} and possibly convert \code{choices} to \code{character}) -} }} } \value{ diff --git a/man/call_condition_logical.Rd b/man/call_condition_logical.Rd index 63121eb9..f8f33e00 100644 --- a/man/call_condition_logical.Rd +++ b/man/call_condition_logical.Rd @@ -7,15 +7,15 @@ call_condition_logical(varname, choice) } \arguments{ -\item{varname}{(\code{name} or \code{character(1)})\cr +\item{varname}{(\code{name} or \code{character(1)}) + name of the variable} -\item{choice}{(\code{logical(1)})\cr +\item{choice}{(\code{logical(1)}) + chosen value} } \value{ -call - a \code{call} } \description{ diff --git a/man/call_condition_range.Rd b/man/call_condition_range.Rd index 864a7afc..d9da1567 100644 --- a/man/call_condition_range.Rd +++ b/man/call_condition_range.Rd @@ -7,15 +7,15 @@ call_condition_range(varname, range) } \arguments{ -\item{varname}{(\code{name} or \code{character(1)})\cr +\item{varname}{(\code{name} or \code{character(1)}) + name of the variable} -\item{range}{(\code{numeric(2)})\cr +\item{range}{(\code{numeric(2)}) + range of the variable} } \value{ -call - a \code{call} } \description{ diff --git a/man/call_condition_range_date.Rd b/man/call_condition_range_date.Rd index 1f7886be..7f264a77 100644 --- a/man/call_condition_range_date.Rd +++ b/man/call_condition_range_date.Rd @@ -7,10 +7,10 @@ call_condition_range_date(varname, range) } \arguments{ -\item{varname}{(\code{name} or \code{character(1)})\cr +\item{varname}{(\code{name} or \code{character(1)}) name of the variable} -\item{range}{(\code{Date})\cr +\item{range}{(\code{Date}) range of the variable} } \value{ diff --git a/man/call_condition_range_posixct.Rd b/man/call_condition_range_posixct.Rd index fb69a5c6..07888008 100644 --- a/man/call_condition_range_posixct.Rd +++ b/man/call_condition_range_posixct.Rd @@ -7,15 +7,14 @@ call_condition_range_posixct(varname, range, timezone = Sys.timezone()) } \arguments{ -\item{varname}{(\code{name} or \code{character(1)})\cr +\item{varname}{(\code{name} or \code{character(1)}) name of the variable} -\item{range}{(\code{POSIXct})\cr -range of the variable. Be aware that output -uses truncated range format \code{"\%Y-\%m-\%d \%H:\%M:\%S"}, which means that -some precision might be lost.} +\item{range}{(\code{POSIXct}) +range of the variable. Be aware that output uses truncated range format +\code{"\%Y-\%m-\%d \%H:\%M:\%S"}, which means that some precision might be lost.} -\item{timezone}{(\code{character(1)})\cr +\item{timezone}{(\code{character(1)}) specifies the time zone to be used for the conversion. By default \code{Sys.timezone()} is used.} } diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd index afa48387..4faabbbe 100644 --- a/man/call_extract_array.Rd +++ b/man/call_extract_array.Rd @@ -7,21 +7,19 @@ call_extract_array(dataname = ".", row = NULL, column = NULL, aisle = NULL) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name})\cr} +\item{dataname}{(\code{character(1)} or \code{name})} -\item{row}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character})\cr +\item{row}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) optional, name of the \code{row} or condition} -\item{column}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character})\cr +\item{column}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) optional, name of the \code{column} or condition} -\item{aisle}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character})\cr +\item{aisle}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) optional, name of the \code{row} or condition} } \value{ -\code{[} call with all conditions included - -specific \code{\link[base]{Extract}} \code{call} for 3-dimensional array +specific \code{\link[=Extract]{Extract()}} \code{call} for 3-dimensional array } \description{ Get call to subset and select array diff --git a/man/call_extract_list.Rd b/man/call_extract_list.Rd index db23d32f..d4438b5c 100644 --- a/man/call_extract_list.Rd +++ b/man/call_extract_list.Rd @@ -7,10 +7,10 @@ call_extract_list(dataname, varname, dollar = TRUE) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name})\cr +\item{dataname}{(\code{character(1)} or \code{name}) name of the object} -\item{varname}{(\code{character(1)} or \code{name})\cr +\item{varname}{(\code{character(1)} or \code{name}) name of the slot in data} \item{dollar}{(\code{logical(1)})\cr diff --git a/man/call_extract_matrix.Rd b/man/call_extract_matrix.Rd index b0ead71a..0fcccc6c 100644 --- a/man/call_extract_matrix.Rd +++ b/man/call_extract_matrix.Rd @@ -7,18 +7,16 @@ call_extract_matrix(dataname = ".", row = NULL, column = NULL) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name})\cr} +\item{dataname}{(\code{character(1)} or \code{name})} -\item{row}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character})\cr +\item{row}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) optional, name of the \code{row} or condition} -\item{column}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character})\cr +\item{column}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) optional, name of the \code{column} or condition} } \value{ -\code{[} call with all conditions included - -specific \code{\link[base]{Extract}} \code{call} for matrix +specific \code{\link[=Extract]{Extract()}} \code{call} for matrix } \description{ Get call to subset and select matrix diff --git a/man/calls_combine_by.Rd b/man/calls_combine_by.Rd index 47bd8705..6ecc026d 100644 --- a/man/calls_combine_by.Rd +++ b/man/calls_combine_by.Rd @@ -7,15 +7,13 @@ calls_combine_by(operator, calls) } \arguments{ -\item{operator}{(\code{character(1)} or \code{name})\cr -name/symbol of the operator.} +\item{operator}{(\code{character(1)} or \code{name}) +name / symbol of the operator.} -\item{calls}{(\code{list} of calls)\cr +\item{calls}{(\code{list} of calls) list containing calls to be combined by \code{operator}} } \value{ -call - a combined \code{call} } \description{ diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd index c57a76b8..7887d87e 100644 --- a/man/choices_selected.Rd +++ b/man/choices_selected.Rd @@ -15,18 +15,21 @@ choices_selected( is.choices_selected(x) } \arguments{ -\item{choices}{(\code{character}) vector of possible choices or \code{delayed_data} object\cr +\item{choices}{(\code{character}) vector of possible choices or \code{delayed_data} object + See \code{\link[=variable_choices]{variable_choices()}} and \code{\link[=value_choices]{value_choices()}}.} \item{selected}{(\code{character}) vector of preselected options, (\code{all_choices}) object -or (\code{delayed_data}) object. If \code{delayed_data} object then \code{choices} must also be -a \code{delayed_data} object. If not supplied it will default to the first element of -\code{choices} if \code{choices} is a vector, or \code{NULL} if \code{choices} is a \code{delayed_data} object.} +or (\code{delayed_data}) object. + +If \code{delayed_data} object then \code{choices} must also be \code{delayed_data} object. +If not supplied it will default to the first element of \code{choices} if +\code{choices} is a vector, or \code{NULL} if \code{choices} is a \code{delayed_data} object.} -\item{keep_order}{(\code{logical})\cr +\item{keep_order}{(\code{logical}) In case of \code{FALSE} the selected variables will be on top of the drop-down field.} -\item{fixed}{optional, (\code{logical})\cr +\item{fixed}{optional, (\code{logical}) Whether to block user to select choices} \item{x}{object to check} diff --git a/man/datanames_input.Rd b/man/datanames_input.Rd index fc76e79d..4cd6e069 100644 --- a/man/datanames_input.Rd +++ b/man/datanames_input.Rd @@ -11,6 +11,7 @@ datanames_input(data_extracts) } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} + Creates \link[shiny]{helpText} with the names of datasets available for current module. } diff --git a/man/filter_spec.Rd b/man/filter_spec.Rd index 7b5765b4..9ac68b44 100644 --- a/man/filter_spec.Rd +++ b/man/filter_spec.Rd @@ -19,11 +19,11 @@ filter_spec( Character vector giving the columns to be filtered. These should be key variables of the data set to be filtered. \code{delayed_data} objects can be created via \code{\link[=variable_choices]{variable_choices()}}, \code{\link[=value_choices]{value_choices()}}, -or \code{\link{choices_selected}}.} +or \code{\link[=choices_selected]{choices_selected()}}.} \item{choices}{(\code{character} or \code{numeric} or \code{logical} or (\code{delayed_data}) object. Named character vector to define the choices -of a shiny \code{\link[shiny]{selectInput}}. These choices will be used to filter the +of a shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. These choices will be used to filter the dataset. These shall be filter values of the \code{vars} input separated by the separator(\code{sep}). Please @@ -36,26 +36,25 @@ will lead to a filtering of The \code{sep} input has to be \code{" - "} in this case. -\code{delayed_data} objects can be created via \code{\link{variable_choices}} or \code{\link{value_choices}}.} +\code{delayed_data} objects can be created via \code{\link[=variable_choices]{variable_choices()}} or \code{\link[=value_choices]{value_choices()}}.} -\item{selected}{(\code{character} or \code{numeric} or \code{logical} or -(\code{delayed_data} or (\code{all_choices})) object. -Named character vector to define the selected -values of a shiny \code{\link[shiny]{selectInput}} (default values). This value will -be displayed inside the shiny app upon start. The \code{all_choices} object indicates selecting -all possible choices.} +\item{selected}{(\code{character} or \code{numeric} or \code{logical} or (\code{delayed_data} or \code{all_choices}) object. +Named character vector to define the selected values of a shiny \code{\link[shiny:selectInput]{shiny::selectInput()}} +(default values). +This value will be displayed inside the shiny app upon start. The \code{all_choices} +object indicates selecting all possible choices.} \item{multiple}{(\code{logical}) Whether multiple values shall be allowed in the shiny \code{\link[shiny]{selectInput}}.} \item{label}{optional (\code{character}). Define a label on top of this specific -shiny \code{\link[shiny]{selectInput}}. The default value is \code{"Filter by"}.} +shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. The default value is \code{"Filter by"}.} \item{sep}{(\code{character}) A separator string to split the \code{choices} or \code{selected} inputs into the values of the different columns} -\item{drop_keys}{optional, (\code{logical}) whether to drop filter column from the dataset keys, -\code{TRUE} on default.} +\item{drop_keys}{optional, (\code{logical}) +whether to drop filter column from the dataset keys, \code{TRUE} on default.} } \value{ \code{filter_spec}-S3-class object or \code{delayed_filter_spec}-S3-class object. diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd index 4224751d..d3d8a347 100644 --- a/man/filter_spec_internal.Rd +++ b/man/filter_spec_internal.Rd @@ -58,25 +58,25 @@ filter_spec_internal( ) } \arguments{ -\item{vars_choices}{(\code{character} or \code{delayed_data}) \cr +\item{vars_choices}{(\code{character} or \code{delayed_data}) the vector of dataset column names available to build dynamic filter -\code{delayed_data} objects can be created via \code{\link{variable_choices}}.} +\code{delayed_data} objects can be created via \code{\link[=variable_choices]{variable_choices()}}.} -\item{vars_selected}{(\code{NULL} or named \code{character}) \cr +\item{vars_selected}{(\code{NULL} or named \code{character}) the selected column name out from \code{choices}.} -\item{vars_label}{(\code{character})\cr +\item{vars_label}{(\code{character}) the title printed on the UI element generated on the basis of this \code{filter_spec}.} -\item{vars_fixed}{(\code{logical})\cr +\item{vars_fixed}{(\code{logical}) if true allow to change the selected variables in the UI element; otherwise, do not allow.} -\item{vars_multiple}{(\code{logical})\cr +\item{vars_multiple}{(\code{logical}) if true allow to select multiple variables in the UI elements; otherwise, do not allow.} \item{choices}{(\code{character} or \code{numeric} or \code{logical} or (\code{delayed_data}) object. Named character vector to define the choices -of a shiny \code{\link[shiny]{selectInput}}. These choices will be used to filter the +of a shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. These choices will be used to filter the dataset. These shall be filter values of the \code{vars} input separated by the separator(\code{sep}). Please @@ -89,19 +89,18 @@ will lead to a filtering of The \code{sep} input has to be \code{" - "} in this case. -\code{delayed_data} objects can be created via \code{\link{variable_choices}} or \code{\link{value_choices}}.} +\code{delayed_data} objects can be created via \code{\link[=variable_choices]{variable_choices()}} or \code{\link[=value_choices]{value_choices()}}.} -\item{selected}{(\code{character} or \code{numeric} or \code{logical} or -(\code{delayed_data} or (\code{all_choices})) object. -Named character vector to define the selected -values of a shiny \code{\link[shiny]{selectInput}} (default values). This value will -be displayed inside the shiny app upon start. The \code{all_choices} object indicates selecting -all possible choices.} +\item{selected}{(\code{character} or \code{numeric} or \code{logical} or (\code{delayed_data} or \code{all_choices}) object. +Named character vector to define the selected values of a shiny \code{\link[shiny:selectInput]{shiny::selectInput()}} +(default values). +This value will be displayed inside the shiny app upon start. The \code{all_choices} +object indicates selecting all possible choices.} \item{label}{optional (\code{character}). Define a label on top of this specific -shiny \code{\link[shiny]{selectInput}}. The default value is \code{"Filter by"}.} +shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. The default value is \code{"Filter by"}.} -\item{fixed}{(\code{logical})\cr +\item{fixed}{(\code{logical}) if true allow to change the initially selected values of the variables; otherwise, do not allow.} \item{multiple}{(\code{logical}) Whether multiple values shall be allowed in the @@ -110,13 +109,13 @@ shiny \code{\link[shiny]{selectInput}}.} \item{sep}{(\code{character}) A separator string to split the \code{choices} or \code{selected} inputs into the values of the different columns} -\item{drop_keys}{optional, (\code{logical}) whether to drop filter column from the dataset keys, -\code{TRUE} on default.} +\item{drop_keys}{optional, (\code{logical}) +whether to drop filter column from the dataset keys, \code{TRUE} on default.} -\item{dataname}{(\code{character})\cr +\item{dataname}{(\code{character}) the name of the dataset this filter covers. Set during the initialization of the \code{teal} application.} -\item{initialized}{(\code{logical})\cr +\item{initialized}{(\code{logical}) indicates whether this filter was already initialized in the application. TRUE if this filter was already consumed by the server function; FALSE otherwise.} } diff --git a/man/get_dataset_prefixed_col_names.Rd b/man/get_dataset_prefixed_col_names.Rd index 022e0b13..d22376d7 100644 --- a/man/get_dataset_prefixed_col_names.Rd +++ b/man/get_dataset_prefixed_col_names.Rd @@ -8,10 +8,10 @@ get_dataset_prefixed_col_names(data) } \arguments{ \item{data}{(\code{data.frame}) Data with attribute \code{filter_and_columns}. This can only be -created by \code{\link{data_extract_srv}}. which returns a shiny \code{\link[shiny]{reactive}}.} +created by \code{\link[=data_extract_srv]{data_extract_srv()}}. which returns a shiny \code{\link[shiny:reactive]{shiny::reactive()}}.} } \value{ -A named character vector with the non-key columns of the \code{data}.. +A named character vector with the non-key columns of the \code{data}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} diff --git a/man/get_extract_datanames.Rd b/man/get_extract_datanames.Rd index 9a9e6961..c53748cb 100644 --- a/man/get_extract_datanames.Rd +++ b/man/get_extract_datanames.Rd @@ -7,10 +7,12 @@ get_extract_datanames(data_extracts) } \arguments{ -\item{data_extracts}{A single \code{data_extract_spec} object or a list (of lists) of \code{data_extract_spec}} +\item{data_extracts}{A single \code{data_extract_spec} object or a list (of lists) +of \code{data_extract_spec}} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -Fetches \code{dataname} slot per \code{data_extract_spec} from a list of \code{data_extract_spec} -and returns the unique \code{dataname} set. + +Fetches \code{dataname} slot per \code{data_extract_spec} from a list of +\code{data_extract_spec} and returns the unique \code{dataname} set. } diff --git a/man/no_selected_as_NULL.Rd b/man/no_selected_as_NULL.Rd index e66adf21..75a714ca 100644 --- a/man/no_selected_as_NULL.Rd +++ b/man/no_selected_as_NULL.Rd @@ -7,11 +7,10 @@ no_selected_as_NULL(x) } \arguments{ -\item{x}{(\code{character}) Word that shall be checked for -NULL, empty, "--no-selection"} +\item{x}{(\code{character}) Word that shall be checked for \code{NULL}, empty, "--no-selection"} } \value{ -the word or NULL +the word or \code{NULL} } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} From b4959ac2fe0e68fc3fd72b8e1e6fd1415005ba6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:10:39 +0100 Subject: [PATCH 19/62] no old Rd tags - partial --- R/Queue.R | 4 +- R/call_utils.R | 15 +++--- R/column_functions.R | 2 +- R/data_extract_module.R | 65 +++++++++++-------------- R/data_extract_spec.R | 28 +++++------ R/get_dplyr_call.R | 41 ++++++++-------- R/get_merge_call.R | 35 ++++++------- R/merge_datasets.R | 7 ++- R/merge_expression_module.R | 62 ++++++++++++----------- R/select_spec.R | 34 ++++++------- man/Queue.Rd | 3 +- man/call_check_parse_varname.Rd | 2 +- man/call_extract_list.Rd | 9 ++-- man/check_data_merge_selectors.Rd | 8 +-- man/data_extract_multiple_srv.Rd | 2 +- man/data_extract_spec.Rd | 10 ++-- man/data_extract_srv.Rd | 22 ++++----- man/data_extract_ui.Rd | 16 +++--- man/filter_spec.Rd | 2 +- man/filter_spec_internal.Rd | 2 +- man/get_anl_relabel_call.Rd | 11 +++-- man/get_dataset_prefixed_col_names.Rd | 2 +- man/get_dplyr_call.Rd | 8 +-- man/get_dplyr_call_data.Rd | 8 +-- man/get_filter_call.Rd | 2 +- man/get_merge_call.Rd | 12 +++-- man/get_merge_key_grid.Rd | 8 +-- man/get_merge_key_i.Rd | 8 +-- man/get_merge_key_pair.Rd | 16 +++--- man/get_relabel_call.Rd | 3 +- man/get_rename_call.Rd | 8 +-- man/get_reshape_call.Rd | 8 +-- man/merge_datasets.Rd | 21 ++++---- man/merge_expression_module.Rd | 17 ++++--- man/merge_expression_srv.Rd | 26 +++++----- man/merge_selectors.Rd | 8 +-- man/parse_merge_key_i.Rd | 8 +-- man/select_spec.Rd | 16 +++--- tests/testthat/setup-skip_if_too_deep.R | 48 ++++++++++-------- 39 files changed, 319 insertions(+), 288 deletions(-) diff --git a/R/Queue.R b/R/Queue.R index 4709a267..cdd22252 100644 --- a/R/Queue.R +++ b/R/Queue.R @@ -2,7 +2,9 @@ #' @title R6 Class - A First-In-First-Out Abstract Data Type #' -#' @description `r lifecycle::badge("experimental")`\cr +#' @description +#' `r lifecycle::badge("experimental")` +#' #' Abstract data type that stores and returns any number of elements. #' #' A `Queue` object stores all elements in a single vector, diff --git a/R/call_utils.R b/R/call_utils.R index 2583a864..93408355 100644 --- a/R/call_utils.R +++ b/R/call_utils.R @@ -1,8 +1,10 @@ #' Checks `varname` argument and convert to call #' #' Checks `varname` type and parse if it's a `character` -#' @param varname (`name`, `call` or `character(1)`)\cr -#' name of the variable +#' +#' @param varname (`name`, `call` or `character(1)`) +#' name of the variable +#' #' @keywords internal #' call_check_parse_varname <- function(varname) { @@ -373,12 +375,9 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { #' Compose extract call with `$` operator #' -#' @param dataname (`character(1)` or `name`) -#' name of the object -#' @param varname (`character(1)` or `name`) -#' name of the slot in data -#' @param dollar (`logical(1)`)\cr -#' whether returned call should use `$` or `[[` operator +#' @param dataname (`character(1)` or `name`) name of the object +#' @param varname (`character(1)` or `name`) name of the slot in data +#' @param dollar (`logical(1)`) whether returned call should use `$` or `[[` operator #' #' @return `$` or `[[` call #' diff --git a/R/column_functions.R b/R/column_functions.R index 171c4e2f..2f6df03e 100644 --- a/R/column_functions.R +++ b/R/column_functions.R @@ -8,7 +8,7 @@ #' #' @return A named character vector with the non-key columns of the `data`. #' -#' @references [data_extract_srv] +#' @references [data_extract_srv()] get_dataset_prefixed_col_names <- function(data) { if (!is.null(attr(data, "filter_and_columns")$columns) && attr(data, "filter_and_columns")$columns != "") { paste(attr(data, "dataname"), attr(data, "filter_and_columns")$columns, sep = ".") diff --git a/R/data_extract_module.R b/R/data_extract_module.R index 959ad2ed..dfaf14a5 100644 --- a/R/data_extract_module.R +++ b/R/data_extract_module.R @@ -44,36 +44,31 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) { #' #' @description `r lifecycle::badge("experimental")` #' This functionality should be used in the encoding panel of your `teal` app. -#' It will allow app-developers to specify a [data_extract_spec] object. +#' It will allow app-developers to specify a [data_extract_spec()] object. #' This object should be used to `teal` module variables being filtered data #' from `CDISC` datasets. You can use this function in the same way as any -#' [shiny module](https://shiny.rstudio.com/articles/modules.html) UI. +#' [`shiny module`](https://shiny.rstudio.com/articles/modules.html) UI. #' The corresponding server module can be found in [data_extract_srv()]. #' #' @param id (`character`) shiny input unique identifier #' @param label (`character`) Label above the data extract input #' @param data_extract_spec (`list` of `data_extract_spec`) -#' This is the outcome of listing [data_extract_spec] -#' constructor calls. +#' This is the outcome of listing [data_extract_spec()] constructor calls. #' @param is_single_dataset (`logical`) FALSE to display the dataset widget #' #' @return shiny [shiny::selectInput]`s` that allow to define how to extract data from #' a specific dataset. The input elements will be returned inside a [shiny::div] container. #' #' There are three inputs that will be rendered -#' \enumerate{ -#' \item{Dataset select}{ Optional. If more than one [data_extract_spec] is handed over -#' to the function, a shiny [shiny::selectInput] will be rendered. Else just the name -#' of the dataset is given. -#' } -#' \item{Filter Panel }{Optional. If the [data_extract_spec] contains a -#' filter element a shiny [shiny::selectInput] will be rendered with the options to -#' filter the dataset. -#' } -#' \item{Select panel }{A shiny [shiny::selectInput] to select columns from the dataset to -#' go into the analysis. -#' } -#' } +#' +#' 1. Dataset select Optional. If more than one [data_extract_spec] is handed over +#' to the function, a shiny [shiny::selectInput] will be rendered. Else just the name +#' of the dataset is given. +#' 2. Filter Panel Optional. If the [data_extract_spec] contains a +#' filter element a shiny [shiny::selectInput] will be rendered with the options to +#' filter the dataset. +#' 3. Select panel A shiny [shiny::selectInput] to select columns from the dataset to +#' go into the analysis. #' #' The output can be analyzed using `data_extract_srv(...)`. #' @@ -252,32 +247,30 @@ check_data_extract_spec_react <- function(datasets, data_extract) { #' Extraction of the selector(s) details #' #' @description `r lifecycle::badge("stable")` +#' #' Extracting details of the selection(s) in [data_extract_ui] elements. #' #' @inheritParams shiny::moduleServer -#' @param datasets (`FilteredData` or `list` of `reactive` or non-`reactive` `data.frame`)\cr -#' object containing data either in the form of `FilteredData` or as a list of `data.frame`. -#' When passing a list of non-reactive `data.frame` objects, they are converted to reactive `data.frame`s internally. -#' When passing a list of reactive or non-reactive `data.frame` objects, the argument `join_keys` is required also. -#' @param data_extract_spec (`data_extract_spec` or a list of `data_extract_spec`)\cr -#' A list of data filter and select information constructed by [data_extract_spec]. +#' @param datasets (`FilteredData` or `list` of `reactive` or non-`reactive` `data.frame`) +#' object containing data either in the form of `FilteredData` or as a list of `data.frame`. +#' When passing a list of non-reactive `data.frame` objects, they are converted to reactive `data.frame`s internally. +#' When passing a list of reactive or non-reactive `data.frame` objects, the argument `join_keys` is required also. +#' @param data_extract_spec (`data_extract_spec` or a list of `data_extract_spec`) +#' A list of data filter and select information constructed by [data_extract_spec]. #' @param ... #' an additional argument `join_keys` is required when `datasets` is a list of `data.frame`. #' It shall contain the keys per dataset in `datasets`. #' -#' @return -#' A reactive `list` containing following fields: -#' -#' \itemize{ -#' \item{`filters`: }{A list with the information on the filters that are applied to the data set.} -#' \item{`select`: }{The variables that are selected from the dataset.} -#' \item{`always_selected`: }{The column names from the data set that should always be selected.} -#' \item{`reshape`: }{Whether reshape long to wide should be applied or not.} -#' \item{`dataname`: }{The name of the data set.} -#' \item{`internal_id`: }{The `id` of the corresponding shiny input element.} -#' \item{`keys`: }{The names of the columns that can be used to merge the data set.} -#' \item{`iv`:}{A `shinyvalidate::InputValidator` containing `validator` for this `data_extract`} -#' } +#' @return A reactive `list` containing following fields: +#' +#' * `filters`: A list with the information on the filters that are applied to the data set. +#' * `select`: The variables that are selected from the dataset. +#' * `always_selected`: The column names from the data set that should always be selected. +#' * `reshape`: Whether reshape long to wide should be applied or not. +#' * `dataname`: The name of the data set. +#' * `internal_id`: The `id` of the corresponding shiny input element. +#' * `keys`: The names of the columns that can be used to merge the data set. +#' * `iv`: A `shinyvalidate::InputValidator` containing `validator` for this `data_extract` #' #' @references [data_extract_srv] #' diff --git a/R/data_extract_spec.R b/R/data_extract_spec.R index 09ffccfd..f839f905 100644 --- a/R/data_extract_spec.R +++ b/R/data_extract_spec.R @@ -12,23 +12,21 @@ #' @rdname data_extract_spec #' #' @section Module Development: -#' \describe{ #' `teal.transform` uses this object to construct a UI element in a module. -#' } #' -#' @param dataname (`character`)\cr -#' The name of the dataset to be extracted. -#' @param select (`NULL`, `select_spec`-S3 class or `delayed_select_spec`)\cr -#' Columns to be selected from the input dataset -#' mentioned in `dataname`. The setup can be created using [select_spec] function. -#' @param filter (`NULL` or `filter_spec` or its respective delayed version)\cr -#' Setup of the filtering of key columns inside the dataset. -#' This setup can be created using the [filter_spec] function. -#' Please note that if both select and filter are set to NULL, then the result will be a filter spec UI with all -#' variables as possible choices and a select spec with multiple set to `TRUE`. -#' @param reshape (`logical`)\cr -#' whether reshape long to wide. Note that it will be used only in case of long dataset with multiple -#' keys selected in filter part. +#' @param dataname (`character`) +#' The name of the dataset to be extracted. +#' @param select (`NULL`, `select_spec`-S3 class or `delayed_select_spec`) +#' Columns to be selected from the input dataset +#' mentioned in `dataname`. The setup can be created using [select_spec] function. +#' @param filter (`NULL` or `filter_spec` or its respective delayed version) +#' Setup of the filtering of key columns inside the dataset. +#' This setup can be created using the [filter_spec] function. +#' Please note that if both select and filter are set to NULL, then the result will be a filter spec UI with all +#' variables as possible choices and a select spec with multiple set to `TRUE`. +#' @param reshape (`logical`) +#' whether reshape long to wide. Note that it will be used only in case of long dataset with multiple +#' keys selected in filter part. #' #' @examples #' adtte_filters <- filter_spec( diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R index 2ed1c073..c430945b 100644 --- a/R/get_dplyr_call.R +++ b/R/get_dplyr_call.R @@ -4,8 +4,8 @@ #' same selector - same dataset, same filter configuration and same reshape status #' @inheritParams get_merge_call #' -#' @return (\code{list}) simplified selectors with aggregated set of filters, -#' selections, reshapes etc. All necessary data for merging +#' @return (`list`) simplified selectors with aggregated set of filters, +#' selections, reshapes etc. All necessary data for merging #' @keywords internal #' get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys()) { @@ -121,12 +121,12 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys( #' #' Parse filter, select, rename and reshape call #' @inheritParams get_dplyr_call_data -#' @param idx optional (\code{integer}) current selector index in all selectors list -#' @param dplyr_call_data (\code{list}) simplified selectors with aggregated set of filters, -#' selections, reshapes etc. All necessary data for merging +#' @param idx optional (`integer`) current selector index in all selectors list +#' @param dplyr_call_data (`list`) simplified selectors with aggregated set of filters, +#' selections, reshapes etc. All necessary data for merging #' @param data (`NULL` or named `list`). #' -#' @return (\code{call}) filter, select, rename and reshape call +#' @return (`call`) filter, select, rename and reshape call #' #' @examples #' # use non-exported function from teal.transform @@ -246,11 +246,11 @@ get_dplyr_call <- function(selector_list, return(final_call) } -#' Parse \code{dplyr} select call +#' Parse `dplyr` select call #' -#' @param select (\code{character}) vector of selected column names +#' @param select (`character`) vector of selected column names #' -#' @return (\code{call}) \code{dplyr} select call +#' @return (`call`) `dplyr` select call #' #' @examples #' # use non-exported function from teal.transform @@ -269,12 +269,12 @@ get_select_call <- function(select) { as.call(c(list(quote(dplyr::select)), lapply(select, as.name))) } -#' Returns \code{dplyr} filter call +#' Returns `dplyr` filter call #' -#' @param filter (\code{list}) Either list of lists or list with \code{select} and \code{selected} items. -#' @param dataname (\code{NULL} or \code{character}) name of dataset. -#' @param datasets (\code{NULL} or \code{named `list`}). -#' @return (\code{call}) \code{dplyr} filter call +#' @param filter (`list`) Either list of lists or list with `select` and `selected` items. +#' @param dataname (`NULL` or `character`) name of dataset. +#' @param datasets (`NULL` or named `list`). +#' @return (`call`) `dplyr` filter call #' #' @examples #' # use non-exported function from teal.transform @@ -408,13 +408,14 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) { ) } -#' Returns \code{dplyr} rename call +#' Returns `dplyr` rename call #' #' Rename is used only if there are duplicated columns #' #' @inheritParams get_dplyr_call #' -#' @return (\code{call}) \code{dplyr} rename call +#' @return (`call`) `dplyr` rename call +#' #' @references get_rename_dict #' #' @examples @@ -489,11 +490,11 @@ get_rename_call <- function(selector_list = list(), as.call(append(quote(dplyr::rename), internal)) } -#' Returns \code{dplyr} reshape call +#' Returns `dplyr` reshape call #' #' @inheritParams get_dplyr_call #' -#' @return (\code{list}) list of multiple \code{dplyr} calls that reshape data +#' @return (`list`) list of multiple `dplyr` calls that reshape data #' #' @examples #' # use non-exported function from teal.transform @@ -573,7 +574,7 @@ get_reshape_call <- function(selector_list = list(), #' Get pivot longer columns #' #' Get values names which are spread into columns. -#' @param selector one element of selector_list obtained by \code{get_dplyr_call_data}. +#' @param selector one element of selector_list obtained by `get_dplyr_call_data`. #' @keywords internal #' get_pivot_longer_col <- function(selector) { @@ -584,7 +585,7 @@ get_pivot_longer_col <- function(selector) { #' Get unite columns #' #' Get key names which spreads values into columns. Reshape is done only -#' on keys which are in \code{filter_spec}. +#' on keys which are in `filter_spec`. #' @inheritParams get_pivot_longer_col #' @keywords internal #' diff --git a/R/get_merge_call.R b/R/get_merge_call.R index a000ca29..59410446 100644 --- a/R/get_merge_call.R +++ b/R/get_merge_call.R @@ -145,18 +145,16 @@ get_merge_key_grid <- function(selector_list, join_keys = teal.data::join_keys() #' @param selector_to (`list`) `data_extract_srv` #' @param key_from (`character`) keys used in the first selector while joining #' -#' @details This function covers up to now 4 cases -#' \itemize{ -#' \item{dataset without parent }{ Primary keys are returned} -#' \item{dataset source = dataset target}{ -#' The primary keys subtracted of all key columns that -#' get purely filtered. This means just one value would -#' be left after filtering inside this column. Then it -#' can be taken out. -#' } -#' \item{target `dataname` is parent }{ foreign keys} -#' \item{any other case }{foreign keys} -#' } +#' @details +#' This function covers up to now 4 cases +#' +#' * dataset without parent: Primary keys are returned +#' * dataset source = dataset target: +#' The primary keys subtracted of all key columns that get purely filtered. +#' This means just one value would be left after filtering inside this column. +#' Then it can be taken out. +#' * target `dataname` is parent foreign keys +#' * any other case foreign keys #' #' @return (`character`) #' @keywords internal @@ -335,10 +333,11 @@ get_dropped_filters <- function(selector) { #' Gets the relabel call #' -#' @description `r lifecycle::badge("stable")` +#' `r lifecycle::badge("stable")` +#' #' @inheritParams merge_datasets -#' @param columns_source \code{named list}\cr -#' where names are column names, values are labels + additional attribute `dataname` +#' @param columns_source named `list` +#' where names are column names, values are labels + additional attribute `dataname` #' #' @return (`call`) to relabel `dataset` and assign to `anl_name`. #' @@ -404,9 +403,11 @@ get_anl_relabel_call <- function(columns_source, datasets, anl_name = "ANL") { #' Create relabel call from named character #' #' @description `r lifecycle::badge("stable")` +#' #' Function creates relabel call from named character. -#' @param labels (`named character`)\cr -#' where name is name is function argument name and value is a function argument value. +#' +#' @param labels (`named character`) +#' where name is name is function argument name and value is a function argument value. #' #' @return (`call`) object with relabel step #' @examples diff --git a/R/merge_datasets.R b/R/merge_datasets.R index d987ca5a..31c9d454 100644 --- a/R/merge_datasets.R +++ b/R/merge_datasets.R @@ -261,9 +261,12 @@ merge_selectors <- function(selector_list) { #' Validate data_extracts in merge_datasets #' #' Validate selected inputs from data_extract before passing to data_merge to avoid -#' \code{dplyr} errors or unexpected results +#' `dplyr` errors or unexpected results +#' #' @inheritParams merge_datasets -#' @return \code{NULL} if check is successful +#' +#' @return `NULL` if check is successful +#' #' @keywords internal #' check_data_merge_selectors <- function(selector_list) { diff --git a/R/merge_expression_module.R b/R/merge_expression_module.R index 7c0a9250..063ca2eb 100644 --- a/R/merge_expression_module.R +++ b/R/merge_expression_module.R @@ -6,18 +6,19 @@ #' Compare the example below with that found in [merge_expression_srv()]. #' #' @inheritParams shiny::moduleServer -#' @param datasets (named `list` of `reactive` or non-`reactive` `data.frame`)\cr -#' object containing data as a list of `data.frame`. When passing a list of non-reactive `data.frame` objects, they are -#' converted to reactive `data.frame` objects internally. -#' @param join_keys (`join_keys`)\cr -#' of variables used as join keys for each of the datasets in `datasets`. -#' This will be used to extract the `keys` of every dataset. -#' @param data_extract (named `list` of `data_extract_spec`)\cr -#' @param merge_function (`character(1)`)\cr -#' A character string of a function that -#' accepts the arguments `x`, `y` and `by` to perform the merging of datasets. -#' @param anl_name (`character(1)`)\cr -#' Name of the analysis dataset. +#' @param datasets (named `list` of `reactive` or non-`reactive` `data.frame`) +#' object containing data as a list of `data.frame`. +#' When passing a list of non-reactive `data.frame` objects, they are +#' converted to reactive `data.frame` objects internally. +#' @param join_keys (`join_keys`) +#' of variables used as join keys for each of the datasets in `datasets`. +#' This will be used to extract the `keys` of every dataset. +#' @param data_extract (named `list` of `data_extract_spec`) +#' @param merge_function (`character(1)`) +#' A character string of a function that accepts the arguments `x`, `y` and +#' `by` to perform the merging of datasets. +#' @param anl_name (`character(1)`) +#' Name of the analysis dataset. #' #' @return reactive expression with output from [merge_expression_srv()]. #' @@ -191,26 +192,31 @@ merge_expression_module.list <- function(datasets, #' Data merge module server #' -#' @description `r lifecycle::badge("experimental")` -#' @details When additional processing of the `data_extract` list input is required, `merge_expression_srv()` can be -#' combined with `data_extract_multiple_srv()` or `data_extract_srv()` to influence the `selector_list` input. -#' Compare the example below with that found in [merge_expression_module()]. +#' `r lifecycle::badge("experimental")` +#' +#' When additional processing of the `data_extract` list input is required, +#' `merge_expression_srv()` can be combined with `data_extract_multiple_srv()` +#' or `data_extract_srv()` to influence the `selector_list` input. +#' Compare the example below with that found in [merge_expression_module()]. #' #' @inheritParams shiny::moduleServer -#' @param datasets (named `list` of `reactive` or non-`reactive` `data.frame`)\cr -#' object containing data as a list of `data.frame`. When passing a list of non-reactive `data.frame` objects, they are -#' converted to reactive `data.frame` objects internally. -#' @param join_keys (`join_keys`)\cr -#' of variables used as join keys for each of the datasets in `datasets`. -#' This will be used to extract the `keys` of every dataset. -#' @param selector_list (`reactive`)\cr -#' output from [data_extract_multiple_srv()] or a reactive named list of outputs from [data_extract_srv()]. -#' When using a reactive named list, the names must be identical to the shiny ids of the respective -#' [data_extract_ui()]. -#' @param merge_function (`character(1)` or `reactive`)\cr +#' @param datasets (named `list` of `reactive` or non-`reactive` `data.frame`) +#' object containing data as a list of `data.frame`. When passing a list of +#' non-reactive `data.frame` objects, they are converted to reactive +#' `data.frame` objects internally. +#' @param join_keys (`join_keys`) +#' of variables used as join keys for each of the datasets in `datasets`. +#' This will be used to extract the `keys` of every dataset. +#' @param selector_list (`reactive`) +#' output from [data_extract_multiple_srv()] or a reactive named list of +#' outputs from [data_extract_srv()]. +#' When using a reactive named list, the names must be identical to the shiny +#' ids of the respective +#' [data_extract_ui()]. +#' @param merge_function (`character(1)` or `reactive`) #' A character string of a function that accepts the arguments #' `x`, `y` and `by` to perform the merging of datasets. -#' @param anl_name (`character(1)`)\cr +#' @param anl_name (`character(1)`) #' Name of the analysis dataset. #' #' @return reactive expression with output from [merge_datasets()]. diff --git a/R/select_spec.R b/R/select_spec.R index fa03729b..a981e718 100644 --- a/R/select_spec.R +++ b/R/select_spec.R @@ -1,39 +1,39 @@ #' Column selection input specification #' #' @description `r lifecycle::badge("stable")` -#' \code{select_spec} is used inside `teal` to create a \code{\link[shiny]{selectInput}} +#' `select_spec` is used inside `teal` to create a [shiny::selectInput()] #' that will select columns from a dataset. #' -#' @param choices (\code{character}) or (\code{delayed_data}) object. +#' @param choices (`character`) or (`delayed_data`) object. #' Named character vector to define the choices -#' of a shiny \code{\link[shiny]{selectInput}}. These have to be columns in the -#' dataset defined in the \code{\link{data_extract_spec}} where this is called. -#' \code{delayed_data} objects can be created via \code{\link{variable_choices}} or \code{\link{value_choices}}. +#' of a shiny [shiny::selectInput()]. These have to be columns in the +#' dataset defined in the [data_extract_spec()] where this is called. +#' `delayed_data` objects can be created via [variable_choices()] or [value_choices()]. #' -#' @param selected optional (\code{character} or \code{NULL} or \code{all_choices} or \code{delayed_data} object). -#' Named character vector to define the selected values of a shiny \code{\link[shiny]{selectInput}}. +#' @param selected optional (`character` or `NULL` or `all_choices` or `delayed_data` object). +#' Named character vector to define the selected values of a shiny [shiny::selectInput()]. #' Passing an `all_choices()` object indicates selecting all possible choices. -#' Defaults to the first value of \code{choices} or \code{NULL} for delayed data loading. +#' Defaults to the first value of `choices` or `NULL` for delayed data loading. #' -#' @param multiple (\code{logical}) Whether multiple values shall be allowed in the -#' shiny \code{\link[shiny]{selectInput}}. +#' @param multiple (`logical`) Whether multiple values shall be allowed in the +#' shiny [shiny::selectInput()]. #' -#' @param fixed optional (\code{logical}). \code{\link{data_extract_spec}} specific feature to -#' hide the choices selected in case they are not needed. Setting fixed to \code{TRUE} +#' @param fixed optional (`logical`). [data_extract_spec()] specific feature to +#' hide the choices selected in case they are not needed. Setting fixed to `TRUE` #' will not allow the user to select columns. It will then lead to a selection of #' columns in the dataset that is defined by the developer of the app. #' -#' @param always_selected (\code{character}) Additional column names from the data set that should +#' @param always_selected (`character`) Additional column names from the data set that should #' always be selected #' #' @param ordered (`logical(1)`) Flags whether selection order should be tracked. #' -#' @param label optional (\code{character}). Define a label on top of this specific -#' shiny \code{\link[shiny]{selectInput}}. The default value is \code{"Select"}. +#' @param label optional (`character`). Define a label on top of this specific +#' shiny [shiny::selectInput()]. The default value is `"Select"`. #' -#' @return A \code{select_spec}-S3 class object or \code{delayed_select_spec}-S3-class object. +#' @return A `select_spec`-S3 class object or `delayed_select_spec`-S3-class object. #' It contains all input values. -#' If \code{select_spec}, then the function double checks the \code{choices} and \code{selected} inputs. +#' If `select_spec`, then the function double checks the `choices` and `selected` inputs. #' #' #' @rdname select_spec diff --git a/man/Queue.Rd b/man/Queue.Rd index 59125c61..3effafac 100644 --- a/man/Queue.Rd +++ b/man/Queue.Rd @@ -4,7 +4,8 @@ \alias{Queue} \title{R6 Class - A First-In-First-Out Abstract Data Type} \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}\cr +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} + Abstract data type that stores and returns any number of elements. A \code{Queue} object stores all elements in a single vector, diff --git a/man/call_check_parse_varname.Rd b/man/call_check_parse_varname.Rd index cefe5756..a6637ff3 100644 --- a/man/call_check_parse_varname.Rd +++ b/man/call_check_parse_varname.Rd @@ -7,7 +7,7 @@ call_check_parse_varname(varname) } \arguments{ -\item{varname}{(\code{name}, \code{call} or \code{character(1)})\cr +\item{varname}{(\code{name}, \code{call} or \code{character(1)}) name of the variable} } \description{ diff --git a/man/call_extract_list.Rd b/man/call_extract_list.Rd index d4438b5c..e07237dc 100644 --- a/man/call_extract_list.Rd +++ b/man/call_extract_list.Rd @@ -7,14 +7,11 @@ call_extract_list(dataname, varname, dollar = TRUE) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name}) -name of the object} +\item{dataname}{(\code{character(1)} or \code{name}) name of the object} -\item{varname}{(\code{character(1)} or \code{name}) -name of the slot in data} +\item{varname}{(\code{character(1)} or \code{name}) name of the slot in data} -\item{dollar}{(\code{logical(1)})\cr -whether returned call should use \code{$} or \code{[[} operator} +\item{dollar}{(\code{logical(1)}) whether returned call should use \code{$} or \code{[[} operator} } \value{ \code{$} or \code{[[} call diff --git a/man/check_data_merge_selectors.Rd b/man/check_data_merge_selectors.Rd index 7f34874b..64f4dd3d 100644 --- a/man/check_data_merge_selectors.Rd +++ b/man/check_data_merge_selectors.Rd @@ -7,9 +7,11 @@ check_data_merge_selectors(selector_list) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} } \value{ diff --git a/man/data_extract_multiple_srv.Rd b/man/data_extract_multiple_srv.Rd index 353c7b01..d22c17d4 100644 --- a/man/data_extract_multiple_srv.Rd +++ b/man/data_extract_multiple_srv.Rd @@ -34,7 +34,7 @@ data_extract_multiple_srv(data_extract, datasets, ...) The names of the elements in the list need to correspond to the \code{ids} passed to \code{data_extract_ui}. See example for details.} -\item{datasets}{(\code{FilteredData} or \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame})\cr +\item{datasets}{(\code{FilteredData} or \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame}) object containing data either in the form of \code{FilteredData} or as a list of \code{data.frame}. When passing a list of non-reactive \code{data.frame} objects, they are converted to reactive \code{data.frame}s internally. When passing a list of reactive or non-reactive \code{data.frame} objects, the argument \code{join_keys} is required also.} diff --git a/man/data_extract_spec.Rd b/man/data_extract_spec.Rd index 128f2328..173abe67 100644 --- a/man/data_extract_spec.Rd +++ b/man/data_extract_spec.Rd @@ -7,20 +7,20 @@ data_extract_spec(dataname, select = NULL, filter = NULL, reshape = FALSE) } \arguments{ -\item{dataname}{(\code{character})\cr +\item{dataname}{(\code{character}) The name of the dataset to be extracted.} -\item{select}{(\code{NULL}, \code{select_spec}-S3 class or \code{delayed_select_spec})\cr +\item{select}{(\code{NULL}, \code{select_spec}-S3 class or \code{delayed_select_spec}) Columns to be selected from the input dataset mentioned in \code{dataname}. The setup can be created using \link{select_spec} function.} -\item{filter}{(\code{NULL} or \code{filter_spec} or its respective delayed version)\cr +\item{filter}{(\code{NULL} or \code{filter_spec} or its respective delayed version) Setup of the filtering of key columns inside the dataset. This setup can be created using the \link{filter_spec} function. Please note that if both select and filter are set to NULL, then the result will be a filter spec UI with all variables as possible choices and a select spec with multiple set to \code{TRUE}.} -\item{reshape}{(\code{logical})\cr +\item{reshape}{(\code{logical}) whether reshape long to wide. Note that it will be used only in case of long dataset with multiple keys selected in filter part.} } @@ -35,10 +35,8 @@ Note that no checks based on columns can be done because the data is only referr } \section{Module Development}{ -\describe{ \code{teal.transform} uses this object to construct a UI element in a module. } -} \examples{ adtte_filters <- filter_spec( diff --git a/man/data_extract_srv.Rd b/man/data_extract_srv.Rd index 9205291d..ad4fcdfa 100644 --- a/man/data_extract_srv.Rd +++ b/man/data_extract_srv.Rd @@ -31,12 +31,12 @@ data_extract_srv(id, datasets, data_extract_spec, ...) \item{id}{An ID string that corresponds with the ID used to call the module's UI function.} -\item{datasets}{(\code{FilteredData} or \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame})\cr +\item{datasets}{(\code{FilteredData} or \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame}) object containing data either in the form of \code{FilteredData} or as a list of \code{data.frame}. When passing a list of non-reactive \code{data.frame} objects, they are converted to reactive \code{data.frame}s internally. When passing a list of reactive or non-reactive \code{data.frame} objects, the argument \code{join_keys} is required also.} -\item{data_extract_spec}{(\code{data_extract_spec} or a list of \code{data_extract_spec})\cr +\item{data_extract_spec}{(\code{data_extract_spec} or a list of \code{data_extract_spec}) A list of data filter and select information constructed by \link{data_extract_spec}.} \item{...}{an additional argument \code{join_keys} is required when \code{datasets} is a list of \code{data.frame}. @@ -59,20 +59,20 @@ If \code{NULL} then no validation will be added. See example for more details.} } \value{ A reactive \code{list} containing following fields: - \itemize{ -\item{\code{filters}: }{A list with the information on the filters that are applied to the data set.} -\item{\code{select}: }{The variables that are selected from the dataset.} -\item{\code{always_selected}: }{The column names from the data set that should always be selected.} -\item{\code{reshape}: }{Whether reshape long to wide should be applied or not.} -\item{\code{dataname}: }{The name of the data set.} -\item{\code{internal_id}: }{The \code{id} of the corresponding shiny input element.} -\item{\code{keys}: }{The names of the columns that can be used to merge the data set.} -\item{\code{iv}:}{A \code{shinyvalidate::InputValidator} containing \code{validator} for this \code{data_extract}} +\item \code{filters}: A list with the information on the filters that are applied to the data set. +\item \code{select}: The variables that are selected from the dataset. +\item \code{always_selected}: The column names from the data set that should always be selected. +\item \code{reshape}: Whether reshape long to wide should be applied or not. +\item \code{dataname}: The name of the data set. +\item \code{internal_id}: The \code{id} of the corresponding shiny input element. +\item \code{keys}: The names of the columns that can be used to merge the data set. +\item \code{iv}: A \code{shinyvalidate::InputValidator} containing \code{validator} for this \code{data_extract} } } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} + Extracting details of the selection(s) in \link{data_extract_ui} elements. } \examples{ diff --git a/man/data_extract_ui.Rd b/man/data_extract_ui.Rd index 4bf131a1..cc7a41d0 100644 --- a/man/data_extract_ui.Rd +++ b/man/data_extract_ui.Rd @@ -12,8 +12,7 @@ data_extract_ui(id, label, data_extract_spec, is_single_dataset = FALSE) \item{label}{(\code{character}) Label above the data extract input} \item{data_extract_spec}{(\code{list} of \code{data_extract_spec}) -This is the outcome of listing \link{data_extract_spec} -constructor calls.} +This is the outcome of listing \code{\link[=data_extract_spec]{data_extract_spec()}} constructor calls.} \item{is_single_dataset}{(\code{logical}) FALSE to display the dataset widget} } @@ -23,28 +22,25 @@ a specific dataset. The input elements will be returned inside a \link[shiny:ree There are three inputs that will be rendered \enumerate{ -\item{Dataset select}{ Optional. If more than one \link{data_extract_spec} is handed over +\item Dataset select Optional. If more than one \link{data_extract_spec} is handed over to the function, a shiny \link[shiny:selectInput]{shiny::selectInput} will be rendered. Else just the name of the dataset is given. -} -\item{Filter Panel }{Optional. If the \link{data_extract_spec} contains a +\item Filter Panel Optional. If the \link{data_extract_spec} contains a filter element a shiny \link[shiny:selectInput]{shiny::selectInput} will be rendered with the options to filter the dataset. -} -\item{Select panel }{A shiny \link[shiny:selectInput]{shiny::selectInput} to select columns from the dataset to +\item Select panel A shiny \link[shiny:selectInput]{shiny::selectInput} to select columns from the dataset to go into the analysis. } -} The output can be analyzed using \code{data_extract_srv(...)}. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} This functionality should be used in the encoding panel of your \code{teal} app. -It will allow app-developers to specify a \link{data_extract_spec} object. +It will allow app-developers to specify a \code{\link[=data_extract_spec]{data_extract_spec()}} object. This object should be used to \code{teal} module variables being filtered data from \code{CDISC} datasets. You can use this function in the same way as any -\href{https://shiny.rstudio.com/articles/modules.html}{shiny module} UI. +\href{https://shiny.rstudio.com/articles/modules.html}{\verb{shiny module}} UI. The corresponding server module can be found in \code{\link[=data_extract_srv]{data_extract_srv()}}. } \examples{ diff --git a/man/filter_spec.Rd b/man/filter_spec.Rd index 9ac68b44..9833e841 100644 --- a/man/filter_spec.Rd +++ b/man/filter_spec.Rd @@ -45,7 +45,7 @@ This value will be displayed inside the shiny app upon start. The \code{all_choi object indicates selecting all possible choices.} \item{multiple}{(\code{logical}) Whether multiple values shall be allowed in the -shiny \code{\link[shiny]{selectInput}}.} +shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}.} \item{label}{optional (\code{character}). Define a label on top of this specific shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. The default value is \code{"Filter by"}.} diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd index d3d8a347..7a1cb511 100644 --- a/man/filter_spec_internal.Rd +++ b/man/filter_spec_internal.Rd @@ -104,7 +104,7 @@ shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. The default value i if true allow to change the initially selected values of the variables; otherwise, do not allow.} \item{multiple}{(\code{logical}) Whether multiple values shall be allowed in the -shiny \code{\link[shiny]{selectInput}}.} +shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}.} \item{sep}{(\code{character}) A separator string to split the \code{choices} or \code{selected} inputs into the values of the different columns} diff --git a/man/get_anl_relabel_call.Rd b/man/get_anl_relabel_call.Rd index 2db5e0a9..4169553b 100644 --- a/man/get_anl_relabel_call.Rd +++ b/man/get_anl_relabel_call.Rd @@ -7,14 +7,15 @@ get_anl_relabel_call(columns_source, datasets, anl_name = "ANL") } \arguments{ -\item{columns_source}{\code{named list}\cr +\item{columns_source}{named \code{list} where names are column names, values are labels + additional attribute \code{dataname}} -\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame})\cr -object containing data as a list of \code{data.frame}. When passing a list of non-reactive \code{data.frame} objects, they are -converted to reactive \code{data.frame} objects internally.} +\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame}) +object containing data as a list of \code{data.frame}. When passing a list of +non-reactive \code{data.frame} objects, they are converted to reactive +\code{data.frame} objects internally.} -\item{anl_name}{(\code{character(1)})\cr +\item{anl_name}{(\code{character(1)}) Name of the analysis dataset.} } \value{ diff --git a/man/get_dataset_prefixed_col_names.Rd b/man/get_dataset_prefixed_col_names.Rd index d22376d7..af80ac10 100644 --- a/man/get_dataset_prefixed_col_names.Rd +++ b/man/get_dataset_prefixed_col_names.Rd @@ -17,5 +17,5 @@ A named character vector with the non-key columns of the \code{data}. \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} } \references{ -\link{data_extract_srv} +\code{\link[=data_extract_srv]{data_extract_srv()}} } diff --git a/man/get_dplyr_call.Rd b/man/get_dplyr_call.Rd index 9569ee16..6ced133b 100644 --- a/man/get_dplyr_call.Rd +++ b/man/get_dplyr_call.Rd @@ -13,9 +13,11 @@ get_dplyr_call( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{idx}{optional (\code{integer}) current selector index in all selectors list} diff --git a/man/get_dplyr_call_data.Rd b/man/get_dplyr_call_data.Rd index f85b831d..d0b9e7f7 100644 --- a/man/get_dplyr_call_data.Rd +++ b/man/get_dplyr_call_data.Rd @@ -7,9 +7,11 @@ get_dplyr_call_data(selector_list, join_keys = teal.data::join_keys()) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{join_keys}{(\code{join_keys}) nested list of keys used for joining} diff --git a/man/get_filter_call.Rd b/man/get_filter_call.Rd index 57d50f4f..e861bee1 100644 --- a/man/get_filter_call.Rd +++ b/man/get_filter_call.Rd @@ -11,7 +11,7 @@ get_filter_call(filter, dataname = NULL, datasets = NULL) \item{dataname}{(\code{NULL} or \code{character}) name of dataset.} -\item{datasets}{(\code{NULL} or \code{named `list`}).} +\item{datasets}{(\code{NULL} or named \code{list}).} } \value{ (\code{call}) \code{dplyr} filter call diff --git a/man/get_merge_call.Rd b/man/get_merge_call.Rd index c1138832..66c91159 100644 --- a/man/get_merge_call.Rd +++ b/man/get_merge_call.Rd @@ -13,20 +13,22 @@ get_merge_call( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{join_keys}{(\code{join_keys}) nested list of keys used for joining} \item{dplyr_call_data}{(\code{list}) simplified selectors with aggregated set of filters,} -\item{merge_function}{(\code{character(1)} or \code{reactive})\cr +\item{merge_function}{(\code{character(1)} or \code{reactive}) A character string of a function that accepts the arguments \code{x}, \code{y} and \code{by} to perform the merging of datasets.} -\item{anl_name}{(\code{character(1)})\cr +\item{anl_name}{(\code{character(1)}) Name of the analysis dataset.} } \value{ diff --git a/man/get_merge_key_grid.Rd b/man/get_merge_key_grid.Rd index 075ebd33..e80266fa 100644 --- a/man/get_merge_key_grid.Rd +++ b/man/get_merge_key_grid.Rd @@ -7,9 +7,11 @@ get_merge_key_grid(selector_list, join_keys = teal.data::join_keys()) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{join_keys}{(\code{join_keys}) nested list of keys used for joining} diff --git a/man/get_merge_key_i.Rd b/man/get_merge_key_i.Rd index 50102d8b..3750cc63 100644 --- a/man/get_merge_key_i.Rd +++ b/man/get_merge_key_i.Rd @@ -11,9 +11,11 @@ get_merge_key_i( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{idx}{optional (\code{integer}) current selector index in all selectors list} diff --git a/man/get_merge_key_pair.Rd b/man/get_merge_key_pair.Rd index efa3f046..2e6c45d7 100644 --- a/man/get_merge_key_pair.Rd +++ b/man/get_merge_key_pair.Rd @@ -22,15 +22,13 @@ Gets keys vector from keys list \details{ This function covers up to now 4 cases \itemize{ -\item{dataset without parent }{ Primary keys are returned} -\item{dataset source = dataset target}{ -The primary keys subtracted of all key columns that -get purely filtered. This means just one value would -be left after filtering inside this column. Then it -can be taken out. -} -\item{target \code{dataname} is parent }{ foreign keys} -\item{any other case }{foreign keys} +\item dataset without parent: Primary keys are returned +\item dataset source = dataset target: +The primary keys subtracted of all key columns that get purely filtered. +This means just one value would be left after filtering inside this column. +Then it can be taken out. +\item target \code{dataname} is parent foreign keys +\item any other case foreign keys } } \keyword{internal} diff --git a/man/get_relabel_call.Rd b/man/get_relabel_call.Rd index e6359f27..df54f82c 100644 --- a/man/get_relabel_call.Rd +++ b/man/get_relabel_call.Rd @@ -7,7 +7,7 @@ get_relabel_call(labels) } \arguments{ -\item{labels}{(\verb{named character})\cr +\item{labels}{(\verb{named character}) where name is name is function argument name and value is a function argument value.} } \value{ @@ -15,6 +15,7 @@ where name is name is function argument name and value is a function argument va } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} + Function creates relabel call from named character. } \examples{ diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd index c40ef0f6..2161cb38 100644 --- a/man/get_rename_call.Rd +++ b/man/get_rename_call.Rd @@ -12,9 +12,11 @@ get_rename_call( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{idx}{optional (\code{integer}) current selector index in all selectors list} diff --git a/man/get_reshape_call.Rd b/man/get_reshape_call.Rd index 027cd34f..5c9d581a 100644 --- a/man/get_reshape_call.Rd +++ b/man/get_reshape_call.Rd @@ -12,9 +12,11 @@ get_reshape_call( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{idx}{optional (\code{integer}) current selector index in all selectors list} diff --git a/man/merge_datasets.Rd b/man/merge_datasets.Rd index 70c8bf4c..7c88987f 100644 --- a/man/merge_datasets.Rd +++ b/man/merge_datasets.Rd @@ -13,24 +13,27 @@ merge_datasets( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} -\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame})\cr -object containing data as a list of \code{data.frame}. When passing a list of non-reactive \code{data.frame} objects, they are -converted to reactive \code{data.frame} objects internally.} +\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame}) +object containing data as a list of \code{data.frame}. When passing a list of +non-reactive \code{data.frame} objects, they are converted to reactive +\code{data.frame} objects internally.} -\item{join_keys}{(\code{join_keys})\cr +\item{join_keys}{(\code{join_keys}) of variables used as join keys for each of the datasets in \code{datasets}. This will be used to extract the \code{keys} of every dataset.} -\item{merge_function}{(\code{character(1)} or \code{reactive})\cr +\item{merge_function}{(\code{character(1)} or \code{reactive}) A character string of a function that accepts the arguments \code{x}, \code{y} and \code{by} to perform the merging of datasets.} -\item{anl_name}{(\code{character(1)})\cr +\item{anl_name}{(\code{character(1)}) Name of the analysis dataset.} } \value{ diff --git a/man/merge_expression_module.Rd b/man/merge_expression_module.Rd index 34c13e90..62a165dd 100644 --- a/man/merge_expression_module.Rd +++ b/man/merge_expression_module.Rd @@ -34,21 +34,22 @@ merge_expression_module( ) } \arguments{ -\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame})\cr -object containing data as a list of \code{data.frame}. When passing a list of non-reactive \code{data.frame} objects, they are +\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame}) +object containing data as a list of \code{data.frame}. +When passing a list of non-reactive \code{data.frame} objects, they are converted to reactive \code{data.frame} objects internally.} -\item{join_keys}{(\code{join_keys})\cr +\item{join_keys}{(\code{join_keys}) of variables used as join keys for each of the datasets in \code{datasets}. This will be used to extract the \code{keys} of every dataset.} -\item{data_extract}{(named \code{list} of \code{data_extract_spec})\cr} +\item{data_extract}{(named \code{list} of \code{data_extract_spec})} -\item{merge_function}{(\code{character(1)})\cr -A character string of a function that -accepts the arguments \code{x}, \code{y} and \code{by} to perform the merging of datasets.} +\item{merge_function}{(\code{character(1)}) +A character string of a function that accepts the arguments \code{x}, \code{y} and +\code{by} to perform the merging of datasets.} -\item{anl_name}{(\code{character(1)})\cr +\item{anl_name}{(\code{character(1)}) Name of the analysis dataset.} \item{id}{An ID string that corresponds with the ID used to call the module's diff --git a/man/merge_expression_srv.Rd b/man/merge_expression_srv.Rd index 2b689383..6140f59f 100644 --- a/man/merge_expression_srv.Rd +++ b/man/merge_expression_srv.Rd @@ -37,24 +37,27 @@ merge_expression_srv( \item{id}{An ID string that corresponds with the ID used to call the module's UI function.} -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} -\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame})\cr -object containing data as a list of \code{data.frame}. When passing a list of non-reactive \code{data.frame} objects, they are -converted to reactive \code{data.frame} objects internally.} +\item{datasets}{(named \code{list} of \code{reactive} or non-\code{reactive} \code{data.frame}) +object containing data as a list of \code{data.frame}. When passing a list of +non-reactive \code{data.frame} objects, they are converted to reactive +\code{data.frame} objects internally.} -\item{join_keys}{(\code{join_keys})\cr +\item{join_keys}{(\code{join_keys}) of variables used as join keys for each of the datasets in \code{datasets}. This will be used to extract the \code{keys} of every dataset.} -\item{merge_function}{(\code{character(1)} or \code{reactive})\cr +\item{merge_function}{(\code{character(1)} or \code{reactive}) A character string of a function that accepts the arguments \code{x}, \code{y} and \code{by} to perform the merging of datasets.} -\item{anl_name}{(\code{character(1)})\cr +\item{anl_name}{(\code{character(1)}) Name of the analysis dataset.} } \value{ @@ -64,8 +67,9 @@ reactive expression with output from \code{\link[=merge_datasets]{merge_datasets \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} } \details{ -When additional processing of the \code{data_extract} list input is required, \code{merge_expression_srv()} can be -combined with \code{data_extract_multiple_srv()} or \code{data_extract_srv()} to influence the \code{selector_list} input. +When additional processing of the \code{data_extract} list input is required, +\code{merge_expression_srv()} can be combined with \code{data_extract_multiple_srv()} +or \code{data_extract_srv()} to influence the \code{selector_list} input. Compare the example below with that found in \code{\link[=merge_expression_module]{merge_expression_module()}}. } \examples{ diff --git a/man/merge_selectors.Rd b/man/merge_selectors.Rd index b899800e..f1e86511 100644 --- a/man/merge_selectors.Rd +++ b/man/merge_selectors.Rd @@ -7,9 +7,11 @@ merge_selectors(selector_list) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} } \value{ diff --git a/man/parse_merge_key_i.Rd b/man/parse_merge_key_i.Rd index 1e86d23c..a9f99959 100644 --- a/man/parse_merge_key_i.Rd +++ b/man/parse_merge_key_i.Rd @@ -12,9 +12,11 @@ parse_merge_key_i( ) } \arguments{ -\item{selector_list}{(\code{reactive})\cr -output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. -When using a reactive named list, the names must be identical to the shiny ids of the respective +\item{selector_list}{(\code{reactive}) +output from \code{\link[=data_extract_multiple_srv]{data_extract_multiple_srv()}} or a reactive named list of +outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. +When using a reactive named list, the names must be identical to the shiny +ids of the respective \code{\link[=data_extract_ui]{data_extract_ui()}}.} \item{idx}{optional (\code{integer}) current selector index in all selectors list} diff --git a/man/select_spec.Rd b/man/select_spec.Rd index e1eaae60..042d7522 100644 --- a/man/select_spec.Rd +++ b/man/select_spec.Rd @@ -39,19 +39,19 @@ select_spec.default( \arguments{ \item{choices}{(\code{character}) or (\code{delayed_data}) object. Named character vector to define the choices -of a shiny \code{\link[shiny]{selectInput}}. These have to be columns in the -dataset defined in the \code{\link{data_extract_spec}} where this is called. -\code{delayed_data} objects can be created via \code{\link{variable_choices}} or \code{\link{value_choices}}.} +of a shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. These have to be columns in the +dataset defined in the \code{\link[=data_extract_spec]{data_extract_spec()}} where this is called. +\code{delayed_data} objects can be created via \code{\link[=variable_choices]{variable_choices()}} or \code{\link[=value_choices]{value_choices()}}.} \item{selected}{optional (\code{character} or \code{NULL} or \code{all_choices} or \code{delayed_data} object). -Named character vector to define the selected values of a shiny \code{\link[shiny]{selectInput}}. +Named character vector to define the selected values of a shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. Passing an \code{all_choices()} object indicates selecting all possible choices. Defaults to the first value of \code{choices} or \code{NULL} for delayed data loading.} \item{multiple}{(\code{logical}) Whether multiple values shall be allowed in the -shiny \code{\link[shiny]{selectInput}}.} +shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}.} -\item{fixed}{optional (\code{logical}). \code{\link{data_extract_spec}} specific feature to +\item{fixed}{optional (\code{logical}). \code{\link[=data_extract_spec]{data_extract_spec()}} specific feature to hide the choices selected in case they are not needed. Setting fixed to \code{TRUE} will not allow the user to select columns. It will then lead to a selection of columns in the dataset that is defined by the developer of the app.} @@ -62,7 +62,7 @@ always be selected} \item{ordered}{(\code{logical(1)}) Flags whether selection order should be tracked.} \item{label}{optional (\code{character}). Define a label on top of this specific -shiny \code{\link[shiny]{selectInput}}. The default value is \code{"Select"}.} +shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}. The default value is \code{"Select"}.} } \value{ A \code{select_spec}-S3 class object or \code{delayed_select_spec}-S3-class object. @@ -71,7 +71,7 @@ If \code{select_spec}, then the function double checks the \code{choices} and \c } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -\code{select_spec} is used inside \code{teal} to create a \code{\link[shiny]{selectInput}} +\code{select_spec} is used inside \code{teal} to create a \code{\link[shiny:selectInput]{shiny::selectInput()}} that will select columns from a dataset. } \examples{ diff --git a/tests/testthat/setup-skip_if_too_deep.R b/tests/testthat/setup-skip_if_too_deep.R index 7e707f6a..954dd280 100644 --- a/tests/testthat/setup-skip_if_too_deep.R +++ b/tests/testthat/setup-skip_if_too_deep.R @@ -1,6 +1,7 @@ #' Returns testing depth set by an environmental variable. #' -#' @details Looks for the option `TESTING_DEPTH` first, if not set, +#' @details +#' Looks for the option `TESTING_DEPTH` first, if not set, #' takes the system environmental variable `TESTING_DEPTH`. If neither #' is set, then returns 3 by default. If the value of `TESTING_DEPTH` #' is not a scalar numeric, then returns 3. @@ -23,26 +24,33 @@ testing_depth <- function() { # nolint # nousage } #' Skipping tests in the testthat pipeline under specific scope -#' @description This function should be used per each \code{testthat::test_that} call. -#' Each of the call should specify an appropriate depth value. -#' The depth value will set the appropriate scope so more/less time consuming tests could be recognized. -#' The environment variable \code{TESTING_DEPTH} is used for changing the scope of \code{testthat} pipeline. -#' \code{TESTING_DEPTH} interpretation for each possible value: -#' \itemize{ -#' \item{0}{no tests at all} -#' \item{1}{fast - small scope - executed on every commit} -#' \item{3}{medium - medium scope - daily integration pipeline} -#' \item{5}{slow - all tests - daily package tests} -#' } -#' @param depth \code{numeric} the depth of the testing evaluation, -#' has opposite interpretation to environment variable \code{TESTING_DEPTH}. -#' So e.g. `0` means run it always and `5` means a heavy test which should be run rarely. -#' If the \code{depth} argument is larger than \code{TESTING_DEPTH} then the test is skipped. +#' +#' @description +#' This function should be used per each [testthat::test_that()] call. +#' Each of the call should specify an appropriate depth value. +#' The depth value will set the appropriate scope so more/less time consuming tests could be recognized. +#' The environment variable `TESTING_DEPTH` is used for changing the scope of `testthat` pipeline. +#' +#' `TESTING_DEPTH` interpretation for each possible value: +#' +#' 1. no tests at all +#' 2. fast - small scope - executed on every commit +#' 3. medium - medium scope - daily integration pipeline +#' 4. slow - all tests - daily package tests +#' +#' @param depth `numeric` the depth of the testing evaluation, +#' has opposite interpretation to environment variable `TESTING_DEPTH`. +#' So e.g. `0` means run it always and `5` means a heavy test which should be run rarely. +#' If the `depth` argument is larger than `TESTING_DEPTH` then the test is skipped. +#' +#' @return `NULL` or invoke an error produced by `testthat::skip` +#' #' @importFrom testthat skip -#' @return \code{NULL} or invoke an error produced by \code{testthat::skip} -#' @note By default \code{TESTING_DEPTH} is equal to 3 if there is no environment variable for it. -#' By default \code{depth} argument lower or equal to 3 will not be skipped because by default \code{TESTING_DEPTH} -#' is equal to 3. To skip <= 3 depth tests then the environment variable has to be lower than 3 respectively. +#' +#' @note By default `TESTING_DEPTH` is equal to 3 if there is no environment variable for it. +#' By default `depth` argument lower or equal to 3 will not be skipped because by default `TESTING_DEPTH` +#' is equal to 3. +#' To skip <= 3 depth tests then the environment variable has to be lower than 3 respectively. skip_if_too_deep <- function(depth) { # nolintr checkmate::assert_number(depth, lower = 0, upper = 5) test_to_depth <- testing_depth() # by default 3 if there are no env variable From ddd13adb72bef076a95b6246ca3b70d080e8b707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:43:22 +0100 Subject: [PATCH 20/62] files 1-2/30: Title case, return params, full stop params/descr/details/return --- R/all_choices.R | 8 +- R/call_utils.R | 116 +++++++++++++--------------- man/all_choices.Rd | 6 +- man/call_check_parse_varname.Rd | 3 + man/call_condition_choice.Rd | 10 +-- man/call_condition_logical.Rd | 6 +- man/call_condition_range.Rd | 10 +-- man/call_condition_range_date.Rd | 10 +-- man/call_condition_range_posixct.Rd | 14 ++-- man/call_extract_array.Rd | 16 ++-- man/call_extract_list.Rd | 8 +- man/call_extract_matrix.Rd | 12 +-- man/call_with_colon.Rd | 11 ++- man/calls_combine_by.Rd | 10 +-- 14 files changed, 113 insertions(+), 127 deletions(-) diff --git a/R/all_choices.R b/R/all_choices.R index c4a112ca..29a79918 100644 --- a/R/all_choices.R +++ b/R/all_choices.R @@ -1,9 +1,9 @@ -#' An S3 structure representing the selection of all -#' possible choices in a `filter_spec`, `select_spec` or `choices_selected` object. +#' An S3 structure representing the selection of all possible choices in a +#' `filter_spec`, `select_spec` or `choices_selected` object #' -#' @description `r lifecycle::badge("experimental")` +#' `r lifecycle::badge("experimental")` #' -#' @return `all_choices` object +#' @return `all_choices` object. #' #' @examples #' # Both structures are semantically identical diff --git a/R/call_utils.R b/R/call_utils.R index 93408355..08a97db5 100644 --- a/R/call_utils.R +++ b/R/call_utils.R @@ -5,6 +5,8 @@ #' @param varname (`name`, `call` or `character(1)`) #' name of the variable #' +#' @returns the parsed `varname`. +#' #' @keywords internal #' call_check_parse_varname <- function(varname) { @@ -34,23 +36,23 @@ call_check_parse_varname <- function(varname) { #' Compose choices condition call from inputs. #' #' @param varname (`name`, `call` or `character(1)`) -#' name of the variable +#' name of the variable. #' @param choices (`vector`) #' `varname` values to match using the `==` (single value) or `%in%` (vector) #' condition. #' `choices` can be vector of any type but for some output might be converted: -#' * `factor` call is composed on choices converted to `character` +#' * `factor` call is composed on choices converted to `character`; #' * `Date` call is composed on choices converted to `character` using -#' `format(choices)` +#' `format(choices)`; #' * `POSIXct`, `POSIXlt` Call is composed on choices converted to `character` using #' `format(choices)`. #' #' One has to be careful here as formatted date-time variable might loose #' some precision (see `format` argument in [format.POSIXlt()] and output call #' could be insufficient for exact comparison. In this case one should specify -#' `varname = trunc()` and possibly convert `choices` to `character`) +#' `varname = trunc()` and possibly convert `choices` to `character`). #' -#' @return a `call` +#' @return `call`. #' #' @examples #' # use non-exported function from teal.transform @@ -92,17 +94,15 @@ call_condition_choice <- function(varname, choices) { #' `numeric` range condition call #' -#' Compose `numeric` range condition call from inputs +#' Compose `numeric` range condition call from inputs. #' #' @param varname (`name` or `character(1)`) -#' -#' name of the variable +#' name of the variable. #' #' @param range (`numeric(2)`) +#' range of the variable. #' -#' range of the variable -#' -#' @return a `call` +#' @return `call`. #' #' @examples #' # use non-exported function from teal.transform @@ -130,17 +130,15 @@ call_condition_range <- function(varname, range) { #' `logical` variable condition call #' -#' Compose `logical` variable condition call from inputs +#' Compose `logical` variable condition call from inputs. #' #' @param varname (`name` or `character(1)`) -#' #' name of the variable #' #' @param choice (`logical(1)`) -#' #' chosen value #' -#' @return a `call` +#' @return `call`. #' #' @examples #' # use non-exported function from teal.transform @@ -166,22 +164,19 @@ call_condition_logical <- function(varname, choice) { } } - #' `POSIXct` range condition call #' #' Compose `POSIXct` range condition call from inputs. #' -#' @param varname (`name` or `character(1)`) -#' name of the variable -#' -#' @param range (`POSIXct`) -#' range of the variable. Be aware that output uses truncated range format -#' `"%Y-%m-%d %H:%M:%S"`, which means that some precision might be lost. -#' -#' @param timezone (`character(1)`) -#' specifies the time zone to be used for the conversion. +#' @param varname (`name` or `character(1)`) name of the variable. +#' @param range (`POSIXct`) range of the variable. +#' Be aware that output uses truncated range format `"%Y-%m-%d %H:%M:%S"`, +#' which means that some precision might be lost. +#' @param timezone (`character(1)`) specifies the time zone to be used for the conversion. #' By default `Sys.timezone()` is used. #' +#' @return `call`. +#' #' @examples #' # use non-exported function from teal.transform #' call_condition_range_posixct <- getFromNamespace( @@ -193,7 +188,6 @@ call_condition_logical <- function(varname, choice) { #' range = c(Sys.time(), Sys.time() + 1), #' timezone = "UTC" #' ) -#' @return a `call` #' @keywords internal #' call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone()) { @@ -219,15 +213,12 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone #' `Date` range condition call #' -#' Compose `Date` range condition call from inputs +#' Compose `Date` range condition call from inputs. #' -#' @param varname (`name` or `character(1)`) -#' name of the variable +#' @param varname (`name` or `character(1)`) name of the variable. +#' @param range (`Date`) range of the variable. #' -#' @param range (`Date`) -#' range of the variable -#' -#' @return a `call` +#' @return `call`. #' #' @examples #' # use non-exported function from teal.transform @@ -253,15 +244,15 @@ call_condition_range_date <- function(varname, range) { #' Get call to subset and select array #' -#' @param dataname (`character(1)` or `name`) -#' @param row (`name`, `call`, `logical`, `integer`, `character`) -#' optional, name of the `row` or condition -#' @param column (`name`, `call`, `logical`, `integer`, `character`) -#' optional, name of the `column` or condition -#' @param aisle (`name`, `call`, `logical`, `integer`, `character`) -#' optional, name of the `row` or condition +#' @param dataname (`character(1)` or `name`). +#' @param row (optional `name`, `call`, `logical`, `integer` or `character`) +#' name of the `row` or condition. +#' @param column (optional `name`, `call`, `logical`, `integer` or `character`) +#' name of the `column` or condition. +#' @param aisle (optional `name`, `call`, `logical`, `integer` or `character`) +#' name of the `row` or condition. #' -#' @return specific [Extract()] `call` for 3-dimensional array +#' @return [Extract()] `call` for 3-dimensional array in `x[i, j, k]` notation. #' #' @examples #' # use non-exported function from teal.transform @@ -318,13 +309,13 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle #' Get call to subset and select matrix #' -#' @param dataname (`character(1)` or `name`) -#' @param row (`name`, `call`, `logical`, `integer`, `character`) -#' optional, name of the `row` or condition -#' @param column (`name`, `call`, `logical`, `integer`, `character`) -#' optional, name of the `column` or condition +#' @param dataname (`character(1)` or `name`). +#' @param row (optional `name`, `call`, `logical`, `integer` or `character`) +#' name of the `row` or condition. +#' @param column (optional `name`, `call`, `logical`, `integer` or `character`) +#' name of the `column` or condition. #' -#' @return specific [Extract()] `call` for matrix +#' @return [Extract()] `call` for matrix in `x[i, j]` notation. #' #' @examples #' # use non-exported function from teal.transform @@ -375,11 +366,11 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) { #' Compose extract call with `$` operator #' -#' @param dataname (`character(1)` or `name`) name of the object -#' @param varname (`character(1)` or `name`) name of the slot in data -#' @param dollar (`logical(1)`) whether returned call should use `$` or `[[` operator +#' @param dataname (`character(1)` or `name`) name of the object. +#' @param varname (`character(1)` or `name`) name of the slot in data. +#' @param dollar (`logical(1)`) whether returned call should use `$` or `[[` operator. #' -#' @return `$` or `[[` call +#' @return [Extract()] `call` in `$` or `[[` notation (depending on parameters). #' #' @examples #' # use non-exported function from teal.transform @@ -415,14 +406,16 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) { #' Create a call using a function in a given namespace #' -#' The arguments in ... need to be quoted because they will be evaluated otherwise +#' The dot arguments in `...` need to be quoted because they will be evaluated otherwise. #' -#' @md #' @param name `character` function name, possibly using namespace colon `::`, also -#' works with `:::` (sometimes needed, but strongly discouraged) -#' @param ... arguments to pass to function with name `name` +#' works with `:::` (sometimes needed, but strongly discouraged). +#' @param ... arguments to pass to function with name `name`. #' @param unlist_args `list` extra arguments passed in a single list, -#' avoids the use of `do.call` with this function +#' avoids the use of `do.call` with this function. +#' +#' @return `call`. +#' #' @examples #' # use non-exported function from teal.transform #' call_with_colon <- getFromNamespace("call_with_colon", "teal.transform") @@ -472,15 +465,12 @@ call_with_colon <- function(name, ..., unlist_args = list()) { #' Combine calls by operator #' -#' Combine list of calls by specific operator -#' -#' @param operator (`character(1)` or `name`) -#' name / symbol of the operator. +#' Combine list of calls by specific operator. #' -#' @param calls (`list` of calls) -#' list containing calls to be combined by `operator` +#' @param operator (`character(1)` or `name`) name / symbol of the operator. +#' @param calls (`list` of calls) list containing calls to be combined by `operator`. #' -#' @return a combined `call` +#' @return A combined `call`. #' #' @examples #' # use non-exported function from teal.transform diff --git a/man/all_choices.Rd b/man/all_choices.Rd index 6e9aa07e..eda7f650 100644 --- a/man/all_choices.Rd +++ b/man/all_choices.Rd @@ -2,13 +2,13 @@ % Please edit documentation in R/all_choices.R \name{all_choices} \alias{all_choices} -\title{An S3 structure representing the selection of all -possible choices in a \code{filter_spec}, \code{select_spec} or \code{choices_selected} object.} +\title{An S3 structure representing the selection of all possible choices in a +\code{filter_spec}, \code{select_spec} or \code{choices_selected} object} \usage{ all_choices() } \value{ -\code{all_choices} object +\code{all_choices} object. } \description{ \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} diff --git a/man/call_check_parse_varname.Rd b/man/call_check_parse_varname.Rd index a6637ff3..04ec6172 100644 --- a/man/call_check_parse_varname.Rd +++ b/man/call_check_parse_varname.Rd @@ -10,6 +10,9 @@ call_check_parse_varname(varname) \item{varname}{(\code{name}, \code{call} or \code{character(1)}) name of the variable} } +\value{ +the parsed \code{varname}. +} \description{ Checks \code{varname} type and parse if it's a \code{character} } diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd index 9336fe00..97af3df4 100644 --- a/man/call_condition_choice.Rd +++ b/man/call_condition_choice.Rd @@ -8,27 +8,27 @@ call_condition_choice(varname, choices) } \arguments{ \item{varname}{(\code{name}, \code{call} or \code{character(1)}) -name of the variable} +name of the variable.} \item{choices}{(\code{vector}) \code{varname} values to match using the \code{==} (single value) or \code{\%in\%} (vector) condition. \code{choices} can be vector of any type but for some output might be converted: \itemize{ -\item \code{factor} call is composed on choices converted to \code{character} +\item \code{factor} call is composed on choices converted to \code{character}; \item \code{Date} call is composed on choices converted to \code{character} using -\code{format(choices)} +\code{format(choices)}; \item \code{POSIXct}, \code{POSIXlt} Call is composed on choices converted to \code{character} using \code{format(choices)}. One has to be careful here as formatted date-time variable might loose some precision (see \code{format} argument in \code{\link[=format.POSIXlt]{format.POSIXlt()}} and output call could be insufficient for exact comparison. In this case one should specify -\verb{varname = trunc()} and possibly convert \code{choices} to \code{character}) +\verb{varname = trunc()} and possibly convert \code{choices} to \code{character}). }} } \value{ -a \code{call} +\code{call}. } \description{ Compose choices condition call from inputs. diff --git a/man/call_condition_logical.Rd b/man/call_condition_logical.Rd index f8f33e00..44e9b6f5 100644 --- a/man/call_condition_logical.Rd +++ b/man/call_condition_logical.Rd @@ -8,18 +8,16 @@ call_condition_logical(varname, choice) } \arguments{ \item{varname}{(\code{name} or \code{character(1)}) - name of the variable} \item{choice}{(\code{logical(1)}) - chosen value} } \value{ -a \code{call} +\code{call}. } \description{ -Compose \code{logical} variable condition call from inputs +Compose \code{logical} variable condition call from inputs. } \examples{ # use non-exported function from teal.transform diff --git a/man/call_condition_range.Rd b/man/call_condition_range.Rd index d9da1567..7a803c5e 100644 --- a/man/call_condition_range.Rd +++ b/man/call_condition_range.Rd @@ -8,18 +8,16 @@ call_condition_range(varname, range) } \arguments{ \item{varname}{(\code{name} or \code{character(1)}) - -name of the variable} +name of the variable.} \item{range}{(\code{numeric(2)}) - -range of the variable} +range of the variable.} } \value{ -a \code{call} +\code{call}. } \description{ -Compose \code{numeric} range condition call from inputs +Compose \code{numeric} range condition call from inputs. } \examples{ # use non-exported function from teal.transform diff --git a/man/call_condition_range_date.Rd b/man/call_condition_range_date.Rd index 7f264a77..818a237a 100644 --- a/man/call_condition_range_date.Rd +++ b/man/call_condition_range_date.Rd @@ -7,17 +7,15 @@ call_condition_range_date(varname, range) } \arguments{ -\item{varname}{(\code{name} or \code{character(1)}) -name of the variable} +\item{varname}{(\code{name} or \code{character(1)}) name of the variable.} -\item{range}{(\code{Date}) -range of the variable} +\item{range}{(\code{Date}) range of the variable.} } \value{ -a \code{call} +\code{call}. } \description{ -Compose \code{Date} range condition call from inputs +Compose \code{Date} range condition call from inputs. } \examples{ # use non-exported function from teal.transform diff --git a/man/call_condition_range_posixct.Rd b/man/call_condition_range_posixct.Rd index 07888008..bf5806c5 100644 --- a/man/call_condition_range_posixct.Rd +++ b/man/call_condition_range_posixct.Rd @@ -7,19 +7,17 @@ call_condition_range_posixct(varname, range, timezone = Sys.timezone()) } \arguments{ -\item{varname}{(\code{name} or \code{character(1)}) -name of the variable} +\item{varname}{(\code{name} or \code{character(1)}) name of the variable.} -\item{range}{(\code{POSIXct}) -range of the variable. Be aware that output uses truncated range format -\code{"\%Y-\%m-\%d \%H:\%M:\%S"}, which means that some precision might be lost.} +\item{range}{(\code{POSIXct}) range of the variable. +Be aware that output uses truncated range format \code{"\%Y-\%m-\%d \%H:\%M:\%S"}, +which means that some precision might be lost.} -\item{timezone}{(\code{character(1)}) -specifies the time zone to be used for the conversion. +\item{timezone}{(\code{character(1)}) specifies the time zone to be used for the conversion. By default \code{Sys.timezone()} is used.} } \value{ -a \code{call} +\code{call}. } \description{ Compose \code{POSIXct} range condition call from inputs. diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd index 4faabbbe..a1be6f44 100644 --- a/man/call_extract_array.Rd +++ b/man/call_extract_array.Rd @@ -7,19 +7,19 @@ call_extract_array(dataname = ".", row = NULL, column = NULL, aisle = NULL) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name})} +\item{dataname}{(\code{character(1)} or \code{name}).} -\item{row}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) -optional, name of the \code{row} or condition} +\item{row}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character}) +name of the \code{row} or condition.} -\item{column}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) -optional, name of the \code{column} or condition} +\item{column}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character}) +name of the \code{column} or condition.} -\item{aisle}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) -optional, name of the \code{row} or condition} +\item{aisle}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character}) +name of the \code{row} or condition.} } \value{ -specific \code{\link[=Extract]{Extract()}} \code{call} for 3-dimensional array +\code{\link[=Extract]{Extract()}} \code{call} for 3-dimensional array in \code{x[i, j, k]} notation. } \description{ Get call to subset and select array diff --git a/man/call_extract_list.Rd b/man/call_extract_list.Rd index e07237dc..958ef715 100644 --- a/man/call_extract_list.Rd +++ b/man/call_extract_list.Rd @@ -7,14 +7,14 @@ call_extract_list(dataname, varname, dollar = TRUE) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name}) name of the object} +\item{dataname}{(\code{character(1)} or \code{name}) name of the object.} -\item{varname}{(\code{character(1)} or \code{name}) name of the slot in data} +\item{varname}{(\code{character(1)} or \code{name}) name of the slot in data.} -\item{dollar}{(\code{logical(1)}) whether returned call should use \code{$} or \code{[[} operator} +\item{dollar}{(\code{logical(1)}) whether returned call should use \code{$} or \code{[[} operator.} } \value{ -\code{$} or \code{[[} call +\code{\link[=Extract]{Extract()}} \code{call} in \code{$} or \code{[[} notation (depending on parameters). } \description{ Compose extract call with \code{$} operator diff --git a/man/call_extract_matrix.Rd b/man/call_extract_matrix.Rd index 0fcccc6c..be3bd026 100644 --- a/man/call_extract_matrix.Rd +++ b/man/call_extract_matrix.Rd @@ -7,16 +7,16 @@ call_extract_matrix(dataname = ".", row = NULL, column = NULL) } \arguments{ -\item{dataname}{(\code{character(1)} or \code{name})} +\item{dataname}{(\code{character(1)} or \code{name}).} -\item{row}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) -optional, name of the \code{row} or condition} +\item{row}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character}) +name of the \code{row} or condition.} -\item{column}{(\code{name}, \code{call}, \code{logical}, \code{integer}, \code{character}) -optional, name of the \code{column} or condition} +\item{column}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character}) +name of the \code{column} or condition.} } \value{ -specific \code{\link[=Extract]{Extract()}} \code{call} for matrix +\code{\link[=Extract]{Extract()}} \code{call} for matrix in \code{x[i, j]} notation. } \description{ Get call to subset and select matrix diff --git a/man/call_with_colon.Rd b/man/call_with_colon.Rd index a617166d..2ed895b6 100644 --- a/man/call_with_colon.Rd +++ b/man/call_with_colon.Rd @@ -8,15 +8,18 @@ call_with_colon(name, ..., unlist_args = list()) } \arguments{ \item{name}{\code{character} function name, possibly using namespace colon \code{::}, also -works with \code{:::} (sometimes needed, but strongly discouraged)} +works with \code{:::} (sometimes needed, but strongly discouraged).} -\item{...}{arguments to pass to function with name \code{name}} +\item{...}{arguments to pass to function with name \code{name}.} \item{unlist_args}{\code{list} extra arguments passed in a single list, -avoids the use of \code{do.call} with this function} +avoids the use of \code{do.call} with this function.} +} +\value{ +\code{call}. } \description{ -The arguments in ... need to be quoted because they will be evaluated otherwise +The dot arguments in \code{...} need to be quoted because they will be evaluated otherwise. } \examples{ # use non-exported function from teal.transform diff --git a/man/calls_combine_by.Rd b/man/calls_combine_by.Rd index 6ecc026d..93accf73 100644 --- a/man/calls_combine_by.Rd +++ b/man/calls_combine_by.Rd @@ -7,17 +7,15 @@ calls_combine_by(operator, calls) } \arguments{ -\item{operator}{(\code{character(1)} or \code{name}) -name / symbol of the operator.} +\item{operator}{(\code{character(1)} or \code{name}) name / symbol of the operator.} -\item{calls}{(\code{list} of calls) -list containing calls to be combined by \code{operator}} +\item{calls}{(\code{list} of calls) list containing calls to be combined by \code{operator}.} } \value{ -a combined \code{call} +A combined \code{call}. } \description{ -Combine list of calls by specific operator +Combine list of calls by specific operator. } \examples{ # use non-exported function from teal.transform From 697c23a2c6238d33d074e99b8ccc399519b44910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:11:11 +0100 Subject: [PATCH 21/62] files 3-5/30: Title case, return params, full stop params/descr/details/return --- R/check_selector.R | 35 ++++++++------ R/choices_labeled.R | 83 ++++++++++++++++++++-------------- R/choices_selected.R | 77 +++++++++++++++++-------------- man/add_no_selected_choices.Rd | 7 ++- man/choices_labeled.Rd | 19 ++++---- man/choices_selected.Rd | 27 ++++++----- man/no_selected_as_NULL.Rd | 4 +- man/value_choices.Rd | 9 ++-- man/variable_choices.Rd | 19 ++++---- 9 files changed, 162 insertions(+), 118 deletions(-) diff --git a/R/check_selector.R b/R/check_selector.R index 53de6540..3747bb9f 100644 --- a/R/check_selector.R +++ b/R/check_selector.R @@ -1,8 +1,9 @@ #' Check selector `dataname` element #' -#' @param dataname selector element +#' @param dataname (`character(1)`) selector element. #' -#' @return error or nothing +#' @return Raises an error when check fails, otherwise, it returns the `dataname` +#' parameter, invisibly and unchanged. #' #' @noRd check_selector_dataname <- function(dataname) { @@ -11,9 +12,9 @@ check_selector_dataname <- function(dataname) { #' Check selector filters element #' -#' @param filters selector element generated by `data_extract_srv` +#' @param filters (`list`) selector element generated by `data_extract_srv`. #' -#' @return error or nothing +#' @return Raises and error when check fails, otherwise it returns `NULL`, invisibly. #' #' @noRd check_selector_filters <- function(filters) { @@ -32,9 +33,10 @@ check_selector_filters <- function(filters) { #' Check selector select element #' -#' @param select selector element generated by `data_extract_srv` +#' @param select (`character`) selector element generated by `data_extract_srv`. #' -#' @return error or nothing +#' @return Raises an error when check fails, otherwise, it returns the `select` +#' parameter, invisibly and unchanged. #' #' @noRd check_selector_select <- function(select) { @@ -43,9 +45,10 @@ check_selector_select <- function(select) { #' Check selector keys element #' -#' @param keys selector element generated by `data_extract_srv` +#' @param keys (`character`) selector element generated by `data_extract_srv`. #' -#' @return error or nothing +#' @return Raises an error when check fails, otherwise, it returns the `keys` +#' parameter, invisibly and unchanged. #' #' @noRd check_selector_keys <- function(keys) { @@ -54,9 +57,10 @@ check_selector_keys <- function(keys) { #' Check selector reshape element #' -#' @param reshape selector element generated by `data_extract_srv` +#' @param reshape (`logical(1)`) selector element generated by `data_extract_srv`. #' -#' @return error or nothing +#' @return Raises an error when check fails, otherwise, it returns the `reshape` +#' parameter, invisibly and unchanged. #' #' @noRd check_selector_reshape <- function(reshape) { @@ -65,9 +69,10 @@ check_selector_reshape <- function(reshape) { #' Check selector internal_id element #' -#' @param internal_id selector element generated by `data_extract_srv` +#' @param internal_id (`character(1)`) selector element generated by `data_extract_srv`. #' -#' @return error or nothing +#' @return Raises an error when check fails, otherwise, it returns the `internal_id` +#' parameter, invisibly and unchanged. #' #' @noRd check_selector_internal_id <- function(internal_id) { @@ -76,9 +81,10 @@ check_selector_internal_id <- function(internal_id) { #' Check selector #' -#' @param selector (`list`) of selector elements generated by `data_extract_srv` +#' @param selector (`list`) of selector elements generated by `data_extract_srv`. #' -#' @return error or nothing +#' @return Raises an error when check fails, otherwise, it returns the `selector` +#' parameter, invisibly and unchanged. #' #' @noRd check_selector <- function(selector) { @@ -100,4 +106,5 @@ check_selector <- function(selector) { }, error = function(e) shiny::validate(e$message) ) + invisible(selector) } diff --git a/R/choices_labeled.R b/R/choices_labeled.R index 45aff8e5..8172a0fe 100644 --- a/R/choices_labeled.R +++ b/R/choices_labeled.R @@ -1,23 +1,23 @@ -#' Set "`: