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 "`:`" type of Names
+#' Set "`:`" type of names
+#'
+#' @description
+#' `r lifecycle::badge("stable")`
#'
-#' @description `r lifecycle::badge("stable")`
#' This is often useful for [choices_selected] as it marks up the drop-down boxes
#' for [shiny::selectInput()].
#'
#' @param choices A character / factor / numeric / logical vector.
-#' @param labels character vector containing labels to be applied to `choices`. If `NA` then
-#' "Label Missing" will be used.
-#' @param subset a vector that is a subset of `choices`. This is useful if
-#' only a few variables need to be named. If this argument is used, the returned vector will
-#' match its order.
+#' @param labels character vector containing labels to be applied to `choices`.
+#' If `NA` then "Label Missing" will be used.
+#' @param subset a vector that is a subset of `choices`.
+#' This is useful if only a few variables need to be named.
+#' If this argument is used, the returned vector will match its order.
#' @param types Character vector containing the types of the columns to be used for applying the appropriate
-#' icons to the [choices_selected] drop down box. (e.g. "numeric")
+#' icons to the [choices_selected] drop down box (e.g. "numeric").
#' @details If either `choices` or `labels` are factors, they are coerced to character.
#' Duplicated elements from `choices` get removed.
#'
-#' @return a named character vector
-#'
-#' @export
+#' @return Named `character` vector.
#'
#' @examples
#' library(shiny)
@@ -56,6 +56,8 @@
#' if (interactive()) {
#' shinyApp(ui = ui, server = function(input, output) {})
#' }
+#' @export
+#'
choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
if (is.factor(choices)) {
choices <- as.character(choices)
@@ -114,31 +116,32 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
return(choices)
}
-
#' Wrapper on [choices_labeled] to label variables basing on existing labels in data
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
-#' @param data (`data.frame`, `character`)
-#' If `data.frame`, then data to extract labels from
-#' If `character`, then name of the dataset to extract data from once available
+#'
+#' @rdname variable_choices
+#'
+#' @param data (`data.frame` or `character`)
+#' If `data.frame`, then data to extract labels from.
+#' If `character`, then name of the dataset to extract data from once available.
#' @param subset (`character` or `function`)
#' If `character`, then a vector of column names.
#' If `function`, then this function is used to determine the possible columns (e.g. all factor columns).
#' In this case, the function must take only single argument "data" and return a character vector.
+#'
#' See examples for more details.
#' @param key (`character`) vector with names of the variables, which are part of the primary key
-#' of the `data` argument. This is an optional argument, which allows to identify variables
-#' associated with the primary key and display the appropriate icon for them in the
-#' [teal.widgets::optionalSelectInput()] widget.
-#' @param fill (`logical(1)`) if `TRUE`, the function will return variable names for columns with non-existent labels;
-#' otherwise will return `NA` for them
+#' of the `data` argument.
#'
-#' @return named character vector with additional attributes or `delayed_data` object
-#'
-#' @rdname variable_choices
+#' This is an optional argument, which allows to identify variables associated
+#' with the primary key and display the appropriate icon for them in the
+#' [teal.widgets::optionalSelectInput()] widget.
+#' @param fill (`logical(1)`) if `TRUE`, the function will return variable names
+#' for columns with non-existent labels; otherwise will return `NA` for them.
#'
-#' @export
+#' @return Named `character` vector with additional attributes or `delayed_data` object.
#'
#' @examples
#' ADRS <- teal.transform::rADRS
@@ -159,6 +162,8 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
#' idx <- vapply(data, is.factor, logical(1))
#' return(names(data)[idx])
#' })
+#' @export
+#'
variable_choices <- function(data, subset = NULL, fill = FALSE, key = NULL) {
checkmate::assert(
checkmate::check_character(subset, null.ok = TRUE, any.missing = FALSE),
@@ -234,25 +239,24 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
#' Wrapper on [choices_labeled] to label variable values basing on other variable values
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
+#'
+#' @rdname value_choices
#'
#' @param data (`data.frame`, `character`)
#' If `data.frame`, then data to extract labels from.
#' If `character`, then name of the dataset to extract data from once available.
-#' @param var_choices (`character` or `NULL`) vector with choices column names
-#' @param var_label (`character`) vector with labels column names
+#' @param var_choices (`character` or `NULL`) vector with choices column names.
+#' @param var_label (`character`) vector with labels column names.
#' @param subset (`character` or `function`)
#' If `character`, vector with values to subset.
#' If `function`, then this function is used to determine the possible columns (e.g. all factor columns).
#' In this case, the function must take only single argument "data" and return a character vector.
-#' See examples for more details.
-#' @param sep (`character`) separator used in case of multiple column names
#'
-#' @return named character vector or `delayed_data` object
-#'
-#' @rdname value_choices
+#' See examples for more details.
+#' @param sep (`character`) separator used in case of multiple column names.
#'
-#' @export
+#' @return named character vector or `delayed_data` object.
#'
#' @examples
#' ADRS <- teal.transform::rADRS
@@ -270,6 +274,8 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
#' value_choices(ADRS, "PARAMCD", "PARAM", subset = function(data) {
#' return(levels(data$PARAMCD)[1:2])
#' })
+#' @export
+#'
value_choices <- function(data,
var_choices,
var_label = NULL,
@@ -367,11 +373,18 @@ value_choices.data.frame <- function(data, # nolint
}
#' Print choices_labeled object
-#' @description `r lifecycle::badge("stable")`
+#'
+#' `r lifecycle::badge("stable")`
+#'
#' @rdname choices_labeled
+#'
#' @param x an object used to select a method.
#' @param ... further arguments passed to or from other methods.
+#'
+#' @return `x`, invisibly.
+#'
#' @export
+#'
print.choices_labeled <- function(x, ...) {
cat(
sprintf("number of choices: %s \n", length(x)),
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 08b062ca..6430abbb 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -1,14 +1,27 @@
no_select_keyword <- "-- no selection --"
-#' Choices Selected
+#' Choices selected
#'
-#' @description `r lifecycle::badge("stable")`
-#' Construct a single list containing available choices, the default selected value, and
-#' additional settings such as to order the choices with the selected elements appearing first
-#' or whether to block the user from making selections. Can be used in `ui` input elements
-#' such as [teal.widgets::optionalSelectInput()]
+#' @description
+#' `r lifecycle::badge("stable")`
#'
-#' @param choices (`character`) vector of possible choices or `delayed_data` object
+#' Construct a single list containing available choices, the default selected value, and
+#' additional settings such as to order the choices with the selected elements appearing first
+#' or whether to block the user from making selections.
+#'
+#' Can be used in `ui` input elements such as [teal.widgets::optionalSelectInput()].
+#'
+#' @details
+#' Please note that the order of selected will always follow the order of choices. The `keep_order`
+#' argument is set to false which will run the following code inside:
+#'
+#' ```
+#' choices <- c(selected, setdiff(choices, selected))
+#' ```
+#'
+#' In case you want to keep your specific order of choices, set `keep_order` to `TRUE`.
+#'
+#' @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
@@ -17,27 +30,14 @@ no_select_keyword <- "-- no selection --"
#' 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
-#'
-#' Please note that the order of selected will always follow the order of choices. The `keep_order`
-#' argument is set to false which will run the following code inside:
-#'
-#' `choices <- c(selected, setdiff(choices, selected))`
-#'
-#' in case you want to keep your specific order of choices, set `keep_order` to `TRUE`.
+#' @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.
#'
#' @return Object of class `choices_selected` and of type list which contains the specified
-#' `choices`, `selected`, `keep_order` and `fixed`.
-#'
-#' @export
+#' `choices`, `selected`, `keep_order` and `fixed`.
#'
#' @examples
-#'
#' library(shiny)
#'
#' # all_choices example - semantically the same objects
@@ -121,6 +121,8 @@ no_select_keyword <- "-- no selection --"
#' if (interactive()) {
#' shinyApp(ui, server = function(input, output, session) {})
#' }
+#' @export
+#'
choices_selected <- function(choices,
selected = if (inherits(choices, "delayed_data")) NULL else choices[1],
keep_order = FALSE,
@@ -171,25 +173,33 @@ choices_selected <- function(choices,
)
}
-#' Check if an object is a choices_selected class.
+#' Check if an object is a choices_selected class
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
-#' @param x object to check
#' @rdname choices_selected
+#'
+#' @param x (`choices_selected`) object to check.
+#'
+#' @return `TRUE` if `x` inherits from a `choices_selected` object, `FALSE` otherwise.
+#'
#' @export
+#'
is.choices_selected <- function(x) { # nolint
inherits(x, "choices_selected")
}
#' Add empty choice to choices selected
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
-#' @param x (`choices_selected`) output
-#' @param multiple (`logical`) whether multiple selections are allowed or not
+#' @param x (`choices_selected`) object.
+#' @param multiple (`logical(1)`) whether multiple selections are allowed or not.
+#'
+#' @return `choices_selected` object with an empty option added to the choices.
#'
#' @export
+#'
add_no_selected_choices <- function(x, multiple = FALSE) {
if (is.null(x)) {
choices_selected(NULL)
@@ -207,13 +217,14 @@ add_no_selected_choices <- function(x, multiple = FALSE) {
#' Check select choices for no choice made
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
-#' @param x (`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
if (is.null(x) || identical(x, no_select_keyword) || x == "") {
NULL
diff --git a/man/add_no_selected_choices.Rd b/man/add_no_selected_choices.Rd
index 18839676..ee588d43 100644
--- a/man/add_no_selected_choices.Rd
+++ b/man/add_no_selected_choices.Rd
@@ -7,9 +7,12 @@
add_no_selected_choices(x, multiple = FALSE)
}
\arguments{
-\item{x}{(\code{choices_selected}) output}
+\item{x}{(\code{choices_selected}) object.}
-\item{multiple}{(\code{logical}) whether multiple selections are allowed or not}
+\item{multiple}{(\code{logical(1)}) whether multiple selections are allowed or not.}
+}
+\value{
+\code{choices_selected} object with an empty option added to the choices.
}
\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/choices_labeled.Rd b/man/choices_labeled.Rd
index 6e592626..a59065f3 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -3,7 +3,7 @@
\name{choices_labeled}
\alias{choices_labeled}
\alias{print.choices_labeled}
-\title{Set "\verb{:}" type of Names}
+\title{Set "\verb{:}" type of names}
\usage{
choices_labeled(choices, labels, subset = NULL, types = NULL)
@@ -12,25 +12,28 @@ choices_labeled(choices, labels, subset = NULL, types = NULL)
\arguments{
\item{choices}{A character / factor / numeric / logical vector.}
-\item{labels}{character vector containing labels to be applied to \code{choices}. If \code{NA} then
-"Label Missing" will be used.}
+\item{labels}{character vector containing labels to be applied to \code{choices}.
+If \code{NA} then "Label Missing" will be used.}
-\item{subset}{a vector that is a subset of \code{choices}. This is useful if
-only a few variables need to be named. If this argument is used, the returned vector will
-match its order.}
+\item{subset}{a vector that is a subset of \code{choices}.
+This is useful if only a few variables need to be named.
+If this argument is used, the returned vector will match its order.}
\item{types}{Character vector containing the types of the columns to be used for applying the appropriate
-icons to the \link{choices_selected} drop down box. (e.g. "numeric")}
+icons to the \link{choices_selected} drop down box (e.g. "numeric").}
\item{x}{an object used to select a method.}
\item{...}{further arguments passed to or from other methods.}
}
\value{
-a named character vector
+Named \code{character} vector.
+
+\code{x}, invisibly.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
+
This is often useful for \link{choices_selected} as it marks up the drop-down boxes
for \code{\link[shiny:selectInput]{shiny::selectInput()}}.
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index 7887d87e..1a993fc3 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -3,7 +3,7 @@
\name{choices_selected}
\alias{choices_selected}
\alias{is.choices_selected}
-\title{Choices Selected}
+\title{Choices selected}
\usage{
choices_selected(
choices,
@@ -15,7 +15,7 @@ choices_selected(
is.choices_selected(x)
}
\arguments{
-\item{choices}{(\code{character}) vector of possible choices or \code{delayed_data} object
+\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()}}.}
@@ -26,24 +26,27 @@ If \code{delayed_data} object then \code{choices} must also be \code{delayed_dat
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})
-In case of \code{FALSE} the selected variables will be on top of the drop-down field.}
+\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})
-Whether to block user to select choices}
+\item{fixed}{(optional \code{logical}) Whether to block user to select choices.}
-\item{x}{object to check}
+\item{x}{(\code{choices_selected}) object to check.}
}
\value{
Object of class \code{choices_selected} and of type list which contains the specified
\code{choices}, \code{selected}, \code{keep_order} and \code{fixed}.
+
+\code{TRUE} if \code{x} inherits from a \code{choices_selected} object, \code{FALSE} otherwise.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
+
Construct a single list containing available choices, the default selected value, and
additional settings such as to order the choices with the selected elements appearing first
-or whether to block the user from making selections. Can be used in \code{ui} input elements
-such as \code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}}
+or whether to block the user from making selections.
+
+Can be used in \code{ui} input elements such as \code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}}.
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
@@ -51,12 +54,12 @@ such as \code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSele
Please note that the order of selected will always follow the order of choices. The \code{keep_order}
argument is set to false which will run the following code inside:
-\code{choices <- c(selected, setdiff(choices, selected))}
+\if{html}{\out{}}\preformatted{choices <- c(selected, setdiff(choices, selected))
+}\if{html}{\out{
}}
-in case you want to keep your specific order of choices, set \code{keep_order} to \code{TRUE}.
+In case you want to keep your specific order of choices, set \code{keep_order} to \code{TRUE}.
}
\examples{
-
library(shiny)
# all_choices example - semantically the same objects
diff --git a/man/no_selected_as_NULL.Rd b/man/no_selected_as_NULL.Rd
index 75a714ca..780a578b 100644
--- a/man/no_selected_as_NULL.Rd
+++ b/man/no_selected_as_NULL.Rd
@@ -7,10 +7,10 @@
no_selected_as_NULL(x)
}
\arguments{
-\item{x}{(\code{character}) Word that shall be checked for \code{NULL}, empty, "--no-selection"}
+\item{x}{(\code{character}) Word that shall be checked for \code{NULL}, empty, "--no-selection".}
}
\value{
-the word or \code{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]}}
diff --git a/man/value_choices.Rd b/man/value_choices.Rd
index aa48f870..36ec7dee 100644
--- a/man/value_choices.Rd
+++ b/man/value_choices.Rd
@@ -17,20 +17,21 @@ value_choices(data, var_choices, var_label = NULL, subset = NULL, sep = " - ")
If \code{data.frame}, then data to extract labels from.
If \code{character}, then name of the dataset to extract data from once available.}
-\item{var_choices}{(\code{character} or \code{NULL}) vector with choices column names}
+\item{var_choices}{(\code{character} or \code{NULL}) vector with choices column names.}
-\item{var_label}{(\code{character}) vector with labels column names}
+\item{var_label}{(\code{character}) vector with labels column names.}
\item{subset}{(\code{character} or \code{function})
If \code{character}, vector with values to subset.
If \code{function}, then this function is used to determine the possible columns (e.g. all factor columns).
In this case, the function must take only single argument "data" and return a character vector.
+
See examples for more details.}
-\item{sep}{(\code{character}) separator used in case of multiple column names}
+\item{sep}{(\code{character}) separator used in case of multiple column names.}
}
\value{
-named character vector or \code{delayed_data} object
+named character vector or \code{delayed_data} object.
}
\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/variable_choices.Rd b/man/variable_choices.Rd
index fb738701..66b45e35 100644
--- a/man/variable_choices.Rd
+++ b/man/variable_choices.Rd
@@ -13,26 +13,29 @@ variable_choices(data, subset = NULL, fill = FALSE, key = NULL)
\method{variable_choices}{data.frame}(data, subset = NULL, fill = TRUE, key = NULL)
}
\arguments{
-\item{data}{(\code{data.frame}, \code{character})
-If \code{data.frame}, then data to extract labels from
-If \code{character}, then name of the dataset to extract data from once available}
+\item{data}{(\code{data.frame} or \code{character})
+If \code{data.frame}, then data to extract labels from.
+If \code{character}, then name of the dataset to extract data from once available.}
\item{subset}{(\code{character} or \code{function})
If \code{character}, then a vector of column names.
If \code{function}, then this function is used to determine the possible columns (e.g. all factor columns).
In this case, the function must take only single argument "data" and return a character vector.
+
See examples for more details.}
-\item{fill}{(\code{logical(1)}) if \code{TRUE}, the function will return variable names for columns with non-existent labels;
-otherwise will return \code{NA} for them}
+\item{fill}{(\code{logical(1)}) if \code{TRUE}, the function will return variable names
+for columns with non-existent labels; otherwise will return \code{NA} for them.}
\item{key}{(\code{character}) vector with names of the variables, which are part of the primary key
-of the \code{data} argument. This is an optional argument, which allows to identify variables
-associated with the primary key and display the appropriate icon for them in the
+of the \code{data} argument.
+
+This is an optional argument, which allows to identify variables associated
+with the primary key and display the appropriate icon for them in the
\code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}} widget.}
}
\value{
-named character vector with additional attributes or \code{delayed_data} object
+Named \code{character} vector with additional attributes or \code{delayed_data} object.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
From 5daa54d616d469a1cb79041943fe3e257860e78b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Thu, 8 Feb 2024 09:14:47 +0100
Subject: [PATCH 22/62] files 6-9/30: Title case, return params, full stop
params/descr/details/return
---
R/column_functions.R | 8 +-
R/data_extract_datanames.R | 26 +++--
R/data_extract_filter_module.R | 26 +++--
R/data_extract_module.R | 152 ++++++++++++++++----------
inst/WORDLIST | 7 +-
man/check_data_extract_spec_react.Rd | 6 +-
man/cond_data_extract_single_ui.Rd | 9 +-
man/data_extract_filter_srv.Rd | 15 ++-
man/data_extract_filter_ui.Rd | 6 +-
man/data_extract_multiple_srv.Rd | 24 ++--
man/data_extract_read_srv.Rd | 2 +-
man/data_extract_single_srv.Rd | 2 +-
man/data_extract_srv.Rd | 9 +-
man/data_extract_ui.Rd | 22 ++--
man/datanames_input.Rd | 11 +-
man/get_dataset_prefixed_col_names.Rd | 4 +-
man/get_extract_datanames.Rd | 5 +-
man/get_initial_filter_values.Rd | 10 +-
man/is_single_dataset.Rd | 7 +-
19 files changed, 215 insertions(+), 136 deletions(-)
diff --git a/R/column_functions.R b/R/column_functions.R
index 2f6df03e..dea93438 100644
--- a/R/column_functions.R
+++ b/R/column_functions.R
@@ -1,14 +1,16 @@
#' Returns non-key column names from data
#'
#' @description `r lifecycle::badge("stable")`
-#' @export
#'
#' @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()].
+#' created by [data_extract_srv()], which returns a shiny [shiny::reactive()].
#'
-#' @return A named character vector with the non-key columns of the `data`.
+#' @return A named `character` vector with the non-key columns of the `data`.
#'
#' @references [data_extract_srv()]
+#'
+#' @export
+#'
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 c5394950..64437081 100644
--- a/R/data_extract_datanames.R
+++ b/R/data_extract_datanames.R
@@ -1,14 +1,17 @@
-#' Available datasets input
+#' Help text with available datasets input
#'
#' @description
#' `r lifecycle::badge("stable")`
#'
-#' Creates \link[shiny]{helpText} with the names of datasets
-#' available for current module.
+#' Creates [shiny::helpText()] with the names of available datasets for the
+#' current module.
#'
-#' @param data_extracts list of data extracts for single variable
+#' @param data_extracts (`list`) of data extracts for single variable.
+#'
+#' @return [shiny::helpText()] object.
#'
#' @export
+#'
datanames_input <- function(data_extracts) {
datanames <- get_extract_datanames(data_extracts)
helpText(
@@ -26,9 +29,12 @@ datanames_input <- function(data_extracts) {
#' `data_extract_spec` and returns the unique `dataname` set.
#'
#' @param data_extracts A single `data_extract_spec` object or a list (of lists)
-#' of `data_extract_spec`
+#' of `data_extract_spec`.
+#'
+#' @return A character vector with the unique `dataname` set.
#'
#' @export
+#'
get_extract_datanames <- function(data_extracts) {
data_extracts <- if (inherits(data_extracts, "data_extract_spec")) {
list(data_extracts)
@@ -62,14 +68,16 @@ get_extract_datanames <- function(data_extracts) {
#'
#' `r lifecycle::badge("stable")`
#'
-#' @param ... either `data_extract_spec` objects or lists of `data_extract_spec` objects that do not contain
-#' NULL
+#' @param ... either `data_extract_spec` objects or lists of `data_extract_spec`
+#' objects that do not contain `NULL`
#'
-#' @return logical
+#' @return `TRUE` if all `data_extract_spec` objects come from the same dataset,
+#' `FALSE` otherwise.
#'
#' @export
+#'
is_single_dataset <- function(...) {
data_extract_spec <- list(...)
dataset_names <- get_extract_datanames(data_extract_spec)
- return(length(dataset_names) == 1)
+ length(dataset_names) == 1
}
diff --git a/R/data_extract_filter_module.R b/R/data_extract_filter_module.R
index 774afd8d..f1abf7a5 100644
--- a/R/data_extract_filter_module.R
+++ b/R/data_extract_filter_module.R
@@ -3,10 +3,11 @@
#' @details Creates two `optionSelectInput` elements (one for column and one for values) based
#' on a definition of a [filter_spec()] object.
#'
-#' @param filter (`filter_spec`) the object generated with [filter_spec()]
-#' @param id (`character(1)`) the shiny `inputId` for the generated `shiny.tag`
+#' @param filter (`filter_spec`) the object generated with [filter_spec()].
+#' @param id (`character(1)`) the shiny `inputId` for the generated `shiny.tag`.
+#'
+#' @return `shiny.tag` defining the `filter_spec`'s UI element.
#'
-#' @return `shiny.tag` defining the `filter_spec`'s UI element
#' @examples
#' # use non-exported function from teal.transform
#' data_extract_filter_ui <- getFromNamespace("data_extract_filter_ui", "teal.transform")
@@ -45,16 +46,19 @@ data_extract_filter_ui <- function(filter, id = "filter") {
)
}
-#' Handles events emitted from the UI generated by `data_extract_filter_ui`.
+#' Handles events emitted from the UI generated by `data_extract_filter_ui`
#'
#' @note This shiny module server updates the values of the `vals`
-#' [teal.widgets::optionalSelectInput()] widget. It's responsible
-#' for setting the initial values and the subsequent updates to
+#' [teal.widgets::optionalSelectInput()] widget.
+#' It's responsible for setting the initial values and the subsequent updates to
#' the `vals` widget based on the input of the `col` widget.
#'
-#' @param id (`character`) id string
+#' @param id (`character`) id string.
#' @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()]
+#' @param filter (`filter_spec`) the filter generated by a call to [filter_spec()].
+#'
+#' @return `NULL`, invisibly.
+#'
#' @keywords internal
#'
data_extract_filter_srv <- function(id, datasets, filter) {
@@ -131,11 +135,11 @@ data_extract_filter_srv <- function(id, datasets, filter) {
)
}
-#' Returns the initial values for the `vals` widget
-#' of a `filter_spec` object.
+#' Returns the initial values for the `vals` widget of a `filter_spec` object
#'
#' @inheritParams data_extract_filter_srv
-#' @return `named list` with two slots `choices` and `selected`
+#'
+#' @return named `list` with two slots `choices` and `selected`.
#'
#' @examples
#' # use non-exported function from teal.transform
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index dfaf14a5..76bbb5e4 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -1,24 +1,37 @@
+#' Check data extract spec
+#'
+#' @param data_extract_spec (`list`) of `data_extract_spec`.
+#'
+#' @return Raises an error when check fails, otherwise, it returns the `data_extract_spec`
+#' parameter, invisibly and unchanged.
+#'
+#' @noRd
check_data_extract_spec <- function(data_extract_spec) {
- if (is.null(data_extract_spec)) {
- return()
- }
- checkmate::assert_list(data_extract_spec, types = "data_extract_spec")
+ checkmate::assert_list(data_extract_spec, types = "data_extract_spec", null.ok = TRUE)
}
+#' Generate id for dataset
+#'
+#' @param dataname (`character(1)`) the name of the dataset.
+#'
+#' @return `character(1)`.
+#'
+#' @noRd
id_for_dataset <- function(dataname) {
paste0("dataset_", dataname, "_singleextract")
}
-#'
#' Creates a panel that displays (with filter and column selection)
-#' conditionally on `input[ns("dataset")] == dataname`.
+#' conditionally on `input[ns("dataset")] == dataname`
#'
-#' @param ns (`function`) the shiny namespace function
+#' @param ns (`function`) the shiny namespace function.
#' @param single_data_extract_spec (`data_extract_spec`) the specification
-#' for extraction of data during the application initialization.
-#' Generated by [data_extract_spec()].
+#' for extraction of data during the application initialization.
+#'
+#' Generated by [data_extract_spec()].
+#'
+#' @return `shiny.tag` with the HTML code for the panel.
#'
-#' @return (`shiny.tag`) the Shiny tag with the HTML code for the panel
#' @examples
#' # use non-exported function from teal.transform
#' cond_data_extract_single_ui <- getFromNamespace("cond_data_extract_single_ui", "teal.transform")
@@ -42,23 +55,10 @@ 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()].
-#'
-#' @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.
-#' @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.
+#' @description
+#' `r lifecycle::badge("experimental")`
#'
+#' @details
#' There are three inputs that will be rendered
#'
#' 1. Dataset select Optional. If more than one [data_extract_spec] is handed over
@@ -72,6 +72,24 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) {
#'
#' The output can be analyzed using `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.
+#' @param data_extract_spec (`list` of `data_extract_spec`)
+#' 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.
+#'
#' @examples
#' library(shiny)
#'
@@ -108,6 +126,7 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) {
#' )
#'
#' @export
+#'
data_extract_ui <- function(id, label, data_extract_spec, is_single_dataset = FALSE) {
ns <- NS(id)
@@ -188,10 +207,11 @@ data_extract_ui <- function(id, label, data_extract_spec, is_single_dataset = FA
#' Checks if selected or filter columns exist within the datasets. Throws a `shiny`
#' validation error if the above requirements are not met.
#'
-#' @param datasets (`FilteredData`) the object created using the `teal` API
-#' @param data_extract (`list`) the output of the `data_extract` module
+#' @param datasets (`FilteredData`) the object created using the `teal` API.
+#' @param data_extract (`list`) the output of the `data_extract` module.
+#'
+#' @return `NULL`.
#'
-#' @return `NULL`
#' @keywords internal
#'
check_data_extract_spec_react <- function(datasets, data_extract) {
@@ -246,7 +266,8 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' Extraction of the selector(s) details
#'
-#' @description `r lifecycle::badge("stable")`
+#' @description
+#' `r lifecycle::badge("stable")`
#'
#' Extracting details of the selection(s) in [data_extract_ui] elements.
#'
@@ -257,8 +278,7 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' 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`.
+#' @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:
@@ -270,12 +290,10 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' * `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`
+#' * `iv`: A `shinyvalidate::InputValidator` containing `validator` for this `data_extract`.
#'
#' @references [data_extract_srv]
#'
-#' @export
-#'
#' @examples
#'
#' library(shiny)
@@ -375,6 +393,8 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
+#' @export
+#'
data_extract_srv <- function(id, datasets, data_extract_spec, ...) {
checkmate::assert_multi_class(datasets, c("FilteredData", "list"))
checkmate::assert(
@@ -386,6 +406,7 @@ data_extract_srv <- function(id, datasets, data_extract_spec, ...) {
#' @rdname data_extract_srv
#' @export
+#'
data_extract_srv.FilteredData <- function(id, datasets, data_extract_spec, ...) {
checkmate::assert_class(datasets, "FilteredData")
moduleServer(
@@ -413,18 +434,23 @@ data_extract_srv.FilteredData <- function(id, datasets, data_extract_spec, ...)
}
#' @rdname data_extract_srv
-#' @param join_keys (`join_keys` or `NULL`) of keys per dataset in `datasets`
+#'
+#' @param join_keys (`join_keys` or `NULL`) of keys per dataset in `datasets`.
#' @param select_validation_rule (`NULL` or `function`)
-#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`.
-#' You can use a validation function directly (i.e. `select_validation_rule = shinyvalidate::sv_required()`)
-#' or for more fine-grained control use a function:
-#' `select_validation_rule = ~ if (length(.) > 2) "Error"`.
-#' If `NULL` then no validation will be added. See example for more details.
+#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`.
+#'
+#' You can use a validation function directly (i.e. `select_validation_rule = shinyvalidate::sv_required()`)
+#' or for more fine-grained control use a function:
+#'
+#' `select_validation_rule = ~ if (length(.) > 2) "Error"`.
+#'
+#' If `NULL` then no validation will be added. See example for more details.
#' @param filter_validation_rule (`NULL` or `function`) Same as
-#' `select_validation_rule` but for the filter (values) part of the `data_extract_ui`.
+#' `select_validation_rule` but for the filter (values) part of the `data_extract_ui`.
#' @param dataset_validation_rule (`NULL` or `function`) Same as
-#' `select_validation_rule` but for the choose dataset part of the `data_extract_ui`
+#' `select_validation_rule` but for the choose dataset part of the `data_extract_ui`
#' @export
+#'
data_extract_srv.list <- function(id, datasets, data_extract_spec, join_keys = NULL,
select_validation_rule = NULL,
filter_validation_rule = NULL,
@@ -540,19 +566,20 @@ data_extract_srv.list <- function(id, datasets, data_extract_spec, join_keys = N
#' Creates a named list of `data_extract_srv` output
#'
-#' @description `r lifecycle::badge("experimental")`
+#' @description
+#' `r lifecycle::badge("experimental")`
+#'
#' `data_extract_multiple_srv` loops over the list of `data_extract` given and
#' runs `data_extract_srv` for each one returning a list of reactive objects.
#'
#' @inheritParams data_extract_srv
#' @param data_extract (named `list` of `data_extract_spec` objects) the list `data_extract_spec` objects.
-#' The names of the elements in the list need to correspond to the `ids` passed to `data_extract_ui`.
-#' See example for details.
+#' The names of the elements in the list need to correspond to the `ids` passed to `data_extract_ui`.
#'
-#' @return reactive named list containing outputs from [data_extract_srv()]. Output list
-#' names are the same as `data_extract` input argument.
+#' See example for details.
#'
-#' @export
+#' @return reactive named list containing outputs from [data_extract_srv()].
+#' Output list names are the same as `data_extract` input argument.
#'
#' @examples
#' library(shiny)
@@ -644,6 +671,8 @@ data_extract_srv.list <- function(id, datasets, data_extract_spec, join_keys = N
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
+#' @export
+#'
data_extract_multiple_srv <- function(data_extract, datasets, ...) {
checkmate::assert_list(data_extract, names = "named")
checkmate::assert_multi_class(datasets, c("reactive", "FilteredData", "list"))
@@ -657,6 +686,7 @@ data_extract_multiple_srv <- function(data_extract, datasets, ...) {
#' @rdname data_extract_multiple_srv
#' @export
+#'
data_extract_multiple_srv.reactive <- function(data_extract, datasets, ...) {
# convert reactive containing teal_data to list of reactives with one dataset each
datasets_new <- convert_teal_data(datasets)
@@ -665,6 +695,7 @@ data_extract_multiple_srv.reactive <- function(data_extract, datasets, ...) {
#' @rdname data_extract_multiple_srv
#' @export
+#'
data_extract_multiple_srv.FilteredData <- function(data_extract, datasets, ...) {
checkmate::assert_class(datasets, classes = "FilteredData")
logger::log_trace(
@@ -680,18 +711,27 @@ data_extract_multiple_srv.FilteredData <- function(data_extract, datasets, ...)
}
#' @rdname data_extract_multiple_srv
+#'
#' @param join_keys (`join_keys` or `NULL`) of join keys per dataset in `datasets`.
#' @param select_validation_rule (`NULL`, `function` or `named list` of `function`)
-#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`
-#' If all `data_extract` require the same validation function then this can be used directly (
-#' i.e. `select_validation_rule = shinyvalidate::sv_required()`). For more fine-grained control use a list:
-#' `select_validation_rule = list(extract_1 = sv_required(), extract2 = ~ if (length(.) > 2) "Error")`.
-#' If `NULL` then no validation will be added. See example for more details.
+#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`.
+#' If all `data_extract` require the same validation function then this can be used directly
+#' (i.e. `select_validation_rule = shinyvalidate::sv_required()`).
+#'
+#' For more fine-grained control use a list:
+#'
+#' `select_validation_rule = list(extract_1 = sv_required(), extract2 = ~ if (length(.) > 2) "Error")`
+#'
+#' If `NULL` then no validation will be added.
+#'
+#' See example for more details.
#' @param filter_validation_rule (`NULL`, `function` or `named list` of `function`) Same as
-#' `select_validation_rule` but for the filter (values) part of the `data_extract_ui`.
+#' `select_validation_rule` but for the filter (values) part of the `data_extract_ui`.
#' @param dataset_validation_rule (`NULL`, `function` or `named list` of `function`) Same as
-#' `select_validation_rule` but for the choose dataset part of the `data_extract_ui`
+#' `select_validation_rule` but for the choose dataset part of the `data_extract_ui`
+#'
#' @export
+#'
data_extract_multiple_srv.list <- function(data_extract, datasets, join_keys = NULL,
select_validation_rule = NULL,
filter_validation_rule = NULL,
diff --git a/inst/WORDLIST b/inst/WORDLIST
index 5a531fcb..522f2970 100644
--- a/inst/WORDLIST
+++ b/inst/WORDLIST
@@ -1,8 +1,9 @@
-Forkers
-Hoffmann
-UI
+CDISC
cloneable
+Forkers
funder
+Hoffmann
preselected
repo
reproducibility
+UI
diff --git a/man/check_data_extract_spec_react.Rd b/man/check_data_extract_spec_react.Rd
index bf7cd0de..6438936c 100644
--- a/man/check_data_extract_spec_react.Rd
+++ b/man/check_data_extract_spec_react.Rd
@@ -7,12 +7,12 @@
check_data_extract_spec_react(datasets, data_extract)
}
\arguments{
-\item{datasets}{(\code{FilteredData}) the object created using the \code{teal} API}
+\item{datasets}{(\code{FilteredData}) the object created using the \code{teal} API.}
-\item{data_extract}{(\code{list}) the output of the \code{data_extract} module}
+\item{data_extract}{(\code{list}) the output of the \code{data_extract} module.}
}
\value{
-\code{NULL}
+\code{NULL}.
}
\description{
Checks if \code{dataname} argument exists as a dataset.
diff --git a/man/cond_data_extract_single_ui.Rd b/man/cond_data_extract_single_ui.Rd
index e99c074c..8d53ed16 100644
--- a/man/cond_data_extract_single_ui.Rd
+++ b/man/cond_data_extract_single_ui.Rd
@@ -3,23 +3,24 @@
\name{cond_data_extract_single_ui}
\alias{cond_data_extract_single_ui}
\title{Creates a panel that displays (with filter and column selection)
-conditionally on \code{input[ns("dataset")] == dataname}.}
+conditionally on \code{input[ns("dataset")] == dataname}}
\usage{
cond_data_extract_single_ui(ns, single_data_extract_spec)
}
\arguments{
-\item{ns}{(\code{function}) the shiny namespace function}
+\item{ns}{(\code{function}) the shiny namespace function.}
\item{single_data_extract_spec}{(\code{data_extract_spec}) the specification
for extraction of data during the application initialization.
+
Generated by \code{\link[=data_extract_spec]{data_extract_spec()}}.}
}
\value{
-(\code{shiny.tag}) the Shiny tag with the HTML code for the panel
+\code{shiny.tag} with the HTML code for the panel.
}
\description{
Creates a panel that displays (with filter and column selection)
-conditionally on \code{input[ns("dataset")] == dataname}.
+conditionally on \code{input[ns("dataset")] == dataname}
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/data_extract_filter_srv.Rd b/man/data_extract_filter_srv.Rd
index 43437360..67f56f7e 100644
--- a/man/data_extract_filter_srv.Rd
+++ b/man/data_extract_filter_srv.Rd
@@ -2,24 +2,27 @@
% Please edit documentation in R/data_extract_filter_module.R
\name{data_extract_filter_srv}
\alias{data_extract_filter_srv}
-\title{Handles events emitted from the UI generated by \code{data_extract_filter_ui}.}
+\title{Handles events emitted from the UI generated by \code{data_extract_filter_ui}}
\usage{
data_extract_filter_srv(id, datasets, filter)
}
\arguments{
-\item{id}{(\code{character}) id string}
+\item{id}{(\code{character}) id string.}
\item{datasets}{(\verb{named list}) a list of reactive \code{data.frame} type objects.}
-\item{filter}{(\code{filter_spec}) the filter generated by a call to \code{\link[=filter_spec]{filter_spec()}}}
+\item{filter}{(\code{filter_spec}) the filter generated by a call to \code{\link[=filter_spec]{filter_spec()}}.}
+}
+\value{
+\code{NULL}, invisibly.
}
\description{
-Handles events emitted from the UI generated by \code{data_extract_filter_ui}.
+Handles events emitted from the UI generated by \code{data_extract_filter_ui}
}
\note{
This shiny module server updates the values of the \code{vals}
-\code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}} widget. It's responsible
-for setting the initial values and the subsequent updates to
+\code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}} widget.
+It's responsible for setting the initial values and the subsequent updates to
the \code{vals} widget based on the input of the \code{col} widget.
}
\keyword{internal}
diff --git a/man/data_extract_filter_ui.Rd b/man/data_extract_filter_ui.Rd
index 8bda37f0..89ef6a41 100644
--- a/man/data_extract_filter_ui.Rd
+++ b/man/data_extract_filter_ui.Rd
@@ -7,12 +7,12 @@
data_extract_filter_ui(filter, id = "filter")
}
\arguments{
-\item{filter}{(\code{filter_spec}) the object generated with \code{\link[=filter_spec]{filter_spec()}}}
+\item{filter}{(\code{filter_spec}) the object generated with \code{\link[=filter_spec]{filter_spec()}}.}
-\item{id}{(\code{character(1)}) the shiny \code{inputId} for the generated \code{shiny.tag}}
+\item{id}{(\code{character(1)}) the shiny \code{inputId} for the generated \code{shiny.tag}.}
}
\value{
-\code{shiny.tag} defining the \code{filter_spec}'s UI element
+\code{shiny.tag} defining the \code{filter_spec}'s UI element.
}
\description{
Returns a \code{shiny.tag} object with the UI for a \code{filter_spec} object
diff --git a/man/data_extract_multiple_srv.Rd b/man/data_extract_multiple_srv.Rd
index d22c17d4..6fd768c3 100644
--- a/man/data_extract_multiple_srv.Rd
+++ b/man/data_extract_multiple_srv.Rd
@@ -32,6 +32,7 @@ data_extract_multiple_srv(data_extract, datasets, ...)
\arguments{
\item{data_extract}{(named \code{list} of \code{data_extract_spec} objects) the list \code{data_extract_spec} objects.
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})
@@ -39,17 +40,23 @@ object containing data either in the form of \code{FilteredData} or as a list of
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{...}{an additional argument \code{join_keys} is required when \code{datasets} is a list of \code{data.frame}.
+\item{...}{An additional argument \code{join_keys} is required when \code{datasets} is a list of \code{data.frame}.
It shall contain the keys per dataset in \code{datasets}.}
\item{join_keys}{(\code{join_keys} or \code{NULL}) of join keys per dataset in \code{datasets}.}
\item{select_validation_rule}{(\code{NULL}, \code{function} or \verb{named list} of \code{function})
-Should there be any \code{shinyvalidate} input validation of the select parts of the \code{data_extract_ui}
-If all \code{data_extract} require the same validation function then this can be used directly (
-i.e. \code{select_validation_rule = shinyvalidate::sv_required()}). For more fine-grained control use a list:
-\code{select_validation_rule = list(extract_1 = sv_required(), extract2 = ~ if (length(.) > 2) "Error")}.
-If \code{NULL} then no validation will be added. See example for more details.}
+Should there be any \code{shinyvalidate} input validation of the select parts of the \code{data_extract_ui}.
+If all \code{data_extract} require the same validation function then this can be used directly
+(i.e. \code{select_validation_rule = shinyvalidate::sv_required()}).
+
+For more fine-grained control use a list:
+
+\code{select_validation_rule = list(extract_1 = sv_required(), extract2 = ~ if (length(.) > 2) "Error")}
+
+If \code{NULL} then no validation will be added.
+
+See example for more details.}
\item{filter_validation_rule}{(\code{NULL}, \code{function} or \verb{named list} of \code{function}) Same as
\code{select_validation_rule} but for the filter (values) part of the \code{data_extract_ui}.}
@@ -58,11 +65,12 @@ If \code{NULL} then no validation will be added. See example for more details.}
\code{select_validation_rule} but for the choose dataset part of the \code{data_extract_ui}}
}
\value{
-reactive named list containing outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}. Output list
-names are the same as \code{data_extract} input argument.
+reactive named list containing outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}.
+Output list names are the same as \code{data_extract} input argument.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
+
\code{data_extract_multiple_srv} loops over the list of \code{data_extract} given and
runs \code{data_extract_srv} for each one returning a list of reactive objects.
}
diff --git a/man/data_extract_read_srv.Rd b/man/data_extract_read_srv.Rd
index 8ae69bb3..e27d7f8c 100644
--- a/man/data_extract_read_srv.Rd
+++ b/man/data_extract_read_srv.Rd
@@ -14,7 +14,7 @@ data_extract_read_srv(
)
}
\arguments{
-\item{id}{(\code{character}) id string}
+\item{id}{(\code{character}) id string.}
\item{datasets}{(\verb{named list}) a list of reactive \code{data.frame} type objects.}
diff --git a/man/data_extract_single_srv.Rd b/man/data_extract_single_srv.Rd
index bf3d2660..e77ff2ed 100644
--- a/man/data_extract_single_srv.Rd
+++ b/man/data_extract_single_srv.Rd
@@ -7,7 +7,7 @@
data_extract_single_srv(id, datasets, single_data_extract_spec)
}
\arguments{
-\item{id}{(\code{character}) id string}
+\item{id}{(\code{character}) id string.}
\item{datasets}{(\verb{named list}) a list of reactive \code{data.frame} type objects.}
diff --git a/man/data_extract_srv.Rd b/man/data_extract_srv.Rd
index ad4fcdfa..07b6f854 100644
--- a/man/data_extract_srv.Rd
+++ b/man/data_extract_srv.Rd
@@ -39,16 +39,19 @@ When passing a list of reactive or non-reactive \code{data.frame} objects, the a
\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}.
+\item{...}{An additional argument \code{join_keys} is required when \code{datasets} is a list of \code{data.frame}.
It shall contain the keys per dataset in \code{datasets}.}
-\item{join_keys}{(\code{join_keys} or \code{NULL}) of keys per dataset in \code{datasets}}
+\item{join_keys}{(\code{join_keys} or \code{NULL}) of keys per dataset in \code{datasets}.}
\item{select_validation_rule}{(\code{NULL} or \code{function})
Should there be any \code{shinyvalidate} input validation of the select parts of the \code{data_extract_ui}.
+
You can use a validation function directly (i.e. \code{select_validation_rule = shinyvalidate::sv_required()})
or for more fine-grained control use a function:
+
\code{select_validation_rule = ~ if (length(.) > 2) "Error"}.
+
If \code{NULL} then no validation will be added. See example for more details.}
\item{filter_validation_rule}{(\code{NULL} or \code{function}) Same as
@@ -67,7 +70,7 @@ A reactive \code{list} containing following fields:
\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{iv}: A \code{shinyvalidate::InputValidator} containing \code{validator} for this \code{data_extract}.
}
}
\description{
diff --git a/man/data_extract_ui.Rd b/man/data_extract_ui.Rd
index cc7a41d0..6e283f15 100644
--- a/man/data_extract_ui.Rd
+++ b/man/data_extract_ui.Rd
@@ -7,19 +7,23 @@
data_extract_ui(id, label, data_extract_spec, is_single_dataset = FALSE)
}
\arguments{
-\item{id}{(\code{character}) shiny input unique identifier}
+\item{id}{(\code{character}) shiny input unique identifier.}
-\item{label}{(\code{character}) Label above the data extract input}
+\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 \code{\link[=data_extract_spec]{data_extract_spec()}} constructor calls.}
-\item{is_single_dataset}{(\code{logical}) FALSE to display the dataset widget}
+\item{is_single_dataset}{(\code{logical}) \code{FALSE} to display the dataset widget.}
}
\value{
-shiny \link[shiny:selectInput]{shiny::selectInput}\code{s} that allow to define how to extract data from
+Shiny \code{\link[shiny:selectInput]{shiny::selectInput}}\code{s} that allow to define how to extract data from
a specific dataset. The input elements will be returned inside a \link[shiny:reexports]{shiny::div} container.
-
+}
+\description{
+\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
+}
+\details{
There are three inputs that will be rendered
\enumerate{
\item Dataset select Optional. If more than one \link{data_extract_spec} is handed over
@@ -33,13 +37,13 @@ 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 \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
+from CDISC datasets.
+
+You can use this function in the same way as any
\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()}}.
}
diff --git a/man/datanames_input.Rd b/man/datanames_input.Rd
index 4cd6e069..e2842926 100644
--- a/man/datanames_input.Rd
+++ b/man/datanames_input.Rd
@@ -2,16 +2,19 @@
% Please edit documentation in R/data_extract_datanames.R
\name{datanames_input}
\alias{datanames_input}
-\title{Available datasets input}
+\title{Help text with available datasets input}
\usage{
datanames_input(data_extracts)
}
\arguments{
-\item{data_extracts}{list of data extracts for single variable}
+\item{data_extracts}{(\code{list}) of data extracts for single variable.}
+}
+\value{
+\code{\link[shiny:helpText]{shiny::helpText()}} object.
}
\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.
+Creates \code{\link[shiny:helpText]{shiny::helpText()}} with the names of available datasets for the
+current module.
}
diff --git a/man/get_dataset_prefixed_col_names.Rd b/man/get_dataset_prefixed_col_names.Rd
index af80ac10..eeafa804 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]{data_extract_srv()}}. which returns a shiny \code{\link[shiny:reactive]{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 \code{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 c53748cb..e1c30538 100644
--- a/man/get_extract_datanames.Rd
+++ b/man/get_extract_datanames.Rd
@@ -8,7 +8,10 @@ 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}}
+of \code{data_extract_spec}.}
+}
+\value{
+A character vector with the unique \code{dataname} set.
}
\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_initial_filter_values.Rd b/man/get_initial_filter_values.Rd
index 4a0a072c..f00e9fd9 100644
--- a/man/get_initial_filter_values.Rd
+++ b/man/get_initial_filter_values.Rd
@@ -2,22 +2,20 @@
% Please edit documentation in R/data_extract_filter_module.R
\name{get_initial_filter_values}
\alias{get_initial_filter_values}
-\title{Returns the initial values for the \code{vals} widget
-of a \code{filter_spec} object.}
+\title{Returns the initial values for the \code{vals} widget of a \code{filter_spec} object}
\usage{
get_initial_filter_values(filter, datasets)
}
\arguments{
-\item{filter}{(\code{filter_spec}) the filter generated by a call to \code{\link[=filter_spec]{filter_spec()}}}
+\item{filter}{(\code{filter_spec}) the filter generated by a call to \code{\link[=filter_spec]{filter_spec()}}.}
\item{datasets}{(\verb{named list}) a list of reactive \code{data.frame} type objects.}
}
\value{
-\verb{named list} with two slots \code{choices} and \code{selected}
+named \code{list} with two slots \code{choices} and \code{selected}.
}
\description{
-Returns the initial values for the \code{vals} widget
-of a \code{filter_spec} object.
+Returns the initial values for the \code{vals} widget of a \code{filter_spec} object
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/is_single_dataset.Rd b/man/is_single_dataset.Rd
index f98b5bcc..9c545595 100644
--- a/man/is_single_dataset.Rd
+++ b/man/is_single_dataset.Rd
@@ -7,11 +7,12 @@
is_single_dataset(...)
}
\arguments{
-\item{...}{either \code{data_extract_spec} objects or lists of \code{data_extract_spec} objects that do not contain
-NULL}
+\item{...}{either \code{data_extract_spec} objects or lists of \code{data_extract_spec}
+objects that do not contain \code{NULL}}
}
\value{
-logical
+\code{TRUE} if all \code{data_extract_spec} objects come from the same dataset,
+\code{FALSE} otherwise.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
From bcd8c702868097ceb12c7530634dd8bf3e22aef2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Thu, 8 Feb 2024 13:53:54 +0100
Subject: [PATCH 23/62] files 10-18/30: Title case, return params, full stop
params/descr/details/return
---
R/data.R | 5 ----
R/data_extract_module.R | 2 +-
R/data_extract_read_module.R | 15 +++++++----
R/data_extract_select_module.R | 10 ++++---
R/data_extract_single_module.R | 19 ++++++++------
R/data_extract_spec.R | 27 ++++++++++++-------
R/filter_spec.R | 48 ++++++++++++++++------------------
R/format_data_extract.R | 15 ++++++-----
R/get_dplyr_call.R | 46 +++++++++++++++++++++-----------
man/data_extract_read_srv.Rd | 15 ++++++-----
man/data_extract_select_ui.Rd | 8 +++---
man/data_extract_single_srv.Rd | 8 +++---
man/data_extract_single_ui.Rd | 11 ++++----
man/data_extract_spec.Rd | 19 +++++++++-----
man/filter_spec.Rd | 18 ++++++-------
man/filter_spec_internal.Rd | 23 ++++++++--------
man/format_data_extract.Rd | 7 ++---
man/get_dplyr_call.Rd | 10 +++----
man/get_dplyr_call_data.Rd | 2 +-
man/get_filter_call.Rd | 6 ++---
man/get_pivot_longer_col.Rd | 3 +++
man/get_rename_call.Rd | 11 +++-----
man/get_reshape_call.Rd | 6 ++---
man/get_reshape_unite_col.Rd | 3 +++
man/get_reshape_unite_vals.Rd | 3 +++
man/get_select_call.Rd | 4 +--
26 files changed, 193 insertions(+), 151 deletions(-)
diff --git a/R/data.R b/R/data.R
index 55670eeb..3cbe95eb 100644
--- a/R/data.R
+++ b/R/data.R
@@ -1,6 +1,5 @@
#' Random adverse events
#'
-#' @description Random adverse events
#' @docType data
#'
#' @usage rADAE
@@ -13,7 +12,6 @@
#' Random lab analysis
#'
-#' @description Random lab analysis
#' @docType data
#'
#' @usage rADLB
@@ -26,7 +24,6 @@
#' Random response
#'
-#' @description Random response
#' @docType data
#'
#' @usage rADRS
@@ -39,7 +36,6 @@
#' Random patient listing
#'
-#' @description Random patient listing
#' @docType data
#'
#' @usage rADSL
@@ -52,7 +48,6 @@
#' Random Time to Event Analysis Dataset
#'
-#' @description Random Time to Event Analysis Dataset
#' @docType data
#'
#' @usage rADTTE
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index 76bbb5e4..0512751f 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -1,4 +1,4 @@
-#' Check data extract spec
+#' Check data extract specification
#'
#' @param data_extract_spec (`list`) of `data_extract_spec`.
#'
diff --git a/R/data_extract_read_module.R b/R/data_extract_read_module.R
index 15eeaa8f..1ad6ab0c 100644
--- a/R/data_extract_read_module.R
+++ b/R/data_extract_read_module.R
@@ -1,12 +1,17 @@
#' Returns a reactive list with values read from the inputs of `data_extract_spec`
#'
-#' @details Reads the UI inputs of a single `data_extract_spec` object in
-#' a running `teal` application. Returns a reactive list of reactive values
-#' read from the input. The returned list has keys corresponding to the UI
-#' inputs: `select`, `filters`, `always_selected`, `reshape`.
+#' @details
+#' Reads the UI inputs of a single `data_extract_spec` object in a running
+#' `teal` application.
+#' Returns a reactive list of reactive values read from the input.
+#'
+#' The returned list has keys corresponding to the UI inputs:
+#' `select`, `filters`, `always_selected`, `reshape`.
#'
#' @inheritParams data_extract_single_srv
-#' @return `shiny::reactive` the reactive list with reactive values read from the UI
+#'
+#' @return `shiny::reactive` the reactive list with reactive values read from the UI.
+#'
#' @keywords internal
#'
data_extract_read_srv <- function(id, datasets, single_data_extract_spec, iv, select_validation_rule = NULL,
diff --git a/R/data_extract_select_module.R b/R/data_extract_select_module.R
index d7cf0e72..b45f042a 100644
--- a/R/data_extract_select_module.R
+++ b/R/data_extract_select_module.R
@@ -1,10 +1,12 @@
#' Returns a `shiny.tag.list` object with the UI for a `select_spec` object
#'
#' @param select (`select_spec`) A definition of a select spec element.
-#' Setting [select_spec()] with `ordered = TRUE` makes this selector responsive to the variable
-#' selection order.
-#' @param id (`character(1)`) The shiny `inputId` of the element
-#' @return `shiny.tag.list` with the UI
+#' Setting [select_spec()] with `ordered = TRUE` makes this selector responsive
+#' to the variable selection order.
+#' @param id (`character(1)`) The shiny `inputId` of the element.
+#'
+#' @return `shiny.tag.list` with the UI.
+#'
#' @examples
#' # use non-exported function from teal.transform
#' data_extract_select_ui <- getFromNamespace("data_extract_select_ui", "teal.transform")
diff --git a/R/data_extract_single_module.R b/R/data_extract_single_module.R
index 828af509..da21e143 100644
--- a/R/data_extract_single_module.R
+++ b/R/data_extract_single_module.R
@@ -1,12 +1,14 @@
#' Returns a `shiny.tag` with the UI elements for a `data_extract_spec`
#'
-#' @details Creates a `shiny.tag` element defining the UI elements corresponding
-#' a single `data_extract_spec` object.
+#' @details
+#' Creates a `shiny.tag` element defining the UI elements corresponding to a
+#' single `data_extract_spec` object.
#'
-#' @param id (`character(1)`) the id of the module
-#' @param single_data_extract_spec (`data_extract_spec`) the [data_extract_spec()] object to handle.
+#' @param id (`character(1)`) the id of the module.
+#' @param single_data_extract_spec (`data_extract_spec`) the
+#' [data_extract_spec()] object to handle.
#'
-#' @return `shiny.tag` the HTML element defining the UI
+#' @return `shiny.tag` the HTML element defining the UI.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -65,13 +67,14 @@ data_extract_single_ui <- function(id = NULL, single_data_extract_spec) {
#' The server function for a single `data_extract_spec` object
#'
-#' @details The Shiny server function for handling a single
-#' [data_extract_spec] object.
+#' @details
+#' The Shiny server function for handling a single [data_extract_spec] object.
#'
#' @inheritParams data_extract_filter_srv
#' @inheritParams data_extract_single_ui
#'
-#' @return `NULL`
+#' @return `NULL`.
+#'
#' @keywords internal
#'
data_extract_single_srv <- function(id, datasets, single_data_extract_spec) {
diff --git a/R/data_extract_spec.R b/R/data_extract_spec.R
index f839f905..47b09bed 100644
--- a/R/data_extract_spec.R
+++ b/R/data_extract_spec.R
@@ -1,14 +1,14 @@
#' Data Extract input for `teal` modules
#'
-#' @description `r lifecycle::badge("stable")`
+#' @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`.
+#' The Data Extract input can be used to filter and select columns from a data 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.
#'
-#' @export
#' @rdname data_extract_spec
#'
#' @section Module Development:
@@ -17,17 +17,23 @@
#' @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.
+#' 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`.
+#' 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
+#' whether reshape long to wide.
+#' Note that it will be used only in case of long dataset with multiple
#' keys selected in filter part.
#'
+#' @return `data_extract_spec` object.
+#'
+#' @references [select_spec] [filter_spec]
+#'
#' @examples
#' adtte_filters <- filter_spec(
#' vars = c("PARAMCD", "CNSR"),
@@ -76,7 +82,8 @@
#' filter = dynamic_filter
#' )
#'
-#' @references [select_spec] [filter_spec]
+#' @export
+#'
data_extract_spec <- function(dataname, select = NULL, filter = NULL, reshape = FALSE) {
checkmate::assert_string(dataname)
stopifnot(
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 42059b2c..7b6aa5f7 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -1,8 +1,18 @@
#' Data extract filter specification
#'
-#' @description `r lifecycle::badge("stable")`
+#' @description
+#' `r lifecycle::badge("stable")`
+#'
#' It consists in choices and additionally the variable names for the choices
#'
+#' @details
+#' 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 `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.
+#'
#' @inheritParams select_spec
#' @param vars (`character`) or (`delayed_data`) object.
#' Character vector giving the columns to be filtered. These should be
@@ -10,11 +20,10 @@
#' `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
+#' `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.
+#' Named character vector to define the choices of a shiny [shiny::selectInput()].
+#' These choices will be used to filter the dataset.
#'
#' 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
@@ -27,31 +36,18 @@
#' The `sep` input has to be `" - "` in this case.
#'
#' `delayed_data` objects can be created via [variable_choices()] or [value_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, (`logical`)
-#' whether to drop filter column from the dataset keys, `TRUE` on default.
-#'
-#' @param label optional (`character`). Define a label on top of this specific
+#' This value will be displayed inside the shiny app upon start.
+#' The `all_choices` object indicates selecting all possible choices.
+#' @param drop_keys (optional `logical`) whether to drop filter column from the
+#' dataset keys, `TRUE` on default.
+#' @param label (optional `character`). Define a label on top of this specific
#' shiny [shiny::selectInput()]. The default value is `"Filter by"`.
#'
#' @return `filter_spec`-S3-class object or `delayed_filter_spec`-S3-class object.
#'
-#' @details
-#'
-#' 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 `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.
-#'
-#'
#' @examples
#' # for Adverse Events table
#' filter_spec(
@@ -184,9 +180,9 @@ filter_spec <- function(vars,
#' Data extract dynamic filter specification
#'
-#' 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.
+#' Builds 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`)
diff --git a/R/format_data_extract.R b/R/format_data_extract.R
index 4f378e1a..6c25714a 100644
--- a/R/format_data_extract.R
+++ b/R/format_data_extract.R
@@ -1,11 +1,14 @@
-#' @title Formatting data extracts
-#' @description Returns a human-readable string representation of an extracted `data_extract_spec` object.
+#' Formatting data extracts
#'
-#' @details
-#' This function formats the output of [`data_extract_srv`]. See the example for more information.
+#' Returns a human-readable string representation of an extracted `data_extract_spec` object.
+#'
+#' This function formats the output of [`data_extract_srv`].
+#' See the example for more information.
+#'
+#' @param data_extract `list` the list output of `data_extract_srv`.
+
+#' @return A string (`character(1)`) representation of the `data_extract` object.
#'
-#' @param data_extract `list` the list output of `data_extract_srv`
-#' @return `character(1)` the string representation
#' @examples
#' simple_des <- data_extract_spec(
#' dataname = "iris",
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index c430945b..effc4688 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -2,10 +2,12 @@
#'
#' Simplifies selector_list into aggregated list with one element per
#' same selector - same dataset, same filter configuration and same reshape status
+#'
#' @inheritParams get_merge_call
#'
#' @return (`list`) simplified selectors with aggregated set of filters,
-#' selections, reshapes etc. All necessary data for merging
+#' selections, reshapes etc. All necessary data for merging.
+#'
#' @keywords internal
#'
get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys()) {
@@ -119,14 +121,14 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys(
#' Parses filter, select, rename and reshape call
#'
-#' Parse filter, select, rename and reshape call
#' @inheritParams get_dplyr_call_data
-#' @param idx optional (`integer`) current selector index in all selectors list
+#'
+#' @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`).
+#' selections, reshapes etc. All necessary data for merging.
+#' @param data (`NULL` or named `list`) of datasets.
#'
-#' @return (`call`) filter, select, rename and reshape call
+#' @return (`call`) filter, select, rename and reshape call.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -202,6 +204,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys(
#' ))
#' )
#' @keywords internal
+#'
get_dplyr_call <- function(selector_list,
idx = 1L,
join_keys = teal.data::join_keys(),
@@ -248,9 +251,9 @@ get_dplyr_call <- function(selector_list,
#' Parse `dplyr` select call
#'
-#' @param select (`character`) vector of selected column names
+#' @param select (`character`) vector of selected column names.
#'
-#' @return (`call`) `dplyr` select call
+#' @return `dplyr` select `call`.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -258,6 +261,7 @@ get_dplyr_call <- function(selector_list,
#'
#' 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) {
@@ -269,12 +273,13 @@ get_select_call <- function(select) {
as.call(c(list(quote(dplyr::select)), lapply(select, as.name)))
}
-#' Returns `dplyr` filter call
+#' Build a `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
+#'
+#' @return `dplyr` filter `call`.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -288,6 +293,7 @@ get_select_call <- function(select) {
#' list(columns = "VAR", selected = list("LEVEL1", "LEVEL2"))
#' ))
#' @keywords internal
+#'
get_filter_call <- function(filter, dataname = NULL, datasets = NULL) {
logger::log_trace(
paste(
@@ -410,13 +416,11 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) {
#' Returns `dplyr` rename call
#'
-#' Rename is used only if there are duplicated columns
+#' Rename is used only if there are duplicated columns.
#'
#' @inheritParams get_dplyr_call
#'
-#' @return (`call`) `dplyr` rename call
-#'
-#' @references get_rename_dict
+#' @return (`call`) `dplyr` rename call.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -494,7 +498,7 @@ get_rename_call <- function(selector_list = list(),
#'
#' @inheritParams get_dplyr_call
#'
-#' @return (`list`) list of multiple `dplyr` calls that reshape data
+#' @return List of multiple `dplyr` calls that reshape data.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -574,7 +578,11 @@ 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 `get_dplyr_call_data`.
+#'
+#' @return A `character` vector of all the selected columns that are not a `keys` element.
+#'
#' @keywords internal
#'
get_pivot_longer_col <- function(selector) {
@@ -586,7 +594,11 @@ get_pivot_longer_col <- function(selector) {
#'
#' Get key names which spreads values into columns. Reshape is done only
#' on keys which are in `filter_spec`.
+#'
#' @inheritParams get_pivot_longer_col
+#'
+#' @return A `character` vector of all the selector's keys that are defined in the filters.
+#'
#' @keywords internal
#'
get_reshape_unite_col <- function(selector) {
@@ -600,7 +612,11 @@ get_reshape_unite_col <- function(selector) {
#' Get unite columns values
#'
#' Get key values (levels) of the unite columns.
+#'
#' @inheritParams get_pivot_longer_col
+#'
+#' @return A `character` vector of keys of the unite columns.
+#'
#' @keywords internal
#'
get_reshape_unite_vals <- function(selector) {
diff --git a/man/data_extract_read_srv.Rd b/man/data_extract_read_srv.Rd
index e27d7f8c..a9cb43cc 100644
--- a/man/data_extract_read_srv.Rd
+++ b/man/data_extract_read_srv.Rd
@@ -18,18 +18,21 @@ data_extract_read_srv(
\item{datasets}{(\verb{named list}) a list of reactive \code{data.frame} type objects.}
-\item{single_data_extract_spec}{(\code{data_extract_spec}) the \code{\link[=data_extract_spec]{data_extract_spec()}} object to handle.}
+\item{single_data_extract_spec}{(\code{data_extract_spec}) the
+\code{\link[=data_extract_spec]{data_extract_spec()}} object to handle.}
}
\value{
-\code{shiny::reactive} the reactive list with reactive values read from the UI
+\code{shiny::reactive} the reactive list with reactive values read from the UI.
}
\description{
Returns a reactive list with values read from the inputs of \code{data_extract_spec}
}
\details{
-Reads the UI inputs of a single \code{data_extract_spec} object in
-a running \code{teal} application. Returns a reactive list of reactive values
-read from the input. The returned list has keys corresponding to the UI
-inputs: \code{select}, \code{filters}, \code{always_selected}, \code{reshape}.
+Reads the UI inputs of a single \code{data_extract_spec} object in a running
+\code{teal} application.
+Returns a reactive list of reactive values read from the input.
+
+The returned list has keys corresponding to the UI inputs:
+\code{select}, \code{filters}, \code{always_selected}, \code{reshape}.
}
\keyword{internal}
diff --git a/man/data_extract_select_ui.Rd b/man/data_extract_select_ui.Rd
index d038327c..e17a5c61 100644
--- a/man/data_extract_select_ui.Rd
+++ b/man/data_extract_select_ui.Rd
@@ -8,13 +8,13 @@ data_extract_select_ui(select, id = "select")
}
\arguments{
\item{select}{(\code{select_spec}) A definition of a select spec element.
-Setting \code{\link[=select_spec]{select_spec()}} with \code{ordered = TRUE} makes this selector responsive to the variable
-selection order.}
+Setting \code{\link[=select_spec]{select_spec()}} with \code{ordered = TRUE} makes this selector responsive
+to the variable selection order.}
-\item{id}{(\code{character(1)}) The shiny \code{inputId} of the element}
+\item{id}{(\code{character(1)}) The shiny \code{inputId} of the element.}
}
\value{
-\code{shiny.tag.list} with the UI
+\code{shiny.tag.list} with the UI.
}
\description{
Returns a \code{shiny.tag.list} object with the UI for a \code{select_spec} object
diff --git a/man/data_extract_single_srv.Rd b/man/data_extract_single_srv.Rd
index e77ff2ed..b2e18d72 100644
--- a/man/data_extract_single_srv.Rd
+++ b/man/data_extract_single_srv.Rd
@@ -11,16 +11,16 @@ data_extract_single_srv(id, datasets, single_data_extract_spec)
\item{datasets}{(\verb{named list}) a list of reactive \code{data.frame} type objects.}
-\item{single_data_extract_spec}{(\code{data_extract_spec}) the \code{\link[=data_extract_spec]{data_extract_spec()}} object to handle.}
+\item{single_data_extract_spec}{(\code{data_extract_spec}) the
+\code{\link[=data_extract_spec]{data_extract_spec()}} object to handle.}
}
\value{
-\code{NULL}
+\code{NULL}.
}
\description{
The server function for a single \code{data_extract_spec} object
}
\details{
-The Shiny server function for handling a single
-\link{data_extract_spec} object.
+The Shiny server function for handling a single \link{data_extract_spec} object.
}
\keyword{internal}
diff --git a/man/data_extract_single_ui.Rd b/man/data_extract_single_ui.Rd
index 057425b0..a044d8db 100644
--- a/man/data_extract_single_ui.Rd
+++ b/man/data_extract_single_ui.Rd
@@ -7,19 +7,20 @@
data_extract_single_ui(id = NULL, single_data_extract_spec)
}
\arguments{
-\item{id}{(\code{character(1)}) the id of the module}
+\item{id}{(\code{character(1)}) the id of the module.}
-\item{single_data_extract_spec}{(\code{data_extract_spec}) the \code{\link[=data_extract_spec]{data_extract_spec()}} object to handle.}
+\item{single_data_extract_spec}{(\code{data_extract_spec}) the
+\code{\link[=data_extract_spec]{data_extract_spec()}} object to handle.}
}
\value{
-\code{shiny.tag} the HTML element defining the UI
+\code{shiny.tag} the HTML element defining the UI.
}
\description{
Returns a \code{shiny.tag} with the UI elements for a \code{data_extract_spec}
}
\details{
-Creates a \code{shiny.tag} element defining the UI elements corresponding
-a single \code{data_extract_spec} object.
+Creates a \code{shiny.tag} element defining the UI elements corresponding to a
+single \code{data_extract_spec} object.
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/data_extract_spec.Rd b/man/data_extract_spec.Rd
index 173abe67..0d9d2727 100644
--- a/man/data_extract_spec.Rd
+++ b/man/data_extract_spec.Rd
@@ -11,24 +11,29 @@ data_extract_spec(dataname, select = NULL, filter = NULL, reshape = FALSE)
The name of the dataset to be extracted.}
\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.}
+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)
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}.}
+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})
-whether reshape long to wide. Note that it will be used only in case of long dataset with multiple
+whether reshape long to wide.
+Note that it will be used only in case of long dataset with multiple
keys selected in filter part.}
}
+\value{
+\code{data_extract_spec} object.
+}
\description{
\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 \code{teal}.
+The Data Extract input can be used to filter and select columns from a data 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/filter_spec.Rd b/man/filter_spec.Rd
index 9833e841..286fac75 100644
--- a/man/filter_spec.Rd
+++ b/man/filter_spec.Rd
@@ -22,9 +22,8 @@ key variables of the data set to be filtered.
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]{shiny::selectInput()}}. These choices will be used to filter the
-dataset.
+Named character vector to define the choices 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
watch out that the filter values have to follow the order of the \code{vars} input. In the following
@@ -41,26 +40,27 @@ The \code{sep} input has to be \code{" - "} in this case.
\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.}
+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]{shiny::selectInput()}}.}
-\item{label}{optional (\code{character}). Define a label on top of this specific
+\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"}.}
\item{sep}{(\code{character}) A separator string to split the \code{choices} or
-\code{selected} inputs into the values of the different columns}
+\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.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
+
It consists in choices and additionally the variable names for the choices
}
\details{
diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd
index 7a1cb511..9be3650d 100644
--- a/man/filter_spec_internal.Rd
+++ b/man/filter_spec_internal.Rd
@@ -75,9 +75,8 @@ if true allow to change the selected variables in the UI element; otherwise, do
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]{shiny::selectInput()}}. These choices will be used to filter the
-dataset.
+Named character vector to define the choices 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
watch out that the filter values have to follow the order of the \code{vars} input. In the following
@@ -94,10 +93,10 @@ The \code{sep} input has to be \code{" - "} in this case.
\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.}
+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
+\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"}.}
\item{fixed}{(\code{logical})
@@ -107,10 +106,10 @@ if true allow to change the initially selected values of the variables; otherwis
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}
+\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})
the name of the dataset this filter covers. Set during the initialization of the \code{teal} application.}
@@ -123,9 +122,9 @@ TRUE if this filter was already consumed by the server function; FALSE otherwise
\code{filter_spec} or \code{delayed_filter_spec} S3-class object.
}
\description{
-This function returns a configuration for the \code{data_extract_ui} module. This function covers
-the configuration of filtering datasets (so called \code{filter_spec}), which then is used to build
-the UI element in the \code{teal} app.
+Builds a configuration for the \code{data_extract_ui} module. This function covers
+the configuration of filtering datasets (so called \code{filter_spec}), which then
+is used to build the UI element in the \code{teal} app.
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/format_data_extract.Rd b/man/format_data_extract.Rd
index fb82af7f..49e32a6a 100644
--- a/man/format_data_extract.Rd
+++ b/man/format_data_extract.Rd
@@ -7,16 +7,17 @@
format_data_extract(data_extract)
}
\arguments{
-\item{data_extract}{\code{list} the list output of \code{data_extract_srv}}
+\item{data_extract}{\code{list} the list output of \code{data_extract_srv}.}
}
\value{
-\code{character(1)} the string representation
+A string (\code{character(1)}) representation of the \code{data_extract} object.
}
\description{
Returns a human-readable string representation of an extracted \code{data_extract_spec} object.
}
\details{
-This function formats the output of \code{\link{data_extract_srv}}. See the example for more information.
+This function formats the output of \code{\link{data_extract_srv}}.
+See the example for more information.
}
\examples{
simple_des <- data_extract_spec(
diff --git a/man/get_dplyr_call.Rd b/man/get_dplyr_call.Rd
index 6ced133b..23fbde70 100644
--- a/man/get_dplyr_call.Rd
+++ b/man/get_dplyr_call.Rd
@@ -20,20 +20,20 @@ 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}
+\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
\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,
-selections, reshapes etc. All necessary data for merging}
+selections, reshapes etc. All necessary data for merging.}
-\item{data}{(\code{NULL} or named \code{list}).}
+\item{data}{(\code{NULL} or named \code{list}) of datasets.}
}
\value{
-(\code{call}) filter, select, rename and reshape call
+(\code{call}) filter, select, rename and reshape call.
}
\description{
-Parse filter, select, rename and reshape call
+Parses filter, select, rename and reshape call
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/get_dplyr_call_data.Rd b/man/get_dplyr_call_data.Rd
index d0b9e7f7..3310c7e4 100644
--- a/man/get_dplyr_call_data.Rd
+++ b/man/get_dplyr_call_data.Rd
@@ -18,7 +18,7 @@ ids of the respective
}
\value{
(\code{list}) simplified selectors with aggregated set of filters,
-selections, reshapes etc. All necessary data for merging
+selections, reshapes etc. All necessary data for merging.
}
\description{
Simplifies selector_list into aggregated list with one element per
diff --git a/man/get_filter_call.Rd b/man/get_filter_call.Rd
index e861bee1..d3afea45 100644
--- a/man/get_filter_call.Rd
+++ b/man/get_filter_call.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/get_dplyr_call.R
\name{get_filter_call}
\alias{get_filter_call}
-\title{Returns \code{dplyr} filter call}
+\title{Build a \code{dplyr} filter call}
\usage{
get_filter_call(filter, dataname = NULL, datasets = NULL)
}
@@ -14,10 +14,10 @@ get_filter_call(filter, dataname = NULL, datasets = NULL)
\item{datasets}{(\code{NULL} or named \code{list}).}
}
\value{
-(\code{call}) \code{dplyr} filter call
+\code{dplyr} filter \code{call}.
}
\description{
-Returns \code{dplyr} filter call
+Build a \code{dplyr} filter call
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/get_pivot_longer_col.Rd b/man/get_pivot_longer_col.Rd
index bf833de8..13285b78 100644
--- a/man/get_pivot_longer_col.Rd
+++ b/man/get_pivot_longer_col.Rd
@@ -9,6 +9,9 @@ get_pivot_longer_col(selector)
\arguments{
\item{selector}{one element of selector_list obtained by \code{get_dplyr_call_data}.}
}
+\value{
+A \code{character} vector of all the selected columns that are not a \code{keys} element.
+}
\description{
Get values names which are spread into columns.
}
diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd
index 2161cb38..92e9a89d 100644
--- a/man/get_rename_call.Rd
+++ b/man/get_rename_call.Rd
@@ -19,18 +19,18 @@ 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}
+\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
\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,
-selections, reshapes etc. All necessary data for merging}
+selections, reshapes etc. All necessary data for merging.}
}
\value{
-(\code{call}) \code{dplyr} rename call
+(\code{call}) \code{dplyr} rename call.
}
\description{
-Rename is used only if there are duplicated columns
+Rename is used only if there are duplicated columns.
}
\examples{
# use non-exported function from teal.transform
@@ -75,7 +75,4 @@ get_rename_call(x, 2L)
get_rename_call(x, 3L)
get_rename_call(x, 4L)
}
-\references{
-get_rename_dict
-}
\keyword{internal}
diff --git a/man/get_reshape_call.Rd b/man/get_reshape_call.Rd
index 5c9d581a..b68cb2a7 100644
--- a/man/get_reshape_call.Rd
+++ b/man/get_reshape_call.Rd
@@ -19,15 +19,15 @@ 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}
+\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
\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,
-selections, reshapes etc. All necessary data for merging}
+selections, reshapes etc. All necessary data for merging.}
}
\value{
-(\code{list}) list of multiple \code{dplyr} calls that reshape data
+List of multiple \code{dplyr} calls that reshape data.
}
\description{
Returns \code{dplyr} reshape call
diff --git a/man/get_reshape_unite_col.Rd b/man/get_reshape_unite_col.Rd
index 1b2740c8..cf25da4e 100644
--- a/man/get_reshape_unite_col.Rd
+++ b/man/get_reshape_unite_col.Rd
@@ -9,6 +9,9 @@ get_reshape_unite_col(selector)
\arguments{
\item{selector}{one element of selector_list obtained by \code{get_dplyr_call_data}.}
}
+\value{
+A \code{character} vector of all the selector's keys that are defined in the filters.
+}
\description{
Get key names which spreads values into columns. Reshape is done only
on keys which are in \code{filter_spec}.
diff --git a/man/get_reshape_unite_vals.Rd b/man/get_reshape_unite_vals.Rd
index f1697c9b..d54ece19 100644
--- a/man/get_reshape_unite_vals.Rd
+++ b/man/get_reshape_unite_vals.Rd
@@ -9,6 +9,9 @@ get_reshape_unite_vals(selector)
\arguments{
\item{selector}{one element of selector_list obtained by \code{get_dplyr_call_data}.}
}
+\value{
+A \code{character} vector of keys of the unite columns.
+}
\description{
Get key values (levels) of the unite columns.
}
diff --git a/man/get_select_call.Rd b/man/get_select_call.Rd
index dfb3deb5..0deac17f 100644
--- a/man/get_select_call.Rd
+++ b/man/get_select_call.Rd
@@ -7,10 +7,10 @@
get_select_call(select)
}
\arguments{
-\item{select}{(\code{character}) vector of selected column names}
+\item{select}{(\code{character}) vector of selected column names.}
}
\value{
-(\code{call}) \code{dplyr} select call
+\code{dplyr} select \code{call}.
}
\description{
Parse \code{dplyr} select call
From d414a32ebd0cf7e7b0b2411b0fe24e27a55855bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Thu, 8 Feb 2024 14:29:47 +0100
Subject: [PATCH 24/62] files 19-23/30: Title case, return params, full stop
params/descr/details/return
---
R/get_merge_call.R | 120 ++++++++++++++++++++---------
R/include_css_js.R | 10 ++-
R/input_checks.R | 23 +++---
R/merge_data_utils.R | 7 ++
R/merge_datasets.R | 54 +++++++------
man/are_needed_keys_provided.Rd | 8 +-
man/check_data_merge_selectors.Rd | 4 +-
man/check_no_multiple_selection.Rd | 12 ++-
man/get_anl_relabel_call.Rd | 2 +-
man/get_dplyr_call.Rd | 2 +-
man/get_dplyr_call_data.Rd | 2 +-
man/get_dropped_filters.Rd | 6 +-
man/get_merge_call.Rd | 11 +--
man/get_merge_key_grid.Rd | 8 +-
man/get_merge_key_i.Rd | 34 +++++++-
man/get_merge_key_pair.Rd | 22 +++---
man/get_relabel_call.Rd | 4 +-
man/get_relabel_cols.Rd | 8 +-
man/get_rename_call.Rd | 2 +-
man/get_reshape_call.Rd | 2 +-
man/include_css_files.Rd | 9 ++-
man/list_extract_spec.Rd | 8 +-
man/merge_datasets.Rd | 20 ++---
man/merge_selectors.Rd | 7 +-
man/parse_merge_key_i.Rd | 9 ++-
man/validate_keys_sufficient.Rd | 8 +-
26 files changed, 254 insertions(+), 148 deletions(-)
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index 59410446..ef6d00bd 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -1,15 +1,19 @@
#' Get merge call from a list of selectors
#'
-#' @description `r lifecycle::badge("stable")`
-#' Returns list of calls depending on selector(s) and type of the merge
-#' Order of merge is the same as in selectors passed to the function.
+#' @description
+#' `r lifecycle::badge("stable")`
+#'
+#' Returns list of calls depending on selector(s) and type of the merge.
+#' The merge order is the same as in selectors passed to the function.
+#'
#' @inheritParams merge_datasets
-#' @param join_keys (`join_keys`) nested list of keys used for joining
-#' @param dplyr_call_data (`list`) simplified selectors with aggregated set of filters,
+#' @param join_keys (`join_keys`) nested list of keys used for joining.
+#' @param dplyr_call_data (`list`) simplified selectors with aggregated set of filters.
#'
-#' @return (`list` with `call` elements)
+#' @return List with merge `call` elements.
#'
#' @export
+#'
get_merge_call <- function(selector_list,
join_keys = teal.data::join_keys(),
dplyr_call_data = get_dplyr_call_data(selector_list, join_keys = join_keys),
@@ -111,10 +115,12 @@ get_merge_call <- function(selector_list,
return(anl_merge_calls)
}
-#' Gets keys list from keys list
+#' Gets merge key pair list from keys list
#'
#' @inheritParams get_merge_call
-#' @return list of key pairs between all datasets
+#'
+#' @return List of merge key pairs between all datasets.
+#'
#' @keywords internal
#'
get_merge_key_grid <- function(selector_list, join_keys = teal.data::join_keys()) {
@@ -141,22 +147,23 @@ 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`
-#' @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
+#' This function covers up to now 4 cases:
#'
-#' * dataset without parent: Primary keys are returned
-#' * dataset source = dataset target:
+#' * 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
+#' 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;
+#'
+#' @param selector_from (`list`) of `data_extract_srv` objects.
+#' @param selector_to (`list`) of `data_extract_srv` objects.
+#' @param key_from (`character`) keys used in the first selector while joining.
+#'
+#' @return `character` vector of selector keys.
#'
-#' @return (`character`)
#' @keywords internal
#'
get_merge_key_pair <- function(selector_from, selector_to, key_from) {
@@ -194,9 +201,37 @@ get_merge_key_pair <- function(selector_from, selector_to, key_from) {
#' Gets keys needed for join call of two selectors
#'
#' @inheritParams get_merge_call
-#' @param idx optional (`integer`) current selector index in all selectors list
+#' @param idx (optional `integer`) current selector index in all selectors list.
+#'
+#' @return `character` list of keys.
+#'
+#' @examples
+#' # use non-exported function from teal.transform
+#' get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
+#' get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
+#'
+#' 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"
+#' )
+#' )
+#'
+#' join_keys <- teal.data::join_keys(teal.data::join_key("X", "Y", c("A", "B")))
+#' get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
#'
-#' @return (`call`)
#' @keywords internal
#'
get_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call_data(selector_list)) {
@@ -282,9 +317,13 @@ get_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call
}
#' Parses merge keys
+#'
#' @inheritParams get_merge_call
-#' @param merge_key keys obtained from `get_merge_key_i`
-#' @param idx optional (`integer`) current selector index in all selectors list
+#' @param merge_key keys obtained from `get_merge_key_i`.
+#' @param idx optional (`integer`) current selector index in all selectors list.
+#'
+#' @return `call` with merge keys.
+#'
#' @keywords internal
#'
parse_merge_key_i <- function(selector_list,
@@ -302,14 +341,20 @@ parse_merge_key_i <- function(selector_list,
#' Names of filtered-out filters dropped from selection
#'
-#' @details Names of filtered-out filters dropped from automatic selection
+#' @details
+#' Names of filtered-out filters dropped from automatic selection
#' (key vars are automatically included in select).
#' Dropped filter is filter which became not unique for all observations.
#' This means that if variable is filtered to just one level,
-#' it's not a key anymore. Other variables used in filter should also be dropped from automatic
+#' it's not a key anymore.
+#'
+#' Other variables used in filter should also be dropped from automatic
#' selection, unless they have been selected.
+#'
#' @inheritParams get_pivot_longer_col
-#' @return names `character` of the filters which should be dropped from select call
+#'
+#' @return Vector of `character` names of the filters which should be dropped from select call.
+#'
#' @keywords internal
#'
get_dropped_filters <- function(selector) {
@@ -336,7 +381,7 @@ get_dropped_filters <- function(selector) {
#' `r lifecycle::badge("stable")`
#'
#' @inheritParams merge_datasets
-#' @param columns_source named `list`
+#' @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`.
@@ -402,14 +447,16 @@ get_anl_relabel_call <- function(columns_source, datasets, anl_name = "ANL") {
#' Create relabel call from named character
#'
-#' @description `r lifecycle::badge("stable")`
+#' @description
+#' `r lifecycle::badge("stable")`
#'
#' Function creates relabel call from named character.
#'
-#' @param labels (`named character`)
+#' @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
+#' @return `call` object with relabel step.
+#'
#' @examples
#' get_relabel_call(
#' labels = c(
@@ -446,10 +493,13 @@ get_relabel_call <- function(labels) {
#' Get columns to relabel
#'
-#' Get columns to relabel excluding these which has been reshaped (pivot_wider)
-#' @param columns_source `list`
-#' @param dplyr_call_data `list`
-#' @return columns_source `list` without columns which has been reshaped
+#' Get columns to relabel excluding these which has been reshaped (pivot_wider).
+#'
+#' @param columns_source (`list`)
+#' @param dplyr_call_data (`list`)
+#'
+#' @return `columns_source` list without columns that have been reshaped.
+#'
#' @keywords internal
#'
get_relabel_cols <- function(columns_source, dplyr_call_data) {
diff --git a/R/include_css_js.R b/R/include_css_js.R
index 4af966ad..13d41741 100644
--- a/R/include_css_js.R
+++ b/R/include_css_js.R
@@ -1,12 +1,14 @@
#' Include `CSS` files from `/inst/css/` package directory to application header
#'
#' `system.file` should not be used to access files in other packages, it does
-#' not work with `devtools`. Therefore, we redefine this method in each package
-#' as needed. Thus, we do not export this method
+#' not work with `devtools`.
+#' Therefore, we redefine this method in each package as needed.
+#' Thus, we do not export this method
#'
-#' @param pattern (`character`) pattern of files to be included
+#' @param pattern (`character`) pattern of files to be included.
+#'
+#' @return HTML code that includes `CSS` files.
#'
-#' @return HTML code that includes `CSS` files
#' @keywords internal
#'
include_css_files <- function(pattern = "*") {
diff --git a/R/input_checks.R b/R/input_checks.R
index 8afb6d7f..aad58333 100644
--- a/R/input_checks.R
+++ b/R/input_checks.R
@@ -2,15 +2,14 @@
# In general, they are checking functions, in the sense that they call `stopifnot`
# if the conditions are not met.
-#' Make sure that the extract spec has list form
+#' Make sure that the extract specification is in list format
#'
-#' @md
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
-#' @param x `data_extract_spec` a single `data_extract_spec` or list of these
-#' @param allow_null `logical` whether x can be `NULL`
+#' @param x (`data_extract_spec` or `list`) of `data_extract_spec` elements.
+#' @param allow_null (`logical`) whether x can be `NULL`.
#'
-#' @return x as a list if it is not already
+#' @return `x` as a list if it is not already.
#'
#' @export
list_extract_spec <- function(x, allow_null = FALSE) {
@@ -25,17 +24,19 @@ list_extract_spec <- function(x, allow_null = FALSE) {
x
}
-#' Checks that the extract_input specification does not allow multiple
+#' Checks that the `extract_input` specification does not allow multiple
#' selection
#'
-#' @md
-#' @description `r lifecycle::badge("stable")`
-#'
-#' @param extract_input `data_extract_spec` a list of `data_extract_spec` or NULL
+#' `r lifecycle::badge("stable")`
#'
#' Stops if condition not met
#'
+#' @param extract_input (`list` or `NULL`) a list of `data_extract_spec`
+#'
+#' @return Raises an error when check fails, otherwise, it returns `NULL`, invisibly.
+#'
#' @export
+#'
check_no_multiple_selection <- function(extract_input) {
# bug in is_class_list when NULL
checkmate::assert_list(extract_input, types = "data_extract_spec", null.ok = TRUE)
diff --git a/R/merge_data_utils.R b/R/merge_data_utils.R
index ede50406..9324505c 100644
--- a/R/merge_data_utils.R
+++ b/R/merge_data_utils.R
@@ -1,3 +1,10 @@
+#' Check if the merge function is valid
+#'
+#' @param merge_function (`character`) merge function name.
+#'
+#' @return Raises an error when check fails, otherwise, it returns `NULL`, invisibly.
+#'
+#' @noRd
check_merge_function <- function(merge_function) {
checkmate::assert_string(merge_function)
stopifnot(length(intersect(methods::formalArgs(eval(rlang::parse_expr(merge_function))), c("x", "y", "by"))) == 3)
diff --git a/R/merge_datasets.R b/R/merge_datasets.R
index 31c9d454..afed8782 100644
--- a/R/merge_datasets.R
+++ b/R/merge_datasets.R
@@ -1,10 +1,12 @@
#' Merge the datasets on the keys
#'
-#' @description `r lifecycle::badge("experimental")`
-#' It combines/merges multiple datasets with specified keys attribute.
+#' @description
+#' `r lifecycle::badge("experimental")`
#'
+#' Combines/merges multiple datasets with specified keys attribute.
#'
-#' @details Internally this function uses calls to allow reproducibility.
+#' @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`.
@@ -26,21 +28,21 @@
#' ```
#'
#' @inheritParams merge_expression_srv
-#' @return merged_dataset (`list`) containing:
-#' - `expr` (`list` of `call`) code needed to replicate merged dataset.
-#' - `columns_source` (`list`) of column names selected for particular selector.
-#' Each list element contains named character vector where:
+#'
+#' @return `merged_dataset` list containing:
+#' * `expr` (`list` of `call`) code needed to replicate merged dataset;
+#' * `columns_source` (`list`) of column names selected for particular selector;
+#' Each list element contains named character vector where:
#' * Values are the names of the columns in the `ANL`. In case if the same column name is selected in more than one
#' selector it gets prefixed by the id of the selector. For example if two `data_extract` have id `x`, `y`, then
-#' their duplicated selected variable (for example `AGE`) is prefixed to be `x.AGE` and `y.AGE`.
-#' * Names of the vector denote names of the variables in the input dataset.
-#' * `attr(,"dataname")` to indicate which dataset variable is merged from.
-#' * `attr(, "always selected")` to denote the names of the variables which need to be always selected.
-#' - `keys` (`list`) the keys of the merged dataset.
-#' - `filter_info` (`list`) The information given by the user. This information
+#' their duplicated selected variable (for example `AGE`) is prefixed to be `x.AGE` and `y.AGE`;
+#' * Names of the vector denote names of the variables in the input dataset;
+#' * `attr(,"dataname")` to indicate which dataset variable is merged from;
+#' * `attr(, "always selected")` to denote the names of the variables which need to be always selected;
+#' * `keys` (`list`) the keys of the merged dataset;
+#' * `filter_info` (`list`) The information given by the user. This information
#' defines the filters that are applied on the data. Additionally it defines
#' the variables that are selected from the data sets.
-#' @export
#'
#' @examples
#' library(shiny)
@@ -79,6 +81,7 @@
#' )
#'
#' paste(merged_datasets$expr)
+#' @export
#'
merge_datasets <- function(selector_list, datasets, join_keys, merge_function = "dplyr::full_join", anl_name = "ANL") {
logger::log_trace(
@@ -169,11 +172,12 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function =
return(res)
}
-#' Merge selectors - select item if all of `dataname`, reshape, filters and keys items are identical
+#' Merge selectors when `dataname`, `reshape`, `filters` and `keys` entries are identical
#'
#' @inheritParams merge_datasets
#'
-#' @return error or nothing
+#' @return List of merged selectors or original parameter if the conditions to merge are
+#' not applicable.
#'
#' @examples
#' # use non-exported function from teal.transform
@@ -261,11 +265,11 @@ merge_selectors <- function(selector_list) {
#' Validate data_extracts in merge_datasets
#'
#' Validate selected inputs from data_extract before passing to data_merge to avoid
-#' `dplyr` errors or unexpected results
+#' `dplyr` errors or unexpected results.
#'
#' @inheritParams merge_datasets
#'
-#' @return `NULL` if check is successful
+#' @return `NULL` if check is successful and `shiny` validate error otherwise.
#'
#' @keywords internal
#'
@@ -290,11 +294,12 @@ check_data_merge_selectors <- function(selector_list) {
#' `merged_selector_list` come from datasets, which don't have the
#' appropriate join keys in `join_keys`.
#'
-#' @param join_keys (`join_keys`) the provided join keys
-#' @param merged_selector_list (`list`) the specification of datasets' slices to merge
+#' @param join_keys (`join_keys`) the provided join keys.
+#' @param merged_selector_list (`list`) the specification of datasets' slices to merge.
+#'
+#' @return `TRUE` if the provided keys meet the requirement and `shiny`
+#' validate error otherwise.
#'
-#' @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) {
@@ -320,8 +325,9 @@ validate_keys_sufficient <- function(join_keys, merged_selector_list) {
#'
#' @inheritParams validate_keys_sufficient
#'
-#' @return `TRUE` if all pairs of the slices have the corresponding keys;
-#' `FALSE` otherwise
+#' @return `TRUE` if all pairs of the slices have the corresponding keys and
+#' `FALSE` otherwise.
+#'
#' @keywords internal
#'
are_needed_keys_provided <- function(join_keys, merged_selector_list) {
diff --git a/man/are_needed_keys_provided.Rd b/man/are_needed_keys_provided.Rd
index 51730568..077f0f75 100644
--- a/man/are_needed_keys_provided.Rd
+++ b/man/are_needed_keys_provided.Rd
@@ -7,13 +7,13 @@
are_needed_keys_provided(join_keys, merged_selector_list)
}
\arguments{
-\item{join_keys}{(\code{join_keys}) the provided join keys}
+\item{join_keys}{(\code{join_keys}) the provided join keys.}
-\item{merged_selector_list}{(\code{list}) the specification of datasets' slices to merge}
+\item{merged_selector_list}{(\code{list}) the specification of datasets' slices to merge.}
}
\value{
-\code{TRUE} if all pairs of the slices have the corresponding keys;
-\code{FALSE} otherwise
+\code{TRUE} if all pairs of the slices have the corresponding keys and
+\code{FALSE} otherwise.
}
\description{
Checks whether the provided slices have the corresponding join keys
diff --git a/man/check_data_merge_selectors.Rd b/man/check_data_merge_selectors.Rd
index 64f4dd3d..1ea2391b 100644
--- a/man/check_data_merge_selectors.Rd
+++ b/man/check_data_merge_selectors.Rd
@@ -15,10 +15,10 @@ ids of the respective
\code{\link[=data_extract_ui]{data_extract_ui()}}.}
}
\value{
-\code{NULL} if check is successful
+\code{NULL} if check is successful and \code{shiny} validate error otherwise.
}
\description{
Validate selected inputs from data_extract before passing to data_merge to avoid
-\code{dplyr} errors or unexpected results
+\code{dplyr} errors or unexpected results.
}
\keyword{internal}
diff --git a/man/check_no_multiple_selection.Rd b/man/check_no_multiple_selection.Rd
index 82ed7640..8a52dc22 100644
--- a/man/check_no_multiple_selection.Rd
+++ b/man/check_no_multiple_selection.Rd
@@ -2,16 +2,20 @@
% Please edit documentation in R/input_checks.R
\name{check_no_multiple_selection}
\alias{check_no_multiple_selection}
-\title{Checks that the extract_input specification does not allow multiple
+\title{Checks that the \code{extract_input} specification does not allow multiple
selection}
\usage{
check_no_multiple_selection(extract_input)
}
\arguments{
-\item{extract_input}{\code{data_extract_spec} a list of \code{data_extract_spec} or NULL
-
-Stops if condition not met}
+\item{extract_input}{(\code{list} or \code{NULL}) a list of \code{data_extract_spec}}
+}
+\value{
+Raises an error when check fails, otherwise, it returns \code{NULL}, invisibly.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
+\details{
+Stops if condition not met
+}
diff --git a/man/get_anl_relabel_call.Rd b/man/get_anl_relabel_call.Rd
index 4169553b..3c6e1c4d 100644
--- a/man/get_anl_relabel_call.Rd
+++ b/man/get_anl_relabel_call.Rd
@@ -7,7 +7,7 @@
get_anl_relabel_call(columns_source, datasets, anl_name = "ANL")
}
\arguments{
-\item{columns_source}{named \code{list}
+\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})
diff --git a/man/get_dplyr_call.Rd b/man/get_dplyr_call.Rd
index 23fbde70..fbeb8a36 100644
--- a/man/get_dplyr_call.Rd
+++ b/man/get_dplyr_call.Rd
@@ -22,7 +22,7 @@ ids of the respective
\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
-\item{join_keys}{(\code{join_keys}) nested list of keys used for joining}
+\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,
selections, reshapes etc. All necessary data for merging.}
diff --git a/man/get_dplyr_call_data.Rd b/man/get_dplyr_call_data.Rd
index 3310c7e4..83b94d96 100644
--- a/man/get_dplyr_call_data.Rd
+++ b/man/get_dplyr_call_data.Rd
@@ -14,7 +14,7 @@ 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{join_keys}{(\code{join_keys}) nested list of keys used for joining.}
}
\value{
(\code{list}) simplified selectors with aggregated set of filters,
diff --git a/man/get_dropped_filters.Rd b/man/get_dropped_filters.Rd
index cd8e084c..8d6ad160 100644
--- a/man/get_dropped_filters.Rd
+++ b/man/get_dropped_filters.Rd
@@ -10,7 +10,7 @@ get_dropped_filters(selector)
\item{selector}{one element of selector_list obtained by \code{get_dplyr_call_data}.}
}
\value{
-names \code{character} of the filters which should be dropped from select call
+Vector of \code{character} names of the filters which should be dropped from select call.
}
\description{
Names of filtered-out filters dropped from selection
@@ -20,7 +20,9 @@ Names of filtered-out filters dropped from automatic selection
(key vars are automatically included in select).
Dropped filter is filter which became not unique for all observations.
This means that if variable is filtered to just one level,
-it's not a key anymore. Other variables used in filter should also be dropped from automatic
+it's not a key anymore.
+
+Other variables used in filter should also be dropped from automatic
selection, unless they have been selected.
}
\keyword{internal}
diff --git a/man/get_merge_call.Rd b/man/get_merge_call.Rd
index 66c91159..00728abf 100644
--- a/man/get_merge_call.Rd
+++ b/man/get_merge_call.Rd
@@ -20,9 +20,9 @@ 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{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{dplyr_call_data}{(\code{list}) simplified selectors with aggregated set of filters.}
\item{merge_function}{(\code{character(1)} or \code{reactive})
A character string of a function that accepts the arguments
@@ -32,10 +32,11 @@ A character string of a function that accepts the arguments
Name of the analysis dataset.}
}
\value{
-(\code{list} with \code{call} elements)
+List with merge \code{call} elements.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
-Returns list of calls depending on selector(s) and type of the merge
-Order of merge is the same as in selectors passed to the function.
+
+Returns list of calls depending on selector(s) and type of the merge.
+The merge order is the same as in selectors passed to the function.
}
diff --git a/man/get_merge_key_grid.Rd b/man/get_merge_key_grid.Rd
index e80266fa..83177b02 100644
--- a/man/get_merge_key_grid.Rd
+++ b/man/get_merge_key_grid.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/get_merge_call.R
\name{get_merge_key_grid}
\alias{get_merge_key_grid}
-\title{Gets keys list from keys list}
+\title{Gets merge key pair list from keys list}
\usage{
get_merge_key_grid(selector_list, join_keys = teal.data::join_keys())
}
@@ -14,12 +14,12 @@ 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{join_keys}{(\code{join_keys}) nested list of keys used for joining.}
}
\value{
-list of key pairs between all datasets
+List of merge key pairs between all datasets.
}
\description{
-Gets keys list from keys list
+Gets merge key pair list from keys list
}
\keyword{internal}
diff --git a/man/get_merge_key_i.Rd b/man/get_merge_key_i.Rd
index 3750cc63..63edc4cd 100644
--- a/man/get_merge_key_i.Rd
+++ b/man/get_merge_key_i.Rd
@@ -18,14 +18,42 @@ 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}
+\item{idx}{(optional \code{integer}) current selector index in all selectors list.}
-\item{dplyr_call_data}{(\code{list}) simplified selectors with aggregated set of filters,}
+\item{dplyr_call_data}{(\code{list}) simplified selectors with aggregated set of filters.}
}
\value{
-(\code{call})
+\code{character} list of keys.
}
\description{
Gets keys needed for join call of two selectors
+}
+\examples{
+# use non-exported function from teal.transform
+get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
+get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
+
+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"
+ )
+)
+
+join_keys <- teal.data::join_keys(teal.data::join_key("X", "Y", c("A", "B")))
+get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
+
}
\keyword{internal}
diff --git a/man/get_merge_key_pair.Rd b/man/get_merge_key_pair.Rd
index 2e6c45d7..942d2c2a 100644
--- a/man/get_merge_key_pair.Rd
+++ b/man/get_merge_key_pair.Rd
@@ -7,28 +7,28 @@
get_merge_key_pair(selector_from, selector_to, key_from)
}
\arguments{
-\item{selector_from}{(\code{list}) \code{data_extract_srv}}
+\item{selector_from}{(\code{list}) of \code{data_extract_srv} objects.}
-\item{selector_to}{(\code{list}) \code{data_extract_srv}}
+\item{selector_to}{(\code{list}) of \code{data_extract_srv} objects.}
-\item{key_from}{(\code{character}) keys used in the first selector while joining}
+\item{key_from}{(\code{character}) keys used in the first selector while joining.}
}
\value{
-(\code{character})
+\code{character} vector of selector keys.
}
\description{
Gets keys vector from keys list
}
\details{
-This function covers up to now 4 cases
+This function covers up to now 4 cases:
\itemize{
-\item dataset without parent: Primary keys are returned
-\item dataset source = dataset target:
+\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
+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 df54f82c..d7ff0be0 100644
--- a/man/get_relabel_call.Rd
+++ b/man/get_relabel_call.Rd
@@ -7,11 +7,11 @@
get_relabel_call(labels)
}
\arguments{
-\item{labels}{(\verb{named character})
+\item{labels}{(named \code{character})
where name is name is function argument name and value is a function argument value.}
}
\value{
-(\code{call}) object with relabel step
+\code{call} object with relabel step.
}
\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_relabel_cols.Rd b/man/get_relabel_cols.Rd
index bfa63ec3..a4ebd961 100644
--- a/man/get_relabel_cols.Rd
+++ b/man/get_relabel_cols.Rd
@@ -7,14 +7,14 @@
get_relabel_cols(columns_source, dplyr_call_data)
}
\arguments{
-\item{columns_source}{\code{list}}
+\item{columns_source}{(\code{list})}
-\item{dplyr_call_data}{\code{list}}
+\item{dplyr_call_data}{(\code{list})}
}
\value{
-columns_source \code{list} without columns which has been reshaped
+\code{columns_source} list without columns that have been reshaped.
}
\description{
-Get columns to relabel excluding these which has been reshaped (pivot_wider)
+Get columns to relabel excluding these which has been reshaped (pivot_wider).
}
\keyword{internal}
diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd
index 92e9a89d..c4c21fdc 100644
--- a/man/get_rename_call.Rd
+++ b/man/get_rename_call.Rd
@@ -21,7 +21,7 @@ ids of the respective
\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
-\item{join_keys}{(\code{join_keys}) nested list of keys used for joining}
+\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,
selections, reshapes etc. All necessary data for merging.}
diff --git a/man/get_reshape_call.Rd b/man/get_reshape_call.Rd
index b68cb2a7..9edb7e38 100644
--- a/man/get_reshape_call.Rd
+++ b/man/get_reshape_call.Rd
@@ -21,7 +21,7 @@ ids of the respective
\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
-\item{join_keys}{(\code{join_keys}) nested list of keys used for joining}
+\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,
selections, reshapes etc. All necessary data for merging.}
diff --git a/man/include_css_files.Rd b/man/include_css_files.Rd
index 76ac430d..f678d4ea 100644
--- a/man/include_css_files.Rd
+++ b/man/include_css_files.Rd
@@ -7,14 +7,15 @@
include_css_files(pattern = "*")
}
\arguments{
-\item{pattern}{(\code{character}) pattern of files to be included}
+\item{pattern}{(\code{character}) pattern of files to be included.}
}
\value{
-HTML code that includes \code{CSS} files
+HTML code that includes \code{CSS} files.
}
\description{
\code{system.file} should not be used to access files in other packages, it does
-not work with \code{devtools}. Therefore, we redefine this method in each package
-as needed. Thus, we do not export this method
+not work with \code{devtools}.
+Therefore, we redefine this method in each package as needed.
+Thus, we do not export this method
}
\keyword{internal}
diff --git a/man/list_extract_spec.Rd b/man/list_extract_spec.Rd
index 3e0b02c5..5bf398a7 100644
--- a/man/list_extract_spec.Rd
+++ b/man/list_extract_spec.Rd
@@ -2,17 +2,17 @@
% Please edit documentation in R/input_checks.R
\name{list_extract_spec}
\alias{list_extract_spec}
-\title{Make sure that the extract spec has list form}
+\title{Make sure that the extract specification is in list format}
\usage{
list_extract_spec(x, allow_null = FALSE)
}
\arguments{
-\item{x}{\code{data_extract_spec} a single \code{data_extract_spec} or list of these}
+\item{x}{(\code{data_extract_spec} or \code{list}) of \code{data_extract_spec} elements.}
-\item{allow_null}{\code{logical} whether x can be \code{NULL}}
+\item{allow_null}{(\code{logical}) whether x can be \code{NULL}.}
}
\value{
-x as a list if it is not already
+\code{x} as a list if it is not already.
}
\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/merge_datasets.Rd b/man/merge_datasets.Rd
index 7c88987f..014c047f 100644
--- a/man/merge_datasets.Rd
+++ b/man/merge_datasets.Rd
@@ -37,20 +37,20 @@ A character string of a function that accepts the arguments
Name of the analysis dataset.}
}
\value{
-merged_dataset (\code{list}) containing:
+\code{merged_dataset} list containing:
\itemize{
-\item \code{expr} (\code{list} of \code{call}) code needed to replicate merged dataset.
-\item \code{columns_source} (\code{list}) of column names selected for particular selector.
+\item \code{expr} (\code{list} of \code{call}) code needed to replicate merged dataset;
+\item \code{columns_source} (\code{list}) of column names selected for particular selector;
Each list element contains named character vector where:
\itemize{
\item Values are the names of the columns in the \code{ANL}. In case if the same column name is selected in more than one
selector it gets prefixed by the id of the selector. For example if two \code{data_extract} have id \code{x}, \code{y}, then
-their duplicated selected variable (for example \code{AGE}) is prefixed to be \code{x.AGE} and \code{y.AGE}.
-\item Names of the vector denote names of the variables in the input dataset.
-\item \code{attr(,"dataname")} to indicate which dataset variable is merged from.
-\item \code{attr(, "always selected")} to denote the names of the variables which need to be always selected.
+their duplicated selected variable (for example \code{AGE}) is prefixed to be \code{x.AGE} and \code{y.AGE};
+\item Names of the vector denote names of the variables in the input dataset;
+\item \code{attr(,"dataname")} to indicate which dataset variable is merged from;
+\item \code{attr(, "always selected")} to denote the names of the variables which need to be always selected;
}
-\item \code{keys} (\code{list}) the keys of the merged dataset.
+\item \code{keys} (\code{list}) the keys of the merged dataset;
\item \code{filter_info} (\code{list}) The information given by the user. This information
defines the filters that are applied on the data. Additionally it defines
the variables that are selected from the data sets.
@@ -58,7 +58,8 @@ the variables that are selected from the data sets.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
-It combines/merges multiple datasets with specified keys attribute.
+
+Combines/merges multiple datasets with specified keys attribute.
}
\details{
Internally this function uses calls to allow reproducibility.
@@ -118,5 +119,4 @@ merged_datasets <- isolate(
)
paste(merged_datasets$expr)
-
}
diff --git a/man/merge_selectors.Rd b/man/merge_selectors.Rd
index f1e86511..6d9ba3a7 100644
--- a/man/merge_selectors.Rd
+++ b/man/merge_selectors.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/merge_datasets.R
\name{merge_selectors}
\alias{merge_selectors}
-\title{Merge selectors - select item if all of \code{dataname}, reshape, filters and keys items are identical}
+\title{Merge selectors when \code{dataname}, \code{reshape}, \code{filters} and \code{keys} entries are identical}
\usage{
merge_selectors(selector_list)
}
@@ -15,10 +15,11 @@ ids of the respective
\code{\link[=data_extract_ui]{data_extract_ui()}}.}
}
\value{
-error or nothing
+List of merged selectors or original parameter if the conditions to merge are
+not applicable.
}
\description{
-Merge selectors - select item if all of \code{dataname}, reshape, filters and keys items are identical
+Merge selectors when \code{dataname}, \code{reshape}, \code{filters} and \code{keys} entries are identical
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/parse_merge_key_i.Rd b/man/parse_merge_key_i.Rd
index a9f99959..d97c552e 100644
--- a/man/parse_merge_key_i.Rd
+++ b/man/parse_merge_key_i.Rd
@@ -19,11 +19,14 @@ 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}
+\item{idx}{optional (\code{integer}) current selector index in all selectors list.}
-\item{dplyr_call_data}{(\code{list}) simplified selectors with aggregated set of filters,}
+\item{dplyr_call_data}{(\code{list}) simplified selectors with aggregated set of filters.}
-\item{merge_key}{keys obtained from \code{get_merge_key_i}}
+\item{merge_key}{keys obtained from \code{get_merge_key_i}.}
+}
+\value{
+\code{call} with merge keys.
}
\description{
Parses merge keys
diff --git a/man/validate_keys_sufficient.Rd b/man/validate_keys_sufficient.Rd
index 4709e08b..2217f2a8 100644
--- a/man/validate_keys_sufficient.Rd
+++ b/man/validate_keys_sufficient.Rd
@@ -7,13 +7,13 @@
validate_keys_sufficient(join_keys, merged_selector_list)
}
\arguments{
-\item{join_keys}{(\code{join_keys}) the provided join keys}
+\item{join_keys}{(\code{join_keys}) the provided join keys.}
-\item{merged_selector_list}{(\code{list}) the specification of datasets' slices to merge}
+\item{merged_selector_list}{(\code{list}) the specification of datasets' slices to merge.}
}
\value{
-\code{TRUE} if the provided keys meet the requirements; the \code{shiny}
-validate error otherwise
+\code{TRUE} if the provided keys meet the requirement and \code{shiny}
+validate error otherwise.
}
\description{
Validates whether the provided keys are sufficient to merge the datasets slices
From ce04c69d4443942331285d9d61a5160df41aee9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Thu, 8 Feb 2024 17:39:48 +0100
Subject: [PATCH 25/62] files 24-30/30: Title case, return params, full stop
params/descr/details/return
---
NAMESPACE | 1 +
R/Queue.R | 22 ++++++-------
R/merge_expression_module.R | 30 ++++++++----------
R/resolve.R | 30 +++++++++---------
R/resolve_delayed.R | 11 ++++---
R/select_spec.R | 46 +++++++++++++---------------
R/utils.R | 46 +++++++++++++++++++---------
man/Queue.Rd | 19 ++++++------
man/compose_and_enable_validators.Rd | 2 +-
man/extract_choices_labels.Rd | 6 ++--
man/get_anl_relabel_call.Rd | 6 ++--
man/merge_datasets.Rd | 6 ++--
man/merge_expression_module.Rd | 4 +--
man/merge_expression_srv.Rd | 10 +++---
man/resolve.Rd | 12 +++-----
man/resolve_delayed.Rd | 19 +++++++++++-
man/select_spec.Rd | 16 +++++-----
man/split_by_sep.Rd | 10 ++++--
18 files changed, 165 insertions(+), 131 deletions(-)
diff --git a/NAMESPACE b/NAMESPACE
index 49700e8d..7cef7a44 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -58,6 +58,7 @@ export(merge_datasets)
export(merge_expression_module)
export(merge_expression_srv)
export(no_selected_as_NULL)
+export(resolve)
export(resolve_delayed)
export(select_spec)
export(select_spec.default)
diff --git a/R/Queue.R b/R/Queue.R
index cdd22252..7e1f1977 100644
--- a/R/Queue.R
+++ b/R/Queue.R
@@ -1,6 +1,6 @@
# Queue ====
-#' @title R6 Class - A First-In-First-Out Abstract Data Type
+#' R6 Class - A First-In-First-Out Abstract Data Type
#'
#' @description
#' `r lifecycle::badge("experimental")`
@@ -21,9 +21,9 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Adds element(s) to `Queue`.
#'
- #' @param new_elements vector of elements to add
+ #' @param new_elements vector of elements to add.
#'
- #' @return self invisibly
+ #' @return Self, invisibly.
#'
push = function(new_elements) {
for (i in seq_along(new_elements)) {
@@ -36,7 +36,7 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Returns all contents of the `Queue` object.
#'
- #' @return single vector containing all `Queue` contents
+ #' @return Single vector containing all `Queue` contents.
#'
get = function() {
private$array
@@ -44,8 +44,8 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Returns the first (oldest) element of the `Queue` and removes it.
#'
- #' @return
- #' vector of length 1 containing the first element of `Queue` or NULL if `Queue` is empty
+ #' @return vector of length 1 containing the first element of `Queue`
+ #' or `NULL` if `Queue` is empty.
#'
pop = function() {
returned_element <- self$get()[1L]
@@ -56,9 +56,9 @@ Queue <- R6::R6Class( # nolint
#' Removes the oldest occurrence of specified element(s) from `Queue`.
#' Relies on implicit type conversions of R identify elements to remove.
#'
- #' @param elements vector of elements to remove from `Queue`
+ #' @param elements vector of elements to remove from `Queue`.
#'
- #' @return self invisibly
+ #' @return Self, invisibly.
#'
remove = function(elements) {
for (el in elements) {
@@ -70,7 +70,7 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Removes all elements from `Queue`.
#'
- #' @return self invisibly
+ #' @return Self, invisibly.
#'
empty = function() {
private$array <- c()
@@ -79,7 +79,7 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Returns the number of elements in `Queue`.
#'
- #' @return integer of length 1
+ #' @return Integer of length 1.
#'
size = function() {
length(self$get())
@@ -87,7 +87,7 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Prints this `Queue`.
#'
- #' @param ... additional arguments to this method, ignored
+ #' @param ... Additional arguments to this method, ignored.
#'
#' @return invisibly self
print = function(...) {
diff --git a/R/merge_expression_module.R b/R/merge_expression_module.R
index 063ca2eb..a9158146 100644
--- a/R/merge_expression_module.R
+++ b/R/merge_expression_module.R
@@ -1,7 +1,8 @@
#' Merge expression module
#'
-#' @description `r lifecycle::badge("experimental")`
-#' @details This function is a convenient wrapper to combine `data_extract_multiple_srv()` and
+#' `r lifecycle::badge("experimental")`
+#'
+#' This function is a convenient wrapper to combine `data_extract_multiple_srv()` and
#' `merge_expression_srv()` when no additional processing is required.
#' Compare the example below with that found in [merge_expression_srv()].
#'
@@ -13,14 +14,14 @@
#' @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 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()].
+#' @return Reactive expression with output from [merge_expression_srv()].
#'
#' @seealso [merge_expression_srv()]
#'
@@ -134,6 +135,7 @@
#' shinyApp(app$ui, app$server)
#' }
#' @export
+#'
merge_expression_module <- function(datasets,
join_keys = NULL,
data_extract,
@@ -145,6 +147,7 @@ merge_expression_module <- function(datasets,
#' @rdname merge_expression_module
#' @export
+#'
merge_expression_module.reactive <- function(datasets,
join_keys = NULL,
data_extract,
@@ -161,6 +164,7 @@ merge_expression_module.reactive <- function(datasets,
#' @rdname merge_expression_module
#' @export
+#'
merge_expression_module.list <- function(datasets,
join_keys = NULL,
data_extract,
@@ -189,7 +193,6 @@ merge_expression_module.list <- function(datasets,
)
}
-
#' Data merge module server
#'
#' `r lifecycle::badge("experimental")`
@@ -199,14 +202,7 @@ merge_expression_module.list <- function(datasets,
#' 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`)
-#' 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.
+#' @inheritParams merge_expression_module
#' @param selector_list (`reactive`)
#' output from [data_extract_multiple_srv()] or a reactive named list of
#' outputs from [data_extract_srv()].
@@ -219,11 +215,9 @@ merge_expression_module.list <- function(datasets,
#' @param anl_name (`character(1)`)
#' Name of the analysis dataset.
#'
-#' @return reactive expression with output from [merge_datasets()].
-#'
-#' @seealso [merge_expression_srv()]
+#' @inherit merge_expression_module return
#'
-#' @export
+#' @seealso [merge_expression_module()]
#'
#' @examples
#' library(shiny)
@@ -340,6 +334,8 @@ merge_expression_module.list <- function(datasets,
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
+#' @export
+#'
merge_expression_srv <- function(id = "merge_id",
selector_list,
datasets,
diff --git a/R/resolve.R b/R/resolve.R
index 24d4f292..4efc0448 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -1,19 +1,17 @@
#' Resolve delayed inputs by evaluating the code within the provided datasets
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
-#' @param x Object of class `delayed_data` to resolve.
-#' @param datasets A named list of type `data.frame` to use for evaluation.
-#' @param keys A named list of type `character` to be used as the keys for each dataset. The names of this
-#' list must be exactly the same as for datasets.
+#' @param x (`delayed_data`) object to resolve.
+#' @param datasets (named `list` of `data.frame`) to use in evaluation.
+#' @param keys (named `list` of `character`) to be used as the keys for each dataset.
+#' The names of this list must be exactly the same as for datasets.
#'
#' @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))
#' keys <- list(ADSL = attr(ADSL, "keys"))
@@ -66,6 +64,8 @@
#'
#' resolve(arm_ref_comp, data_list, keys)
#' })
+#' @export
+#'
resolve <- function(x, datasets, keys = NULL) {
checkmate::assert_list(datasets, types = "reactive", min.len = 1, names = "named")
checkmate::assert_list(keys, "character", names = "named", null.ok = TRUE)
@@ -79,7 +79,7 @@ resolve <- function(x, datasets, keys = NULL) {
}
#' @export
-resolve.delayed_variable_choices <- function(x, datasets, keys) { # nolint
+resolve.delayed_variable_choices <- function(x, datasets, keys) {
if (is.null(x$key)) {
x$key <- `if`(is.null(keys), character(), keys[[x$data]])
}
@@ -91,7 +91,7 @@ resolve.delayed_variable_choices <- function(x, datasets, keys) { # nolint
}
#' @export
-resolve.delayed_value_choices <- function(x, datasets, keys) { # nolint
+resolve.delayed_value_choices <- function(x, datasets, keys) {
x$data <- datasets[[x$data]]()
if (is.function(x$subset)) {
x$subset <- resolve_delayed_expr(x$subset, ds = x$data, is_value_choices = TRUE)
@@ -100,7 +100,7 @@ resolve.delayed_value_choices <- function(x, datasets, keys) { # nolint
}
#' @export
-resolve.delayed_choices_selected <- function(x, datasets, keys) { # nolint
+resolve.delayed_choices_selected <- function(x, datasets, keys) {
if (inherits(x$selected, "delayed_data")) {
x$selected <- resolve(x$selected, datasets = datasets, keys)
}
@@ -119,7 +119,7 @@ resolve.delayed_choices_selected <- function(x, datasets, keys) { # nolint
}
#' @export
-resolve.delayed_select_spec <- function(x, datasets, keys) { # nolint
+resolve.delayed_select_spec <- function(x, datasets, keys) {
x$choices <- resolve(x$choices, datasets = datasets, keys)
if (inherits(x$selected, "delayed_data")) {
x$selected <- resolve(x$selected, datasets = datasets, keys)
@@ -128,7 +128,7 @@ resolve.delayed_select_spec <- function(x, datasets, keys) { # nolint
}
#' @export
-resolve.delayed_filter_spec <- function(x, datasets, keys) { # nolint
+resolve.delayed_filter_spec <- function(x, datasets, keys) {
if (inherits(x$vars_choices, "delayed_data")) {
x$vars_choices <- resolve(x$vars_choices, datasets = datasets, keys)
}
@@ -146,7 +146,7 @@ resolve.delayed_filter_spec <- function(x, datasets, keys) { # nolint
}
#' @export
-resolve.delayed_data_extract_spec <- function(x, datasets, keys) { # nolint
+resolve.delayed_data_extract_spec <- function(x, datasets, keys) {
x$select <- `if`(
inherits(x$select, "delayed_data"),
resolve(x$select, datasets = datasets, keys),
@@ -162,7 +162,7 @@ resolve.delayed_data_extract_spec <- function(x, datasets, keys) { # nolint
}
#' @export
-resolve.list <- function(x, datasets, keys) { # nolint
+resolve.list <- function(x, datasets, keys) {
# If specified explicitly, return it unchanged. Otherwise if delayed, resolve.
res <- lapply(x, resolve, datasets = datasets, keys = keys)
return(res)
diff --git a/R/resolve_delayed.R b/R/resolve_delayed.R
index 0ae03fba..8d76f6e1 100644
--- a/R/resolve_delayed.R
+++ b/R/resolve_delayed.R
@@ -1,16 +1,14 @@
#' Resolve delayed inputs by evaluating the code within the provided datasets
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
#'
#' @param x (`delayed_data`, `list`) to resolve.
#' @param datasets (`FilteredData` or named `list`) to use as a reference to resolve `x`.
#' @param keys (named `list`) with primary keys for each dataset from `datasets`. `names(keys)`
-#' should match `names(datasets)`
+#' should match `names(datasets)`.
#'
#' @return Resolved object.
#'
-#' @export
-#'
#' @examples
#' ADSL <- teal.transform::rADSL
#' shiny::isolate({
@@ -64,11 +62,13 @@
#'
#' resolve_delayed(arm_ref_comp, datasets = data_list)
#' })
+#' @export
+#'
resolve_delayed <- function(x, datasets, keys) {
UseMethod("resolve_delayed", datasets)
}
-
+#' @describeIn resolve_delayed Default values for `keys` parameters is extracted from `datasets`.
#' @export
resolve_delayed.FilteredData <- function(x,
datasets,
@@ -79,6 +79,7 @@ resolve_delayed.FilteredData <- function(x,
resolve(x, datasets_list, keys)
}
+#' @describeIn resolve_delayed Generic method when `datasets` argument is a named list.
#' @export
resolve_delayed.list <- function(x, datasets, keys = NULL) {
checkmate::assert_list(datasets, types = c("reactive", "data.frame"), min.len = 1, names = "named")
diff --git a/R/select_spec.R b/R/select_spec.R
index a981e718..7f919692 100644
--- a/R/select_spec.R
+++ b/R/select_spec.R
@@ -1,44 +1,38 @@
#' Column selection input specification
#'
-#' @description `r lifecycle::badge("stable")`
+#' @description
+#' `r lifecycle::badge("stable")`
+#'
#' `select_spec` is used inside `teal` to create a [shiny::selectInput()]
#' that will select columns from a dataset.
#'
-#' @param choices (`character`) or (`delayed_data`) object.
-#' Named character vector to define the 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()].
+#' @rdname select_spec
#'
-#' @param selected optional (`character` or `NULL` or `all_choices` or `delayed_data` object).
+#' @param choices (`character` or `delayed_data`) object.
+#' Named character vector to define the 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 `character`, `NULL`, `all_choices` or `delayed_data`).
#' 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 `choices` or `NULL` for delayed data loading.
-#'
#' @param multiple (`logical`) Whether multiple values shall be allowed in the
-#' shiny [shiny::selectInput()].
-#'
-#' @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.
-#'
+#' shiny [shiny::selectInput()].
+#' @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 (`character`) Additional column names from the data set that should
-#' always be selected
-#'
+#' always be selected
#' @param ordered (`logical(1)`) Flags whether selection order should be tracked.
-#'
-#' @param label optional (`character`). Define a label on top of this specific
+#' @param label (optional `character`). Define a label on top of this specific
#' shiny [shiny::selectInput()]. The default value is `"Select"`.
#'
#' @return A `select_spec`-S3 class object or `delayed_select_spec`-S3-class object.
#' It contains all input values.
-#' If `select_spec`, then the function double checks the `choices` and `selected` inputs.
-#'
#'
-#' @rdname select_spec
-#'
-#' @export
+#' If `select_spec`, then the function double checks the `choices` and `selected` inputs.
#'
#' @examples
#' # Selection with just one column allowed
@@ -87,6 +81,8 @@
#' # Both below objects are semantically the same
#' select_spec(choices = variable_choices("ADSL"), selected = variable_choices("ADSL"))
#' select_spec(choices = variable_choices("ADSL"), selected = all_choices())
+#' @export
+#'
select_spec <- function(choices,
selected = `if`(inherits(choices, "delayed_data"), NULL, choices[1]),
multiple = length(selected) > 1 || inherits(selected, "all_choices"),
@@ -112,6 +108,7 @@ select_spec <- function(choices,
#' @rdname select_spec
#' @export
+#'
select_spec.delayed_data <- function(choices, # nolint
selected = NULL,
multiple = length(selected) > 1,
@@ -138,6 +135,7 @@ select_spec.delayed_data <- function(choices, # nolint
#' @rdname select_spec
#' @export
+#'
select_spec.default <- function(choices, # nolint
selected = choices[1],
multiple = length(selected) > 1,
diff --git a/R/utils.R b/R/utils.R
index 2e1ed876..4872f720 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -1,11 +1,15 @@
-# also returns a list if only a single element
-#' Split by separator
+#' Split by separator (matched exactly)
#'
-#' @description `r lifecycle::badge("stable")`
+#' `r lifecycle::badge("stable")`
+#'
+#' @param x (`character`) Character vector, each element of which is to be split.
+#' Other inputs, including a factor return themselves.
+#' @param sep (`character`) separator to use for splitting.
+#'
+#' @return List of character vectors split by `sep`. Self if `x` is not a `character`.
#'
-#' @param x (`character`) Character (single)
-#' @param sep (`character`) Separator
#' @export
+#'
split_by_sep <- function(x, sep) {
stopifnot(is.atomic(x))
if (is.character(x)) {
@@ -17,10 +21,11 @@ split_by_sep <- function(x, sep) {
#' Extract labels from choices basing on attributes and names
#'
-#' @param choices (`list` or `vector`) select choices
-#' @param values optional, choices subset for which labels should be extracted, `NULL` for all choices
+#' @param choices (`list` or `vector`) select choices.
+#' @param values optional, choices subset for which labels should be extracted, `NULL` for all choices.
+#'
+#' @return `character` vector with labels.
#'
-#' @return (`character`) vector with labels
#' @keywords internal
#'
extract_choices_labels <- function(choices, values = NULL) {
@@ -44,18 +49,19 @@ extract_choices_labels <- function(choices, values = NULL) {
#'
#' This function takes the output from `data_extract_multiple_srv` and
#' collates the `shinyvalidate::InputValidator`s returned into a single
-#' `validator` and enables this
+#' `validator` and enables this.
#'
#' @param iv (`shinyvalidate::InputValidator`) A `validator`.
#' @param selector_list (`reactive` named list of `reactives`).
-#' Typically this is the output from `data_extract_multiple_srv`.
-#' The `validators` in this list (specifically `selector_list()[[validator_names]]()iv`)
-#' will be added into `iv`.
+#' Typically this is the output from `data_extract_multiple_srv`.
+#' The `validators` in this list (specifically `selector_list()[[validator_names]]()iv`)
+#' will be added into `iv`.
#' @param validator_names (`character` or `NULL`). If `character` then only `validators`
-#' in the elements of `selector_list()` whose name is in this list will be added. If `NULL`
-#' all `validators` will be added
+#' in the elements of `selector_list()` whose name is in this list will be added. If `NULL`
+#' all `validators` will be added
+#'
#' @return (`shinyvalidate::InputValidator`) enabled `iv` with appropriate `validators` added into it.
-#' @export
+#'
#' @examples
#' library(shiny)
#' library(shinyvalidate)
@@ -141,6 +147,8 @@ extract_choices_labels <- function(choices, values = NULL) {
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
+#' @export
+#'
compose_and_enable_validators <- function(iv, selector_list, validator_names = NULL) {
if (is.null(validator_names)) {
validator_names <- names(selector_list())
@@ -157,6 +165,14 @@ compose_and_enable_validators <- function(iv, selector_list, validator_names = N
iv
}
+#' Ensures datasets is a list of reactive expression
+#'
+#' @param datasets (`reactive` `teal_data` object or `list`) of `data.frame`
+#' wrapped or not in a reactive expression.
+#'
+#' @return List of reactive expression that contains all the individual `datasets`.
+#'
+#' @noRd
convert_teal_data <- function(datasets) {
if (is.list(datasets)) {
sapply(X = datasets, simplify = FALSE, FUN = function(x) {
diff --git a/man/Queue.Rd b/man/Queue.Rd
index 3effafac..e86adc2c 100644
--- a/man/Queue.Rd
+++ b/man/Queue.Rd
@@ -39,12 +39,12 @@ Adds element(s) to \code{Queue}.
\subsection{Arguments}{
\if{html}{\out{}}
\describe{
-\item{\code{new_elements}}{vector of elements to add}
+\item{\code{new_elements}}{vector of elements to add.}
}
\if{html}{\out{
}}
}
\subsection{Returns}{
-self invisibly
+Self, invisibly.
}
}
\if{html}{\out{ }}
@@ -57,7 +57,7 @@ Returns all contents of the \code{Queue} object.
}
\subsection{Returns}{
-single vector containing all \code{Queue} contents
+Single vector containing all \code{Queue} contents.
}
}
\if{html}{\out{ }}
@@ -70,7 +70,8 @@ Returns the first (oldest) element of the \code{Queue} and removes it.
}
\subsection{Returns}{
-vector of length 1 containing the first element of \code{Queue} or NULL if \code{Queue} is empty
+vector of length 1 containing the first element of \code{Queue}
+or \code{NULL} if \code{Queue} is empty.
}
}
\if{html}{\out{ }}
@@ -86,12 +87,12 @@ Relies on implicit type conversions of R identify elements to remove.
\subsection{Arguments}{
\if{html}{\out{}}
\describe{
-\item{\code{elements}}{vector of elements to remove from \code{Queue}}
+\item{\code{elements}}{vector of elements to remove from \code{Queue}.}
}
\if{html}{\out{
}}
}
\subsection{Returns}{
-self invisibly
+Self, invisibly.
}
}
\if{html}{\out{ }}
@@ -104,7 +105,7 @@ Removes all elements from \code{Queue}.
}
\subsection{Returns}{
-self invisibly
+Self, invisibly.
}
}
\if{html}{\out{ }}
@@ -117,7 +118,7 @@ Returns the number of elements in \code{Queue}.
}
\subsection{Returns}{
-integer of length 1
+Integer of length 1.
}
}
\if{html}{\out{ }}
@@ -132,7 +133,7 @@ Prints this \code{Queue}.
\subsection{Arguments}{
\if{html}{\out{}}
\describe{
-\item{\code{...}}{additional arguments to this method, ignored}
+\item{\code{...}}{Additional arguments to this method, ignored.}
}
\if{html}{\out{
}}
}
diff --git a/man/compose_and_enable_validators.Rd b/man/compose_and_enable_validators.Rd
index cddce526..91c7d3aa 100644
--- a/man/compose_and_enable_validators.Rd
+++ b/man/compose_and_enable_validators.Rd
@@ -24,7 +24,7 @@ all \code{validators} will be added}
\description{
This function takes the output from \code{data_extract_multiple_srv} and
collates the \code{shinyvalidate::InputValidator}s returned into a single
-\code{validator} and enables this
+\code{validator} and enables this.
}
\examples{
library(shiny)
diff --git a/man/extract_choices_labels.Rd b/man/extract_choices_labels.Rd
index d893c01a..280053de 100644
--- a/man/extract_choices_labels.Rd
+++ b/man/extract_choices_labels.Rd
@@ -7,12 +7,12 @@
extract_choices_labels(choices, values = NULL)
}
\arguments{
-\item{choices}{(\code{list} or \code{vector}) select choices}
+\item{choices}{(\code{list} or \code{vector}) select choices.}
-\item{values}{optional, choices subset for which labels should be extracted, \code{NULL} for all choices}
+\item{values}{optional, choices subset for which labels should be extracted, \code{NULL} for all choices.}
}
\value{
-(\code{character}) vector with labels
+\code{character} vector with labels.
}
\description{
Extract labels from choices basing on attributes and names
diff --git a/man/get_anl_relabel_call.Rd b/man/get_anl_relabel_call.Rd
index 3c6e1c4d..41fda20c 100644
--- a/man/get_anl_relabel_call.Rd
+++ b/man/get_anl_relabel_call.Rd
@@ -11,9 +11,9 @@ get_anl_relabel_call(columns_source, datasets, anl_name = "ANL")
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})
-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.}
+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)})
Name of the analysis dataset.}
diff --git a/man/merge_datasets.Rd b/man/merge_datasets.Rd
index 014c047f..3d8f727b 100644
--- a/man/merge_datasets.Rd
+++ b/man/merge_datasets.Rd
@@ -21,9 +21,9 @@ 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})
-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.}
+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})
of variables used as join keys for each of the datasets in \code{datasets}.
diff --git a/man/merge_expression_module.Rd b/man/merge_expression_module.Rd
index 62a165dd..f879be09 100644
--- a/man/merge_expression_module.Rd
+++ b/man/merge_expression_module.Rd
@@ -43,7 +43,7 @@ converted to reactive \code{data.frame} objects internally.}
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})}
+\item{data_extract}{(named \code{list} of \code{data_extract_spec}).}
\item{merge_function}{(\code{character(1)})
A character string of a function that accepts the arguments \code{x}, \code{y} and
@@ -56,7 +56,7 @@ Name of the analysis dataset.}
UI function.}
}
\value{
-reactive expression with output from \code{\link[=merge_expression_srv]{merge_expression_srv()}}.
+Reactive expression with output from \code{\link[=merge_expression_srv]{merge_expression_srv()}}.
}
\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/merge_expression_srv.Rd b/man/merge_expression_srv.Rd
index 6140f59f..e15825c0 100644
--- a/man/merge_expression_srv.Rd
+++ b/man/merge_expression_srv.Rd
@@ -45,9 +45,9 @@ 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})
-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.}
+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})
of variables used as join keys for each of the datasets in \code{datasets}.
@@ -61,7 +61,7 @@ A character string of a function that accepts the arguments
Name of the analysis dataset.}
}
\value{
-reactive expression with output from \code{\link[=merge_datasets]{merge_datasets()}}.
+Reactive expression with output from \code{\link[=merge_expression_srv]{merge_expression_srv()}}.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
@@ -189,5 +189,5 @@ if (interactive()) {
}
}
\seealso{
-\code{\link[=merge_expression_srv]{merge_expression_srv()}}
+\code{\link[=merge_expression_module]{merge_expression_module()}}
}
diff --git a/man/resolve.Rd b/man/resolve.Rd
index fceacde5..5dfa93be 100644
--- a/man/resolve.Rd
+++ b/man/resolve.Rd
@@ -7,12 +7,12 @@
resolve(x, datasets, keys = NULL)
}
\arguments{
-\item{x}{Object of class \code{delayed_data} to resolve.}
+\item{x}{(\code{delayed_data}) object to resolve.}
-\item{datasets}{A named list of type \code{data.frame} to use for evaluation.}
+\item{datasets}{(named \code{list} of \code{data.frame}) to use in evaluation.}
-\item{keys}{A named list of type \code{character} to be used as the keys for each dataset. The names of this
-list must be exactly the same as for datasets.}
+\item{keys}{(named \code{list} of \code{character}) to be used as the keys for each dataset.
+The names of this list must be exactly the same as for datasets.}
}
\value{
Resolved object.
@@ -21,10 +21,8 @@ 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))
keys <- list(ADSL = attr(ADSL, "keys"))
diff --git a/man/resolve_delayed.Rd b/man/resolve_delayed.Rd
index 9cfb16e8..cfdd2dc5 100644
--- a/man/resolve_delayed.Rd
+++ b/man/resolve_delayed.Rd
@@ -2,9 +2,19 @@
% Please edit documentation in R/resolve_delayed.R
\name{resolve_delayed}
\alias{resolve_delayed}
+\alias{resolve_delayed.FilteredData}
+\alias{resolve_delayed.list}
\title{Resolve delayed inputs by evaluating the code within the provided datasets}
\usage{
resolve_delayed(x, datasets, keys)
+
+\method{resolve_delayed}{FilteredData}(
+ x,
+ datasets,
+ keys = sapply(datasets$datanames(), datasets$get_keys, simplify = FALSE)
+)
+
+\method{resolve_delayed}{list}(x, datasets, keys = NULL)
}
\arguments{
\item{x}{(\code{delayed_data}, \code{list}) to resolve.}
@@ -12,7 +22,7 @@ resolve_delayed(x, datasets, keys)
\item{datasets}{(\code{FilteredData} or named \code{list}) to use as a reference to resolve \code{x}.}
\item{keys}{(named \code{list}) with primary keys for each dataset from \code{datasets}. \code{names(keys)}
-should match \code{names(datasets)}}
+should match \code{names(datasets)}.}
}
\value{
Resolved object.
@@ -20,6 +30,13 @@ Resolved object.
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
+\section{Methods (by class)}{
+\itemize{
+\item \code{resolve_delayed(FilteredData)}: Default values for \code{keys} parameters is extracted from \code{datasets}.
+
+\item \code{resolve_delayed(list)}: Generic method when \code{datasets} argument is a named list.
+
+}}
\examples{
ADSL <- teal.transform::rADSL
shiny::isolate({
diff --git a/man/select_spec.Rd b/man/select_spec.Rd
index 042d7522..29e521cb 100644
--- a/man/select_spec.Rd
+++ b/man/select_spec.Rd
@@ -37,13 +37,13 @@ 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]{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.
+\item{choices}{(\code{character} or \code{delayed_data}) object.
+Named character vector to define the 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).
+\item{selected}{(optional \code{character}, \code{NULL}, \code{all_choices} or \code{delayed_data}).
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.}
@@ -51,7 +51,7 @@ Defaults to the first value of \code{choices} or \code{NULL} for delayed data lo
\item{multiple}{(\code{logical}) Whether multiple values shall be allowed in the
shiny \code{\link[shiny:selectInput]{shiny::selectInput()}}.}
-\item{fixed}{optional (\code{logical}). \code{\link[=data_extract_spec]{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.}
@@ -61,16 +61,18 @@ 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
+\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{"Select"}.}
}
\value{
A \code{select_spec}-S3 class object or \code{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.
}
\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]{shiny::selectInput()}}
that will select columns from a dataset.
}
diff --git a/man/split_by_sep.Rd b/man/split_by_sep.Rd
index dbebeed4..6f95daa4 100644
--- a/man/split_by_sep.Rd
+++ b/man/split_by_sep.Rd
@@ -2,14 +2,18 @@
% Please edit documentation in R/utils.R
\name{split_by_sep}
\alias{split_by_sep}
-\title{Split by separator}
+\title{Split by separator (matched exactly)}
\usage{
split_by_sep(x, sep)
}
\arguments{
-\item{x}{(\code{character}) Character (single)}
+\item{x}{(\code{character}) Character vector, each element of which is to be split.
+Other inputs, including a factor return themselves.}
-\item{sep}{(\code{character}) Separator}
+\item{sep}{(\code{character}) separator to use for splitting.}
+}
+\value{
+List of character vectors split by \code{sep}. Self if \code{x} is not a \code{character}.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
From a97d7c1567edff7df72241881298b7a72585aebd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Thu, 8 Feb 2024 23:24:23 +0100
Subject: [PATCH 26/62] idr: adds the CRAN Package Release Template
---
.github/ISSUE_TEMPLATE/cran-release.yaml | 121 +++++++++++++++++++++++
1 file changed, 121 insertions(+)
create mode 100644 .github/ISSUE_TEMPLATE/cran-release.yaml
diff --git a/.github/ISSUE_TEMPLATE/cran-release.yaml b/.github/ISSUE_TEMPLATE/cran-release.yaml
new file mode 100644
index 00000000..89298b7c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/cran-release.yaml
@@ -0,0 +1,121 @@
+---
+name: 🎉 CRAN Release
+description: Template for release to CRAN
+title: "[CRAN Release]: "
+labels: ["release"]
+assignees:
+ - KlaudiaBB
+ - cicdguy
+body:
+ - type: markdown
+ attributes:
+ value: |
+ ⚠️ Please do not link or mention any internal references in this issue. This includes internal URLs, intellectual property and references.
+ - type: textarea
+ id: blocked-by
+ attributes:
+ label: Blocked by
+ description: Any PRs or issues that this release is blocked by.
+ placeholder: Add a list of blocking PRs or issues here.
+ value: |
+ #### PRs
+ - [ ] PR 1
+
+ #### Issues
+ - [ ] Issue 1
+ validations:
+ required: true
+ - type: textarea
+ id: pre-release
+ attributes:
+ label: Pre-release
+ description: Pre-requisites that must be fulfilled before initiating the release process.
+ placeholder: Add your list of pre-requisites here.
+ value: |
+ - [ ] Make sure you adhere to CRAN submission policy:
+ * https://cran.r-project.org/web/packages/submission_checklist.html
+ * https://cran.r-project.org/web/packages/policies.html.
+ - [ ] Make sure that high priority bugs (label "priority" + "bug") have been resolved before going into the release.
+ - [ ] Review old/hanging PRs before going into the release (Optional).
+ - [ ] Revisit R-package's lifecycle badges (Optional).
+ - [ ] Make sure that all upstream dependencies of this package that need to be submitted to CRAN were accepted before going into release activities.
+ - [ ] Make sure integration tests are green 2-3 days before the release. Look carefully through logs (check for warnings and notes).
+ - [ ] Decide what gets merged in before starting release activities.
+ - type: textarea
+ id: release
+ attributes:
+ label: Release
+ description: The steps to be taken in order to create a release.
+ placeholder: Steps to create a release.
+ value: |
+ #### Prepare the release
+ - [ ] Create a new release candidate branch
+ `git checkout -b release-candidate-vX.Y.Z`
+ - [ ] Update NEWS.md file: make sure it reflects a holistic summary of what has changed in the package.
+ - [ ] Remove the additional fields (`Remotes`) from the DESCRIPTION file where applicable.
+ - [ ] Make sure that the minimum dependency versions are updated in the DESCRIPTION file for the package and its reverse dependencies (Optional).
+ - [ ] Increase versioned dependency on {package name} to >=X.Y.Z (Optional).
+ - [ ] Commit your changes and create the PR on GitHub (add "[skip vbump]" in the PR title). Add all updates, commit, and push changes:
+ ```r
+ # Make the necessary modifications to your files
+ # Stage the changes
+ git add
+ # Commit the changes
+ git commit -m "[skip vbump] "
+ git push origin release-candidate-vX.Y.Z
+ ```
+
+ #### Test the release
+ - [ ] Execute the manual tests on Shiny apps that are deployed on various hosting providers (Posit connect and shinyapps.io) - track the results in GitHub issue (Applicable only for frameworks that use Shiny).
+ - [ ] Monitor integration tests, if integration fails, create priority issues on the board.
+ - [ ] Execute UAT tests (Optional).
+
+ #### CRAN submission
+ - [ ] Tag the update(s) as a release candidate vX.Y.Z-rc (e.g. v0.5.3-rc1) on the release candidate branch (release-candidate-vX.Y.Z).
+ ```r
+ # Create rc tag for submission for internal validation
+ git tag vX.Y.Z-rc
+ git push origin vX.Y.Z-rc
+ ```
+ - [ ] Build the package locally using the command:`R CMD build .` which will generate a .tar.gz file necessary for the CRAN submission.
+ - [ ] Submit the package to https://win-builder.r-project.org/upload.aspx for testing, for more details please see "Building and checking R source packages for Windows": https://win-builder.r-project.org/.
+ - [ ] Once tested, send the package that was built in the previous steps to CRAN via this form: https://cran.r-project.org/submit.html.
+ - [ ] Address CRAN feedback, tag the package vX.Y.Z-rc(n+1) and repeat the submission to CRAN whenever necessary.
+ - [ ] Get the package accepted and published on CRAN.
+
+ #### Tag the release
+ - [ ] If the additional fields were removed, add them back in a separate PR, and then merge the PR back to main (add "[skip vbump]" in the PR title). If nothing was removed just merge the PR you created in the "Prepare the release" section to 'main'. Note the commit hash of the merged commit. **Note:** additional commits might be added to the `main` branch by a bot or an automation - we do **NOT** want to tag this commit.
+
+ ##### Make sure of the following before continuing
+ - [ ] CI checks are passing in GH before releasing the package.
+ - [ ] Shiny apps are deployable and there are no errors/warnings (Applicable only for frameworks that use Shiny).
+
+ - [ ] Create a git tag with the final version set to vX.Y.Z on the main branch. In order to do this:
+ 1. Checkout the commit hash.
+ `git checkout `
+ 2. Tag the hash with the release version (vX.Y.Z).
+ `git tag vX.Y.Z`
+ 3. Push the tag to make the final release.
+ `git push origin vX.Y.Z`
+ - [ ] Update downstream package dependencies to (>=X.Y.Z) in {package name}.
+ **Note:** Once the release tag is created, the package is automatically published to internal repositories.
+ - type: textarea
+ id: post-release
+ attributes:
+ label: Post-release
+ description: The list of activities to be completed after the release.
+ placeholder: The steps that must be taken after the release.
+ value: |
+ - [ ] Ensure that CRAN checks are passing for the package.
+ - [ ] Make sure that the package is published to internal repositories.
+ - [ ] Make sure internal documentation is up to date.
+ - [ ] Review and update installation instructions for the package wherever needed (Optional).
+ - [ ] Announce the release on ________.
+ - type: textarea
+ id: decision-tree
+ attributes:
+ label: Decision tree
+ description: Any decision tree(s) that would aid release management
+ placeholder: Any decision tree(s) that would aid release management.
+ value: |
+ Click [here](https://github.com/insightsengineering/.github/blob/main/.github/ISSUE_TEMPLATE/RELEASE_DECISION_TREE.md) to see the release decision tree.
From eedf61fddb406b016efc83436c8794a4d89aaee8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Thu, 8 Feb 2024 23:31:49 +0100
Subject: [PATCH 27/62] Remove prefixes from data calls rADRS, rADTTE, etc...
(just like {teal.data})
---
R/choices_labeled.R | 8 ++++----
R/choices_selected.R | 2 +-
R/filter_spec.R | 2 +-
R/resolve.R | 2 +-
R/resolve_delayed.R | 2 +-
README.md | 2 +-
man/choices_labeled.Rd | 4 ++--
man/choices_selected.Rd | 2 +-
man/filter_spec_internal.Rd | 2 +-
man/resolve.Rd | 2 +-
man/resolve_delayed.Rd | 2 +-
man/value_choices.Rd | 2 +-
man/variable_choices.Rd | 2 +-
tests/testthat/test-data_extract_module.R | 4 ++--
tests/testthat/test-data_extract_multiple_srv.R | 6 +++---
tests/testthat/test-data_extract_spec.R | 4 ++--
tests/testthat/test-data_extract_srv.R | 6 +++---
tests/testthat/test-delayed_data_extract.R | 8 ++++----
tests/testthat/test-filter_spec.R | 6 +++---
tests/testthat/test-resolve.R | 4 ++--
tests/testthat/test-resolve_delayed.R | 4 ++--
tests/testthat/test-select_spec.R | 4 ++--
tests/testthat/test-value_choices.R | 4 ++--
tests/testthat/test-variable_choices.R | 4 ++--
vignettes/data-extract-merge.Rmd | 4 ++--
vignettes/data-extract.Rmd | 4 ++--
vignettes/data-merge.Rmd | 4 ++--
27 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 8172a0fe..2c41d78b 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -22,8 +22,8 @@
#' @examples
#' library(shiny)
#'
-#' ADSL <- teal.transform::rADSL
-#' ADTTE <- teal.transform::rADTTE
+#' ADSL <- rADSL
+#' ADTTE <- rADTTE
#'
#' choices1 <- choices_labeled(names(ADSL), teal.data::col_labels(ADSL, fill = FALSE))
#' choices2 <- choices_labeled(ADTTE$PARAMCD, ADTTE$PARAM)
@@ -144,7 +144,7 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
#' @return Named `character` vector with additional attributes or `delayed_data` object.
#'
#' @examples
-#' ADRS <- teal.transform::rADRS
+#' ADRS <- rADRS
#' variable_choices(ADRS)
#' variable_choices(ADRS, subset = c("PARAM", "PARAMCD"))
#' variable_choices(ADRS, subset = c("", "PARAM", "PARAMCD"))
@@ -259,7 +259,7 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
#' @return named character vector or `delayed_data` object.
#'
#' @examples
-#' ADRS <- teal.transform::rADRS
+#' ADRS <- rADRS
#' value_choices(ADRS, "PARAMCD", "PARAM", subset = c("BESRSPI", "INVET"))
#' value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
#' value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"),
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 6430abbb..132c2de9 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -49,7 +49,7 @@ no_select_keyword <- "-- no selection --"
#' selected = "C"
#' )
#'
-#' ADSL <- teal.transform::rADSL
+#' ADSL <- rADSL
#' choices_selected(variable_choices(ADSL), "SEX")
#'
#' # How to select nothing
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 7b6aa5f7..a3817c5c 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -218,7 +218,7 @@ filter_spec <- function(vars,
#' vars_multiple = TRUE
#' )
#'
-#' ADRS <- teal.transform::rADRS
+#' ADRS <- rADRS
#' filter_spec_internal(
#' vars_choices = variable_choices(ADRS),
#' vars_selected = "PARAMCD",
diff --git a/R/resolve.R b/R/resolve.R
index 4efc0448..7958b578 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -10,7 +10,7 @@
#' @return Resolved object.
#'
#' @examples
-#' ADSL <- teal.transform::rADSL
+#' ADSL <- rADSL
#'
#' attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
#' data_list <- list(ADSL = shiny::reactive(ADSL))
diff --git a/R/resolve_delayed.R b/R/resolve_delayed.R
index 8d76f6e1..d1798de2 100644
--- a/R/resolve_delayed.R
+++ b/R/resolve_delayed.R
@@ -10,7 +10,7 @@
#' @return Resolved object.
#'
#' @examples
-#' ADSL <- teal.transform::rADSL
+#' ADSL <- rADSL
#' shiny::isolate({
#' data_list <- list(ADSL = shiny::reactive(ADSL))
#'
diff --git a/README.md b/README.md
index 1b7d8956..0d9ec9f6 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ Below is a small example usage:
```r
library(teal.transform)
-ADSL <- teal.transform::rADSL
+ADSL <- rADSL
adsl_extract <- data_extract_spec(
dataname = "ADSL",
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index a59065f3..7e11d760 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -46,8 +46,8 @@ Duplicated elements from \code{choices} get removed.
\examples{
library(shiny)
-ADSL <- teal.transform::rADSL
-ADTTE <- teal.transform::rADTTE
+ADSL <- rADSL
+ADTTE <- rADTTE
choices1 <- choices_labeled(names(ADSL), teal.data::col_labels(ADSL, fill = FALSE))
choices2 <- choices_labeled(ADTTE$PARAMCD, ADTTE$PARAM)
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index 1a993fc3..64581746 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -71,7 +71,7 @@ choices_selected(
selected = "C"
)
-ADSL <- teal.transform::rADSL
+ADSL <- rADSL
choices_selected(variable_choices(ADSL), "SEX")
# How to select nothing
diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd
index 9be3650d..c2efe253 100644
--- a/man/filter_spec_internal.Rd
+++ b/man/filter_spec_internal.Rd
@@ -136,7 +136,7 @@ filter_spec_internal(
vars_multiple = TRUE
)
-ADRS <- teal.transform::rADRS
+ADRS <- rADRS
filter_spec_internal(
vars_choices = variable_choices(ADRS),
vars_selected = "PARAMCD",
diff --git a/man/resolve.Rd b/man/resolve.Rd
index 5dfa93be..97790655 100644
--- a/man/resolve.Rd
+++ b/man/resolve.Rd
@@ -21,7 +21,7 @@ Resolved object.
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\examples{
-ADSL <- teal.transform::rADSL
+ADSL <- rADSL
attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
data_list <- list(ADSL = shiny::reactive(ADSL))
diff --git a/man/resolve_delayed.Rd b/man/resolve_delayed.Rd
index cfdd2dc5..457d544c 100644
--- a/man/resolve_delayed.Rd
+++ b/man/resolve_delayed.Rd
@@ -38,7 +38,7 @@ Resolved object.
}}
\examples{
-ADSL <- teal.transform::rADSL
+ADSL <- rADSL
shiny::isolate({
data_list <- list(ADSL = shiny::reactive(ADSL))
diff --git a/man/value_choices.Rd b/man/value_choices.Rd
index 36ec7dee..de216353 100644
--- a/man/value_choices.Rd
+++ b/man/value_choices.Rd
@@ -37,7 +37,7 @@ named character vector or \code{delayed_data} object.
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\examples{
-ADRS <- teal.transform::rADRS
+ADRS <- rADRS
value_choices(ADRS, "PARAMCD", "PARAM", subset = c("BESRSPI", "INVET"))
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"),
diff --git a/man/variable_choices.Rd b/man/variable_choices.Rd
index 66b45e35..0a3f08af 100644
--- a/man/variable_choices.Rd
+++ b/man/variable_choices.Rd
@@ -41,7 +41,7 @@ Named \code{character} vector with additional attributes or \code{delayed_data}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\examples{
-ADRS <- teal.transform::rADRS
+ADRS <- rADRS
variable_choices(ADRS)
variable_choices(ADRS, subset = c("PARAM", "PARAMCD"))
variable_choices(ADRS, subset = c("", "PARAM", "PARAMCD"))
diff --git a/tests/testthat/test-data_extract_module.R b/tests/testthat/test-data_extract_module.R
index 2a3bef53..55bbbffa 100644
--- a/tests/testthat/test-data_extract_module.R
+++ b/tests/testthat/test-data_extract_module.R
@@ -1,5 +1,5 @@
-ADLB <- teal.transform::rADLB # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADLB <- rADLB # nolint
+ADTTE <- rADTTE # nolint
testthat::test_that("Single filter", {
data_extract <- data_extract_spec(
diff --git a/tests/testthat/test-data_extract_multiple_srv.R b/tests/testthat/test-data_extract_multiple_srv.R
index 6db3efc1..a43cf5ef 100644
--- a/tests/testthat/test-data_extract_multiple_srv.R
+++ b/tests/testthat/test-data_extract_multiple_srv.R
@@ -1,6 +1,6 @@
-ADSL <- teal.transform::rADSL # nolint
-ADLB <- teal.transform::rADLB # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADLB <- rADLB # nolint
+ADTTE <- rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
diff --git a/tests/testthat/test-data_extract_spec.R b/tests/testthat/test-data_extract_spec.R
index ee6c80d1..6d2e4855 100644
--- a/tests/testthat/test-data_extract_spec.R
+++ b/tests/testthat/test-data_extract_spec.R
@@ -199,8 +199,8 @@ testthat::test_that("delayed data_extract_spec works", {
testthat::expect_identical(expected_spec, mix3_res)
})
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
key_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-data_extract_srv.R b/tests/testthat/test-data_extract_srv.R
index 0ef403f5..f0e946c5 100644
--- a/tests/testthat/test-data_extract_srv.R
+++ b/tests/testthat/test-data_extract_srv.R
@@ -1,6 +1,6 @@
-ADSL <- teal.transform::rADSL # nolint
-ADLB <- teal.transform::rADLB # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADLB <- rADLB # nolint
+ADTTE <- rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
diff --git a/tests/testthat/test-delayed_data_extract.R b/tests/testthat/test-delayed_data_extract.R
index d698ed8b..6c016c08 100644
--- a/tests/testthat/test-delayed_data_extract.R
+++ b/tests/testthat/test-delayed_data_extract.R
@@ -1,9 +1,9 @@
# Contains integration tests between delayed data loading objects and
# the objects responsible for loading, pulling and filtering the data
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
-ADAE <- teal.transform::rADAE # nolint
-ADRS <- teal.transform::rADRS # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
+ADAE <- rADAE # nolint
+ADRS <- rADRS # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADAE = reactive(ADAE), ADRS = reactive(ADRS))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADAE", "ADRS")]
diff --git a/tests/testthat/test-filter_spec.R b/tests/testthat/test-filter_spec.R
index 9e3ce2b4..24ea6003 100644
--- a/tests/testthat/test-filter_spec.R
+++ b/tests/testthat/test-filter_spec.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
primary_keys_list <- lapply(join_keys, function(x) x[[1]])
@@ -218,7 +218,7 @@ testthat::test_that("filter_spec_internal", {
})
testthat::test_that("filter_spec_internal contains dataname", {
- ADSL <- teal.transform::rADSL # nolint
+ ADSL <- rADSL # nolint
x_filter <- filter_spec_internal(
vars_choices = variable_choices(ADSL)
diff --git a/tests/testthat/test-resolve.R b/tests/testthat/test-resolve.R
index 296c3eb4..139ce7c3 100644
--- a/tests/testthat/test-resolve.R
+++ b/tests/testthat/test-resolve.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
arm_ref_comp <- list(
ARMCD = list(
diff --git a/tests/testthat/test-resolve_delayed.R b/tests/testthat/test-resolve_delayed.R
index 3e8ff93c..a5610b09 100644
--- a/tests/testthat/test-resolve_delayed.R
+++ b/tests/testthat/test-resolve_delayed.R
@@ -1,5 +1,5 @@
-adsl <- teal.transform::rADSL # nolint
-adtte <- teal.transform::rADTTE # nolint
+adsl <- rADSL # nolint
+adtte <- rADTTE # nolint
data_list <- list(ADSL = reactive(adsl), ADTTE = reactive(adtte))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE")]
diff --git a/tests/testthat/test-select_spec.R b/tests/testthat/test-select_spec.R
index 1fc4dc5a..2a69d0d0 100644
--- a/tests/testthat/test-select_spec.R
+++ b/tests/testthat/test-select_spec.R
@@ -1,5 +1,5 @@
-adsl <- teal.transform::rADSL # nolint
-adtte <- teal.transform::rADTTE # nolint
+adsl <- rADSL # nolint
+adtte <- rADTTE # nolint
data_list <- list(ADSL = reactive(adsl), ADTTE = reactive(adtte))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-value_choices.R b/tests/testthat/test-value_choices.R
index cdf3923c..2d8b6466 100644
--- a/tests/testthat/test-value_choices.R
+++ b/tests/testthat/test-value_choices.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-variable_choices.R b/tests/testthat/test-variable_choices.R
index 3b3821f1..3b289fcd 100644
--- a/tests/testthat/test-variable_choices.R
+++ b/tests/testthat/test-variable_choices.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/vignettes/data-extract-merge.Rmd b/vignettes/data-extract-merge.Rmd
index 6bdb4d83..4b9ecc08 100644
--- a/vignettes/data-extract-merge.Rmd
+++ b/vignettes/data-extract-merge.Rmd
@@ -119,8 +119,8 @@ where a list of necessary join keys per `data.frame` object is required:
```{r}
# Define data.frame objects
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
# create a list of data.frame objects
datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
diff --git a/vignettes/data-extract.Rmd b/vignettes/data-extract.Rmd
index 9bde1e2e..1e1beacd 100644
--- a/vignettes/data-extract.Rmd
+++ b/vignettes/data-extract.Rmd
@@ -72,8 +72,8 @@ where a list of necessary join keys per `data.frame` object is required:
```{r}
# Define data.frame objects
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
# create a list of data.frame objects
datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
diff --git a/vignettes/data-merge.Rmd b/vignettes/data-merge.Rmd
index 0c78302d..c07a4ffa 100644
--- a/vignettes/data-merge.Rmd
+++ b/vignettes/data-merge.Rmd
@@ -99,8 +99,8 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
}
# Define data.frame objects
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- rADSL # nolint
+ADTTE <- rADTTE # nolint
# create a list of data.frame objects
datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
From e1ac439da79448080e41232215877134b2ac6663 Mon Sep 17 00:00:00 2001
From: unknown
Date: Fri, 9 Feb 2024 17:09:18 +0530
Subject: [PATCH 28/62] removing pacakge:: call from example and fixing
example.
---
R/choices_labeled.R | 12 +-
R/choices_selected.R | 9 +-
R/data_extract_filter_module.R | 5 +-
R/data_extract_module.R | 238 ++++++++++++++-------------
R/format_data_extract.R | 43 ++---
R/get_dplyr_call.R | 4 +-
R/get_merge_call.R | 3 +-
R/merge_datasets.R | 3 +-
R/merge_expression_module.R | 187 +++++++++++----------
R/resolve.R | 5 +-
R/resolve_delayed.R | 5 +-
R/utils.R | 116 ++++++-------
man/choices_labeled.Rd | 8 +-
man/choices_selected.Rd | 9 +-
man/compose_and_enable_validators.Rd | 114 ++++++-------
man/cond_data_extract_single_ui.Rd | 3 +-
man/data_extract_multiple_srv.Rd | 106 ++++++------
man/data_extract_srv.Rd | 126 +++++++-------
man/data_extract_ui.Rd | 3 +-
man/format_data_extract.Rd | 43 ++---
man/get_initial_filter_values.Rd | 5 +-
man/get_merge_key_i.Rd | 3 +-
man/get_rename_call.Rd | 4 +-
man/merge_datasets.Rd | 3 +-
man/merge_expression_module.Rd | 91 +++++-----
man/merge_expression_srv.Rd | 96 +++++------
man/resolve.Rd | 5 +-
man/resolve_delayed.Rd | 5 +-
man/variable_choices.Rd | 4 +-
29 files changed, 653 insertions(+), 605 deletions(-)
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 2c41d78b..84fde370 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -21,17 +21,18 @@
#'
#' @examples
#' library(shiny)
+#' library(teal.data)
#'
#' ADSL <- rADSL
#' ADTTE <- rADTTE
#'
-#' choices1 <- choices_labeled(names(ADSL), teal.data::col_labels(ADSL, fill = FALSE))
+#' choices1 <- choices_labeled(names(ADSL), 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),
+#' col_labels(ADSL, fill = FALSE),
#' subset = c("ARMCD", "ARM")
#' )
#'
@@ -52,9 +53,10 @@
#' selected = choices3[1]
#' )
#' )
+#' server <- function(input, output) {}
#'
#' if (interactive()) {
-#' shinyApp(ui = ui, server = function(input, output) {})
+#' shinyApp(ui, server)
#' }
#' @export
#'
@@ -144,6 +146,8 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
#' @return Named `character` vector with additional attributes or `delayed_data` object.
#'
#' @examples
+#' library(teal.data)
+#'
#' ADRS <- rADRS
#' variable_choices(ADRS)
#' variable_choices(ADRS, subset = c("PARAM", "PARAMCD"))
@@ -151,7 +155,7 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
#' variable_choices(
#' ADRS,
#' subset = c("", "PARAM", "PARAMCD"),
-#' key = teal.data::default_cdisc_join_keys["ADRS", "ADRS"]
+#' key = default_cdisc_join_keys["ADRS", "ADRS"]
#' )
#'
#' # delayed version
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 132c2de9..0a42bce8 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -39,13 +39,14 @@ no_select_keyword <- "-- no selection --"
#'
#' @examples
#' library(shiny)
+#' library(teal.widgets)
#'
#' # all_choices example - semantically the same objects
#' choices_selected(choices = letters, selected = all_choices())
#' choices_selected(choices = letters, selected = letters)
#'
#' choices_selected(
-#' choices = stats::setNames(LETTERS[1:5], paste("Letter", LETTERS[1:5])),
+#' choices = setNames(LETTERS[1:5], paste("Letter", LETTERS[1:5])),
#' selected = "C"
#' )
#'
@@ -112,14 +113,16 @@ no_select_keyword <- "-- no selection --"
#' )
#'
#' ui <- fluidPage(
-#' teal.widgets::optionalSelectInput(
+#' optionalSelectInput(
#' inputId = "id",
#' choices = cs$choices,
#' selected = cs$selected
#' )
#' )
+#'
+#' server <- function(input, output, session) {}
#' if (interactive()) {
-#' shinyApp(ui, server = function(input, output, session) {})
+#' shinyApp(ui, server)
#' }
#' @export
#'
diff --git a/R/data_extract_filter_module.R b/R/data_extract_filter_module.R
index f1abf7a5..3e52dfb4 100644
--- a/R/data_extract_filter_module.R
+++ b/R/data_extract_filter_module.R
@@ -142,13 +142,14 @@ data_extract_filter_srv <- function(id, datasets, filter) {
#' @return named `list` with two slots `choices` and `selected`.
#'
#' @examples
+#' library(shiny)
#' # 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)))
+#' filtered_data_list <- list(iris = reactive(head(iris)))
#' filter <- filter_spec(vars = colnames(iris)[1])
#' filter$dataname <- "iris"
-#' shiny::isolate(
+#' isolate(
#' get_initial_filter_values(filter = filter, datasets = filtered_data_list)
#' )
#'
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index 0512751f..66674188 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -33,11 +33,12 @@ id_for_dataset <- function(dataname) {
#' @return `shiny.tag` with the HTML code for the panel.
#'
#' @examples
+#' library(shiny)
#' # 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"),
+#' NS("TEST"),
#' data_extract_spec(dataname = "test")
#' )
#' @keywords internal
@@ -92,6 +93,7 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) {
#'
#' @examples
#' library(shiny)
+#' library(teal.widgets)
#'
#' adtte_filters <- filter_spec(
#' vars = c("PARAMCD", "CNSR"),
@@ -114,7 +116,7 @@ cond_data_extract_single_ui <- function(ns, single_data_extract_spec) {
#' )
#' )
#' # Call to use inside your teal module UI function
-#' teal.widgets::standard_layout(
+#' standard_layout(
#' output = tableOutput("table"),
#' encoding = div(
#' data_extract_ui(
@@ -295,10 +297,12 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' @references [data_extract_srv]
#'
#' @examples
-#'
#' library(shiny)
#' library(shinyvalidate)
+#' library(teal.data)
+#' library(teal.widgets)
#'
+#' # Sample ADSL dataset
#' ADSL <- data.frame(
#' STUDYID = "A",
#' USUBJID = LETTERS[1:10],
@@ -307,6 +311,7 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' BMRKR1 = rlnorm(10)
#' )
#'
+#' # Specification for data extraction
#' adsl_extract <- data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(vars = "SEX", choices = c("F", "M"), selected = "F"),
@@ -322,77 +327,78 @@ check_data_extract_spec_react <- function(datasets, data_extract) {
#' # Using reactive list of data.frames
#' data_list <- list(ADSL = reactive(ADSL))
#'
-#' join_keys <- teal.data::join_keys(teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")))
-#'
-#' app <- shinyApp(
-#' ui = fluidPage(
-#' teal.widgets::standard_layout(
-#' output = verbatimTextOutput("out1"),
-#' encoding = tagList(
-#' data_extract_ui(
-#' id = "adsl_var",
-#' label = "ADSL selection",
-#' data_extract_spec = adsl_extract
-#' )
+#' join_keys <- join_keys(join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")))
+#'
+#' # App: data extraction with validation
+#' ui <- fluidPage(
+#' standard_layout(
+#' output = verbatimTextOutput("out1"),
+#' encoding = tagList(
+#' data_extract_ui(
+#' id = "adsl_var",
+#' label = "ADSL selection",
+#' data_extract_spec = adsl_extract
#' )
#' )
-#' ),
-#' server = function(input, output, session) {
-#' adsl_reactive_input <- data_extract_srv(
-#' id = "adsl_var",
-#' datasets = data_list,
-#' data_extract_spec = adsl_extract,
-#' join_keys = join_keys,
-#' select_validation_rule = sv_required("Please select a variable.")
-#' )
-#'
-#' iv_r <- reactive({
-#' iv <- InputValidator$new()
-#' iv$add_validator(adsl_reactive_input()$iv)
-#' iv$enable()
-#' iv
-#' })
-#'
-#' output$out1 <- renderPrint({
-#' if (iv_r()$is_valid()) {
-#' cat(format_data_extract(adsl_reactive_input()))
-#' } else {
-#' "Please fix errors in your selection"
-#' }
-#' })
-#' }
+#' )
#' )
-#' if (interactive()) {
-#' shinyApp(app$ui, app$server)
+#' server <- function(input, output, session) {
+#' adsl_reactive_input <- data_extract_srv(
+#' id = "adsl_var",
+#' datasets = data_list,
+#' data_extract_spec = adsl_extract,
+#' join_keys = join_keys,
+#' select_validation_rule = sv_required("Please select a variable.")
+#' )
+#'
+#' iv_r <- reactive({
+#' iv <- InputValidator$new()
+#' iv$add_validator(adsl_reactive_input()$iv)
+#' iv$enable()
+#' iv
+#' })
+#'
+#' output$out1 <- renderPrint({
+#' if (iv_r()$is_valid()) {
+#' cat(format_data_extract(adsl_reactive_input()))
+#' } else {
+#' "Please fix errors in your selection"
+#' }
+#' })
#' }
#'
+#' if (interactive()) {
+#' shinyApp(ui, server)
+#' }
#'
-#' app <- shinyApp(
-#' ui = fluidPage(
-#' teal.widgets::standard_layout(
-#' output = verbatimTextOutput("out1"),
-#' encoding = tagList(
-#' data_extract_ui(
-#' id = "adsl_var",
-#' label = "ADSL selection",
-#' data_extract_spec = adsl_extract
-#' )
+#' # App: simplified data extraction
+#' ui <- fluidPage(
+#' standard_layout(
+#' output = verbatimTextOutput("out1"),
+#' encoding = tagList(
+#' data_extract_ui(
+#' id = "adsl_var",
+#' label = "ADSL selection",
+#' data_extract_spec = adsl_extract
#' )
#' )
-#' ),
-#' server = function(input, output, session) {
-#' adsl_reactive_input <- data_extract_srv(
-#' id = "adsl_var",
-#' datasets = datasets,
-#' data_extract_spec = adsl_extract
-#' )
-#'
-#' output$out1 <- renderPrint(adsl_reactive_input())
-#' }
+#' )
#' )
+#'
+#' server <- function(input, output, session) {
+#' adsl_reactive_input <- data_extract_srv(
+#' id = "adsl_var",
+#' datasets = data_list,
+#' data_extract_spec = adsl_extract
+#' )
+#'
+#' output$out1 <- renderPrint(adsl_reactive_input())
+#' }
+#'
#' if (interactive()) {
-#' shinyApp(app$ui, app$server)
+#' shinyApp(ui, server)
#' }
+#'
#' @export
#'
data_extract_srv <- function(id, datasets, data_extract_spec, ...) {
@@ -610,66 +616,66 @@ data_extract_srv.list <- function(id, datasets, data_extract_spec, join_keys = N
#'
#' data_list <- list(iris = reactive(iris))
#'
-#' app <- shinyApp(
-#' ui = fluidPage(
-#' useShinyjs(),
-#' standard_layout(
-#' output = verbatimTextOutput("out1"),
-#' encoding = tagList(
-#' data_extract_ui(
-#' id = "x_var",
-#' label = "Please select an X column",
-#' data_extract_spec = iris_select
-#' ),
-#' data_extract_ui(
-#' id = "species_var",
-#' label = "Please select 2 Species",
-#' data_extract_spec = iris_filter
-#' )
+#' ui <- fluidPage(
+#' useShinyjs(),
+#' standard_layout(
+#' output = verbatimTextOutput("out1"),
+#' encoding = tagList(
+#' data_extract_ui(
+#' id = "x_var",
+#' label = "Please select an X column",
+#' data_extract_spec = iris_select
+#' ),
+#' data_extract_ui(
+#' id = "species_var",
+#' label = "Please select 2 Species",
+#' data_extract_spec = iris_filter
#' )
#' )
-#' ),
-#' server = function(input, output, session) {
-#' exactly_2_validation <- function(msg) {
-#' ~ if (length(.) != 2) msg
-#' }
+#' )
+#' )
#'
+#' server <- function(input, output, session) {
+#' exactly_2_validation <- function(msg) {
+#' ~ if (length(.) != 2) msg
+#' }
#'
-#' selector_list <- data_extract_multiple_srv(
-#' list(x_var = iris_select, species_var = iris_filter),
-#' datasets = data_list,
-#' select_validation_rule = list(
-#' x_var = sv_required("Please select an X column")
-#' ),
-#' filter_validation_rule = list(
-#' species_var = compose_rules(
-#' sv_required("Exactly 2 Species must be chosen"),
-#' exactly_2_validation("Exactly 2 Species must be chosen")
-#' )
+#'
+#' selector_list <- data_extract_multiple_srv(
+#' list(x_var = iris_select, species_var = iris_filter),
+#' datasets = data_list,
+#' select_validation_rule = list(
+#' x_var = sv_required("Please select an X column")
+#' ),
+#' filter_validation_rule = list(
+#' species_var = compose_rules(
+#' sv_required("Exactly 2 Species must be chosen"),
+#' exactly_2_validation("Exactly 2 Species must be chosen")
#' )
#' )
-#' iv_r <- reactive({
-#' iv <- InputValidator$new()
-#' compose_and_enable_validators(
-#' iv,
-#' selector_list,
-#' validator_names = NULL
-#' )
-#' })
-#'
-#' output$out1 <- renderPrint({
-#' if (iv_r()$is_valid()) {
-#' ans <- lapply(selector_list(), function(x) {
-#' cat(format_data_extract(x()), "\n\n")
-#' })
-#' } else {
-#' "Please fix errors in your selection"
-#' }
-#' })
-#' }
-#' )
+#' )
+#' iv_r <- reactive({
+#' iv <- InputValidator$new()
+#' compose_and_enable_validators(
+#' iv,
+#' selector_list,
+#' validator_names = NULL
+#' )
+#' })
+#'
+#' output$out1 <- renderPrint({
+#' if (iv_r()$is_valid()) {
+#' ans <- lapply(selector_list(), function(x) {
+#' cat(format_data_extract(x()), "\n\n")
+#' })
+#' } else {
+#' "Please fix errors in your selection"
+#' }
+#' })
+#' }
+#'
#' if (interactive()) {
-#' shinyApp(app$ui, app$server)
+#' shinyApp(ui, server)
#' }
#' @export
#'
diff --git a/R/format_data_extract.R b/R/format_data_extract.R
index 6c25714a..8749df63 100644
--- a/R/format_data_extract.R
+++ b/R/format_data_extract.R
@@ -10,34 +10,35 @@
#' @return A string (`character(1)`) representation of the `data_extract` object.
#'
#' @examples
+#' library(shiny)
#' simple_des <- data_extract_spec(
#' dataname = "iris",
#' filter = filter_spec(vars = "Petal.Length", choices = c("1.4", "1.5")),
#' select = select_spec(choices = c("Petal.Length", "Species"))
#' )
#'
-#' if (interactive()) {
-#' shiny::shinyApp(
-#' ui = shiny::fluidPage(
-#' data_extract_ui(
-#' id = "extract",
-#' label = "data extract ui",
-#' data_extract_spec = simple_des,
-#' is_single_dataset = TRUE
-#' ),
-#' shiny::verbatimTextOutput("formatted_extract")
-#' ),
-#' server = function(input, output, session) {
-#' extracted_input <- data_extract_srv(
-#' id = "extract",
-#' datasets = list(iris = iris),
-#' data_extract_spec = simple_des
-#' )
-#' output$formatted_extract <- shiny::renderPrint({
-#' cat(format_data_extract(extracted_input()))
-#' })
-#' }
+#' ui <- fluidPage(
+#' data_extract_ui(
+#' id = "extract",
+#' label = "data extract ui",
+#' data_extract_spec = simple_des,
+#' is_single_dataset = TRUE
+#' ),
+#' verbatimTextOutput("formatted_extract")
+#' )
+#' server <- function(input, output, session) {
+#' extracted_input <- data_extract_srv(
+#' id = "extract",
+#' datasets = list(iris = iris),
+#' data_extract_spec = simple_des
#' )
+#' output$formatted_extract <- renderPrint({
+#' cat(format_data_extract(extracted_input()))
+#' })
+#' }
+#'
+#' if (interactive()) {
+#' shinyApp(ui, server)
#' }
#' @export
#'
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index effc4688..722e764b 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -430,7 +430,7 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) {
#' list(
#' dataname = "ADSL",
#' filters = NULL,
-#' select = utils::head(letters, 3),
+#' select = head(letters, 3),
#' keys = c("STUDYID", "USUBJID"),
#' reshape = FALSE,
#' internal_id = "test1"
@@ -446,7 +446,7 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) {
#' list(
#' dataname = "ADSL",
#' filters = NULL,
-#' select = utils::tail(letters, 3),
+#' select = tail(letters, 3),
#' keys = c("STUDYID", "USUBJID"),
#' reshape = FALSE,
#' internal_id = "test3"
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index ef6d00bd..2c84f276 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -206,6 +206,7 @@ get_merge_key_pair <- function(selector_from, selector_to, key_from) {
#' @return `character` list of keys.
#'
#' @examples
+#' library(teal.data)
#' # use non-exported function from teal.transform
#' get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
#' get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
@@ -229,7 +230,7 @@ get_merge_key_pair <- function(selector_from, selector_to, key_from) {
#' )
#' )
#'
-#' join_keys <- teal.data::join_keys(teal.data::join_key("X", "Y", c("A", "B")))
+#' join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
#' get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
#'
#' @keywords internal
diff --git a/R/merge_datasets.R b/R/merge_datasets.R
index afed8782..f49a9cfa 100644
--- a/R/merge_datasets.R
+++ b/R/merge_datasets.R
@@ -46,10 +46,11 @@
#'
#' @examples
#' library(shiny)
+#' library(teal.data)
#'
#' 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")))
+#' join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
#'
#' selector_list <- list(
#' list(
diff --git a/R/merge_expression_module.R b/R/merge_expression_module.R
index a9158146..76ca70da 100644
--- a/R/merge_expression_module.R
+++ b/R/merge_expression_module.R
@@ -27,6 +27,9 @@
#'
#' @examples
#' library(shiny)
+#' library(teal.data)
+#' library(teal.widgets)
+#'
#' ADSL <- data.frame(
#' STUDYID = "A",
#' USUBJID = LETTERS[1:10],
@@ -44,17 +47,16 @@
#' ADLB$CHG <- rnorm(120)
#'
#' data_list <- list(
-#' ADSL = ADSL,
-#' ADLB = ADLB
+#' ADSL = reactive(ADSL),
+#' ADLB = reactive(ADLB)
#' )
#'
-#' join_keys <- teal.data::join_keys(
-#' teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
-#' teal.data::join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
-#' teal.data::join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
+#' join_keys <- join_keys(
+#' join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+#' join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
+#' join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
#' )
#'
-#'
#' adsl_extract <- data_extract_spec(
#' dataname = "ADSL",
#' select = select_spec(
@@ -76,36 +78,37 @@
#' fixed = FALSE
#' )
#' )
-#' app <- shinyApp(
-#' ui = fluidPage(
-#' teal.widgets::standard_layout(
-#' output = div(
-#' verbatimTextOutput("expr"),
-#' dataTableOutput("data")
-#' ),
-#' encoding = tagList(
-#' data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
-#' data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
-#' )
+#'
+#' ui <- fluidPage(
+#' standard_layout(
+#' output = div(
+#' verbatimTextOutput("expr"),
+#' dataTableOutput("data")
+#' ),
+#' encoding = tagList(
+#' data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
+#' data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
#' )
-#' ),
-#' server = function(input, output, session) {
-#' data_q <- teal.code::qenv()
+#' )
+#' )
+#'
+#' server <- function(input, output, session) {
+#' data_q <- qenv()
#'
-#' data_q <- teal.code::eval_code(
-#' data_q,
-#' "ADSL <- data.frame(
+#' data_q <- eval_code(
+#' data_q,
+#' "ADSL <- data.frame(
#' STUDYID = 'A',
#' USUBJID = LETTERS[1:10],
#' SEX = rep(c('F', 'M'), 5),
#' AGE = rpois(10, 30),
#' BMRKR1 = rlnorm(10)
#' )"
-#' )
+#' )
#'
-#' data_q <- teal.code::eval_code(
-#' data_q,
-#' "ADLB <- expand.grid(
+#' data_q <- eval_code(
+#' data_q,
+#' "ADLB <- expand.grid(
#' STUDYID = 'A',
#' USUBJID = LETTERS[1:10],
#' PARAMCD = c('ALT', 'CRP', 'IGA'),
@@ -113,26 +116,26 @@
#' AVAL = rlnorm(120),
#' CHG = rlnorm(120)
#' )"
-#' )
+#' )
#'
-#' merged_data <- merge_expression_module(
-#' data_extract = list(adsl_var = adsl_extract, adlb_var = adlb_extract),
-#' datasets = data_list,
-#' join_keys = join_keys,
-#' merge_function = "dplyr::left_join"
-#' )
+#' merged_data <- merge_expression_module(
+#' data_extract = list(adsl_var = adsl_extract, adlb_var = adlb_extract),
+#' datasets = data_list,
+#' join_keys = join_keys,
+#' merge_function = "dplyr::left_join"
+#' )
#'
-#' code_merge <- reactive({
-#' for (exp in merged_data()$expr) data_q <- teal.code::eval_code(data_q, exp)
-#' data_q
-#' })
+#' code_merge <- reactive({
+#' for (exp in merged_data()$expr) data_q <- eval_code(data_q, exp)
+#' data_q
+#' })
+#'
+#' output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
+#' output$data <- renderDataTable(code_merge()[["ANL"]])
+#' }
#'
-#' output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
-#' output$data <- renderDataTable(code_merge()[["ANL"]])
-#' }
-#' )
#' if (interactive()) {
-#' shinyApp(app$ui, app$server)
+#' shinyApp(ui, server)
#' }
#' @export
#'
@@ -221,6 +224,8 @@ merge_expression_module.list <- function(datasets,
#'
#' @examples
#' library(shiny)
+#' library(teal.data)
+#' library(teal.widgets)
#'
#' ADSL <- data.frame(
#' STUDYID = "A",
@@ -240,14 +245,14 @@ merge_expression_module.list <- function(datasets,
#' ADLB$CHG <- rlnorm(120)
#'
#' data_list <- list(
-#' ADSL = ADSL,
-#' ADLB = ADLB
+#' ADSL = reactive(ADSL),
+#' ADLB = reactive(ADLB)
#' )
#'
-#' join_keys <- teal.data::join_keys(
-#' teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
-#' teal.data::join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
-#' teal.data::join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
+#' join_keys <- join_keys(
+#' join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+#' join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
+#' join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
#' )
#'
#' adsl_extract <- data_extract_spec(
@@ -272,36 +277,36 @@ merge_expression_module.list <- function(datasets,
#' )
#' )
#'
-#' app <- shinyApp(
-#' ui = fluidPage(
-#' teal.widgets::standard_layout(
-#' output = div(
-#' verbatimTextOutput("expr"),
-#' dataTableOutput("data")
-#' ),
-#' encoding = tagList(
-#' data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
-#' data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
-#' )
+#' ui <- fluidPage(
+#' standard_layout(
+#' output = div(
+#' verbatimTextOutput("expr"),
+#' dataTableOutput("data")
+#' ),
+#' encoding = tagList(
+#' data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
+#' data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
#' )
-#' ),
-#' server = function(input, output, session) {
-#' data_q <- teal.code::qenv()
+#' )
+#' )
#'
-#' data_q <- teal.code::eval_code(
-#' data_q,
-#' "ADSL <- data.frame(
+#' server <- function(input, output, session) {
+#' data_q <- qenv()
+#'
+#' data_q <- eval_code(
+#' data_q,
+#' "ADSL <- data.frame(
#' STUDYID = 'A',
#' USUBJID = LETTERS[1:10],
#' SEX = rep(c('F', 'M'), 5),
#' AGE = rpois(10, 30),
#' BMRKR1 = rlnorm(10)
#' )"
-#' )
+#' )
#'
-#' data_q <- teal.code::eval_code(
-#' data_q,
-#' "ADLB <- expand.grid(
+#' data_q <- eval_code(
+#' data_q,
+#' "ADLB <- expand.grid(
#' STUDYID = 'A',
#' USUBJID = LETTERS[1:10],
#' PARAMCD = c('ALT', 'CRP', 'IGA'),
@@ -309,30 +314,30 @@ merge_expression_module.list <- function(datasets,
#' AVAL = rlnorm(120),
#' CHG = rlnorm(120)
#' )"
-#' )
+#' )
#'
-#' selector_list <- data_extract_multiple_srv(
-#' list(adsl_var = adsl_extract, adlb_var = adlb_extract),
-#' datasets = data_list
-#' )
-#' merged_data <- merge_expression_srv(
-#' selector_list = selector_list,
-#' datasets = data_list,
-#' join_keys = join_keys,
-#' merge_function = "dplyr::left_join"
-#' )
+#' selector_list <- data_extract_multiple_srv(
+#' list(adsl_var = adsl_extract, adlb_var = adlb_extract),
+#' datasets = data_list
+#' )
+#' merged_data <- merge_expression_srv(
+#' selector_list = selector_list,
+#' datasets = data_list,
+#' join_keys = join_keys,
+#' merge_function = "dplyr::left_join"
+#' )
#'
-#' code_merge <- reactive({
-#' for (exp in merged_data()$expr) data_q <- teal.code::eval_code(data_q, exp)
-#' data_q
-#' })
+#' code_merge <- reactive({
+#' for (exp in merged_data()$expr) data_q <- eval_code(data_q, exp)
+#' data_q
+#' })
+#'
+#' output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
+#' output$data <- renderDataTable(code_merge()[["ANL"]])
+#' }
#'
-#' output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
-#' output$data <- renderDataTable(code_merge()[["ANL"]])
-#' }
-#' )
#' if (interactive()) {
-#' shinyApp(app$ui, app$server)
+#' shinyApp(ui, server)
#' }
#' @export
#'
diff --git a/R/resolve.R b/R/resolve.R
index 7958b578..46815988 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -10,12 +10,13 @@
#' @return Resolved object.
#'
#' @examples
+#' library(shiny)
#' ADSL <- rADSL
#'
#' attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
-#' data_list <- list(ADSL = shiny::reactive(ADSL))
+#' data_list <- list(ADSL = reactive(ADSL))
#' keys <- list(ADSL = attr(ADSL, "keys"))
-#' shiny::isolate({
+#' isolate({
#' # value_choices example
#' v1 <- value_choices("ADSL", "SEX", "SEX")
#' v1
diff --git a/R/resolve_delayed.R b/R/resolve_delayed.R
index d1798de2..394f8f72 100644
--- a/R/resolve_delayed.R
+++ b/R/resolve_delayed.R
@@ -10,9 +10,10 @@
#' @return Resolved object.
#'
#' @examples
+#' library(shiny)
#' ADSL <- rADSL
-#' shiny::isolate({
-#' data_list <- list(ADSL = shiny::reactive(ADSL))
+#' isolate({
+#' data_list <- list(ADSL = reactive(ADSL))
#'
#' # value_choices example
#' v1 <- value_choices("ADSL", "SEX", "SEX")
diff --git a/R/utils.R b/R/utils.R
index 4872f720..e268dbb5 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -81,72 +81,72 @@ extract_choices_labels <- function(choices, values = NULL) {
#'
#' data_list <- list(iris = reactive(iris))
#'
-#' app <- shinyApp(
-#' ui = fluidPage(
-#' useShinyjs(),
-#' standard_layout(
-#' output = verbatimTextOutput("out1"),
-#' encoding = tagList(
-#' data_extract_ui(
-#' id = "x_var",
-#' label = "Please select an X column",
-#' data_extract_spec = iris_extract
-#' ),
-#' data_extract_ui(
-#' id = "y_var",
-#' label = "Please select a Y column",
-#' data_extract_spec = iris_extract
-#' ),
-#' data_extract_ui(
-#' id = "col_var",
-#' label = "Please select a color column",
-#' data_extract_spec = iris_extract
-#' )
+#' ui <- fluidPage(
+#' useShinyjs(),
+#' standard_layout(
+#' output = verbatimTextOutput("out1"),
+#' encoding = tagList(
+#' data_extract_ui(
+#' id = "x_var",
+#' label = "Please select an X column",
+#' data_extract_spec = iris_extract
+#' ),
+#' data_extract_ui(
+#' id = "y_var",
+#' label = "Please select a Y column",
+#' data_extract_spec = iris_extract
+#' ),
+#' data_extract_ui(
+#' id = "col_var",
+#' label = "Please select a color column",
+#' data_extract_spec = iris_extract
#' )
#' )
-#' ),
-#' server = function(input, output, session) {
-#' exactly_2_validation <- function() {
-#' ~ if (length(.) != 2) "Exactly 2 'Y' column variables must be chosen"
-#' }
+#' )
+#' )
#'
+#' server <- function(input, output, session) {
+#' exactly_2_validation <- function() {
+#' ~ if (length(.) != 2) "Exactly 2 'Y' column variables must be chosen"
+#' }
#'
-#' selector_list <- data_extract_multiple_srv(
-#' list(x_var = iris_extract, y_var = iris_extract, col_var = iris_extract),
-#' datasets = data_list,
-#' select_validation_rule = list(
-#' x_var = sv_required("Please select an X column"),
-#' y_var = compose_rules(
-#' sv_required("Exactly 2 'Y' column variables must be chosen"),
-#' exactly_2_validation()
-#' )
+#' selector_list <- data_extract_multiple_srv(
+#' list(x_var = iris_extract, y_var = iris_extract, col_var = iris_extract),
+#' datasets = data_list,
+#' select_validation_rule = list(
+#' x_var = sv_required("Please select an X column"),
+#' y_var = compose_rules(
+#' sv_required("Exactly 2 'Y' column variables must be chosen"),
+#' exactly_2_validation()
#' )
#' )
-#' iv_r <- reactive({
-#' iv <- InputValidator$new()
-#' compose_and_enable_validators(
-#' iv,
-#' selector_list,
-#' # if validator_names = NULL then all validators are used
-#' # to turn on only "x_var" then set this argument to "x_var"
-#' validator_names = NULL
-#' )
-#' })
-#'
-#' output$out1 <- renderPrint({
-#' if (iv_r()$is_valid()) {
-#' ans <- lapply(selector_list(), function(x) {
-#' cat(format_data_extract(x()), "\n\n")
-#' })
-#' } else {
-#' "Check that you have made a valid selection"
-#' }
-#' })
-#' }
-#' )
+#' )
+#' iv_r <- reactive({
+#' iv <- InputValidator$new()
+#' compose_and_enable_validators(
+#' iv,
+#' selector_list,
+#' # if validator_names = NULL then all validators are used
+#' # to turn on only "x_var" then set this argument to "x_var"
+#' validator_names = NULL
+#' )
+#' })
+#'
+#' output$out1 <- renderPrint({
+#' if (iv_r()$is_valid()) {
+#' ans <- lapply(selector_list(), function(x) {
+#' cat(format_data_extract(x()), "\n\n")
+#' })
+#' } else {
+#' "Check that you have made a valid selection"
+#' }
+#' })
+#' }
+#'
#' if (interactive()) {
-#' shinyApp(app$ui, app$server)
+#' shinyApp(ui, server)
#' }
+#'
#' @export
#'
compose_and_enable_validators <- function(iv, selector_list, validator_names = NULL) {
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index 7e11d760..29ee91d0 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -45,17 +45,18 @@ Duplicated elements from \code{choices} get removed.
}
\examples{
library(shiny)
+library(teal.data)
ADSL <- rADSL
ADTTE <- rADTTE
-choices1 <- choices_labeled(names(ADSL), teal.data::col_labels(ADSL, fill = FALSE))
+choices1 <- choices_labeled(names(ADSL), 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),
+ col_labels(ADSL, fill = FALSE),
subset = c("ARMCD", "ARM")
)
@@ -76,8 +77,9 @@ ui <- fluidPage(
selected = choices3[1]
)
)
+server <- function(input, output) {}
if (interactive()) {
- shinyApp(ui = ui, server = function(input, output) {})
+ shinyApp(ui, server)
}
}
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index 64581746..ea05aa4a 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -61,13 +61,14 @@ In case you want to keep your specific order of choices, set \code{keep_order} t
}
\examples{
library(shiny)
+library(teal.widgets)
# all_choices example - semantically the same objects
choices_selected(choices = letters, selected = all_choices())
choices_selected(choices = letters, selected = letters)
choices_selected(
- choices = stats::setNames(LETTERS[1:5], paste("Letter", LETTERS[1:5])),
+ choices = setNames(LETTERS[1:5], paste("Letter", LETTERS[1:5])),
selected = "C"
)
@@ -134,13 +135,15 @@ cs <- choices_selected(
)
ui <- fluidPage(
- teal.widgets::optionalSelectInput(
+ optionalSelectInput(
inputId = "id",
choices = cs$choices,
selected = cs$selected
)
)
+
+server <- function(input, output, session) {}
if (interactive()) {
- shinyApp(ui, server = function(input, output, session) {})
+ shinyApp(ui, server)
}
}
diff --git a/man/compose_and_enable_validators.Rd b/man/compose_and_enable_validators.Rd
index 91c7d3aa..3076274f 100644
--- a/man/compose_and_enable_validators.Rd
+++ b/man/compose_and_enable_validators.Rd
@@ -45,70 +45,70 @@ iris_extract <- data_extract_spec(
data_list <- list(iris = reactive(iris))
-app <- shinyApp(
- ui = fluidPage(
- useShinyjs(),
- standard_layout(
- output = verbatimTextOutput("out1"),
- encoding = tagList(
- data_extract_ui(
- id = "x_var",
- label = "Please select an X column",
- data_extract_spec = iris_extract
- ),
- data_extract_ui(
- id = "y_var",
- label = "Please select a Y column",
- data_extract_spec = iris_extract
- ),
- data_extract_ui(
- id = "col_var",
- label = "Please select a color column",
- data_extract_spec = iris_extract
- )
+ui <- fluidPage(
+ useShinyjs(),
+ standard_layout(
+ output = verbatimTextOutput("out1"),
+ encoding = tagList(
+ data_extract_ui(
+ id = "x_var",
+ label = "Please select an X column",
+ data_extract_spec = iris_extract
+ ),
+ data_extract_ui(
+ id = "y_var",
+ label = "Please select a Y column",
+ data_extract_spec = iris_extract
+ ),
+ data_extract_ui(
+ id = "col_var",
+ label = "Please select a color column",
+ data_extract_spec = iris_extract
)
)
- ),
- server = function(input, output, session) {
- exactly_2_validation <- function() {
- ~ if (length(.) != 2) "Exactly 2 'Y' column variables must be chosen"
- }
+ )
+)
+server <- function(input, output, session) {
+ exactly_2_validation <- function() {
+ ~ if (length(.) != 2) "Exactly 2 'Y' column variables must be chosen"
+ }
- selector_list <- data_extract_multiple_srv(
- list(x_var = iris_extract, y_var = iris_extract, col_var = iris_extract),
- datasets = data_list,
- select_validation_rule = list(
- x_var = sv_required("Please select an X column"),
- y_var = compose_rules(
- sv_required("Exactly 2 'Y' column variables must be chosen"),
- exactly_2_validation()
- )
+ selector_list <- data_extract_multiple_srv(
+ list(x_var = iris_extract, y_var = iris_extract, col_var = iris_extract),
+ datasets = data_list,
+ select_validation_rule = list(
+ x_var = sv_required("Please select an X column"),
+ y_var = compose_rules(
+ sv_required("Exactly 2 'Y' column variables must be chosen"),
+ exactly_2_validation()
)
)
- iv_r <- reactive({
- iv <- InputValidator$new()
- compose_and_enable_validators(
- iv,
- selector_list,
- # if validator_names = NULL then all validators are used
- # to turn on only "x_var" then set this argument to "x_var"
- validator_names = NULL
- )
- })
+ )
+ iv_r <- reactive({
+ iv <- InputValidator$new()
+ compose_and_enable_validators(
+ iv,
+ selector_list,
+ # if validator_names = NULL then all validators are used
+ # to turn on only "x_var" then set this argument to "x_var"
+ validator_names = NULL
+ )
+ })
+
+ output$out1 <- renderPrint({
+ if (iv_r()$is_valid()) {
+ ans <- lapply(selector_list(), function(x) {
+ cat(format_data_extract(x()), "\n\n")
+ })
+ } else {
+ "Check that you have made a valid selection"
+ }
+ })
+}
- output$out1 <- renderPrint({
- if (iv_r()$is_valid()) {
- ans <- lapply(selector_list(), function(x) {
- cat(format_data_extract(x()), "\n\n")
- })
- } else {
- "Check that you have made a valid selection"
- }
- })
- }
-)
if (interactive()) {
- shinyApp(app$ui, app$server)
+ shinyApp(ui, server)
}
+
}
diff --git a/man/cond_data_extract_single_ui.Rd b/man/cond_data_extract_single_ui.Rd
index 8d53ed16..65b10b99 100644
--- a/man/cond_data_extract_single_ui.Rd
+++ b/man/cond_data_extract_single_ui.Rd
@@ -23,11 +23,12 @@ Creates a panel that displays (with filter and column selection)
conditionally on \code{input[ns("dataset")] == dataname}
}
\examples{
+library(shiny)
# 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"),
+ NS("TEST"),
data_extract_spec(dataname = "test")
)
}
diff --git a/man/data_extract_multiple_srv.Rd b/man/data_extract_multiple_srv.Rd
index 6fd768c3..01f7f68e 100644
--- a/man/data_extract_multiple_srv.Rd
+++ b/man/data_extract_multiple_srv.Rd
@@ -103,65 +103,65 @@ iris_filter <- data_extract_spec(
data_list <- list(iris = reactive(iris))
-app <- shinyApp(
- ui = fluidPage(
- useShinyjs(),
- standard_layout(
- output = verbatimTextOutput("out1"),
- encoding = tagList(
- data_extract_ui(
- id = "x_var",
- label = "Please select an X column",
- data_extract_spec = iris_select
- ),
- data_extract_ui(
- id = "species_var",
- label = "Please select 2 Species",
- data_extract_spec = iris_filter
- )
+ui <- fluidPage(
+ useShinyjs(),
+ standard_layout(
+ output = verbatimTextOutput("out1"),
+ encoding = tagList(
+ data_extract_ui(
+ id = "x_var",
+ label = "Please select an X column",
+ data_extract_spec = iris_select
+ ),
+ data_extract_ui(
+ id = "species_var",
+ label = "Please select 2 Species",
+ data_extract_spec = iris_filter
)
)
- ),
- server = function(input, output, session) {
- exactly_2_validation <- function(msg) {
- ~ if (length(.) != 2) msg
- }
+ )
+)
+server <- function(input, output, session) {
+ exactly_2_validation <- function(msg) {
+ ~ if (length(.) != 2) msg
+ }
- selector_list <- data_extract_multiple_srv(
- list(x_var = iris_select, species_var = iris_filter),
- datasets = data_list,
- select_validation_rule = list(
- x_var = sv_required("Please select an X column")
- ),
- filter_validation_rule = list(
- species_var = compose_rules(
- sv_required("Exactly 2 Species must be chosen"),
- exactly_2_validation("Exactly 2 Species must be chosen")
- )
+
+ selector_list <- data_extract_multiple_srv(
+ list(x_var = iris_select, species_var = iris_filter),
+ datasets = data_list,
+ select_validation_rule = list(
+ x_var = sv_required("Please select an X column")
+ ),
+ filter_validation_rule = list(
+ species_var = compose_rules(
+ sv_required("Exactly 2 Species must be chosen"),
+ exactly_2_validation("Exactly 2 Species must be chosen")
)
)
- iv_r <- reactive({
- iv <- InputValidator$new()
- compose_and_enable_validators(
- iv,
- selector_list,
- validator_names = NULL
- )
- })
-
- output$out1 <- renderPrint({
- if (iv_r()$is_valid()) {
- ans <- lapply(selector_list(), function(x) {
- cat(format_data_extract(x()), "\n\n")
- })
- } else {
- "Please fix errors in your selection"
- }
- })
- }
-)
+ )
+ iv_r <- reactive({
+ iv <- InputValidator$new()
+ compose_and_enable_validators(
+ iv,
+ selector_list,
+ validator_names = NULL
+ )
+ })
+
+ output$out1 <- renderPrint({
+ if (iv_r()$is_valid()) {
+ ans <- lapply(selector_list(), function(x) {
+ cat(format_data_extract(x()), "\n\n")
+ })
+ } else {
+ "Please fix errors in your selection"
+ }
+ })
+}
+
if (interactive()) {
- shinyApp(app$ui, app$server)
+ shinyApp(ui, server)
}
}
diff --git a/man/data_extract_srv.Rd b/man/data_extract_srv.Rd
index 07b6f854..ae9ea933 100644
--- a/man/data_extract_srv.Rd
+++ b/man/data_extract_srv.Rd
@@ -79,10 +79,12 @@ A reactive \code{list} containing following fields:
Extracting details of the selection(s) in \link{data_extract_ui} elements.
}
\examples{
-
library(shiny)
library(shinyvalidate)
+library(teal.data)
+library(teal.widgets)
+# Sample ADSL dataset
ADSL <- data.frame(
STUDYID = "A",
USUBJID = LETTERS[1:10],
@@ -91,6 +93,7 @@ ADSL <- data.frame(
BMRKR1 = rlnorm(10)
)
+# Specification for data extraction
adsl_extract <- data_extract_spec(
dataname = "ADSL",
filter = filter_spec(vars = "SEX", choices = c("F", "M"), selected = "F"),
@@ -106,77 +109,78 @@ adsl_extract <- data_extract_spec(
# Using reactive list of data.frames
data_list <- list(ADSL = reactive(ADSL))
-join_keys <- teal.data::join_keys(teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")))
-
-app <- shinyApp(
- ui = fluidPage(
- teal.widgets::standard_layout(
- output = verbatimTextOutput("out1"),
- encoding = tagList(
- data_extract_ui(
- id = "adsl_var",
- label = "ADSL selection",
- data_extract_spec = adsl_extract
- )
+join_keys <- join_keys(join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")))
+
+# App: data extraction with validation
+ui <- fluidPage(
+ standard_layout(
+ output = verbatimTextOutput("out1"),
+ encoding = tagList(
+ data_extract_ui(
+ id = "adsl_var",
+ label = "ADSL selection",
+ data_extract_spec = adsl_extract
)
)
- ),
- server = function(input, output, session) {
- adsl_reactive_input <- data_extract_srv(
- id = "adsl_var",
- datasets = data_list,
- data_extract_spec = adsl_extract,
- join_keys = join_keys,
- select_validation_rule = sv_required("Please select a variable.")
- )
-
- iv_r <- reactive({
- iv <- InputValidator$new()
- iv$add_validator(adsl_reactive_input()$iv)
- iv$enable()
- iv
- })
-
- output$out1 <- renderPrint({
- if (iv_r()$is_valid()) {
- cat(format_data_extract(adsl_reactive_input()))
- } else {
- "Please fix errors in your selection"
- }
- })
- }
+ )
)
-if (interactive()) {
- shinyApp(app$ui, app$server)
+server <- function(input, output, session) {
+ adsl_reactive_input <- data_extract_srv(
+ id = "adsl_var",
+ datasets = data_list,
+ data_extract_spec = adsl_extract,
+ join_keys = join_keys,
+ select_validation_rule = sv_required("Please select a variable.")
+ )
+
+ iv_r <- reactive({
+ iv <- InputValidator$new()
+ iv$add_validator(adsl_reactive_input()$iv)
+ iv$enable()
+ iv
+ })
+
+ output$out1 <- renderPrint({
+ if (iv_r()$is_valid()) {
+ cat(format_data_extract(adsl_reactive_input()))
+ } else {
+ "Please fix errors in your selection"
+ }
+ })
}
+if (interactive()) {
+ shinyApp(ui, server)
+}
-app <- shinyApp(
- ui = fluidPage(
- teal.widgets::standard_layout(
- output = verbatimTextOutput("out1"),
- encoding = tagList(
- data_extract_ui(
- id = "adsl_var",
- label = "ADSL selection",
- data_extract_spec = adsl_extract
- )
+# App: simplified data extraction
+ui <- fluidPage(
+ standard_layout(
+ output = verbatimTextOutput("out1"),
+ encoding = tagList(
+ data_extract_ui(
+ id = "adsl_var",
+ label = "ADSL selection",
+ data_extract_spec = adsl_extract
)
)
- ),
- server = function(input, output, session) {
- adsl_reactive_input <- data_extract_srv(
- id = "adsl_var",
- datasets = datasets,
- data_extract_spec = adsl_extract
- )
-
- output$out1 <- renderPrint(adsl_reactive_input())
- }
+ )
)
+
+server <- function(input, output, session) {
+ adsl_reactive_input <- data_extract_srv(
+ id = "adsl_var",
+ datasets = data_list,
+ data_extract_spec = adsl_extract
+ )
+
+ output$out1 <- renderPrint(adsl_reactive_input())
+}
+
if (interactive()) {
- shinyApp(app$ui, app$server)
+ shinyApp(ui, server)
}
+
}
\references{
\link{data_extract_srv}
diff --git a/man/data_extract_ui.Rd b/man/data_extract_ui.Rd
index 6e283f15..749ea3f1 100644
--- a/man/data_extract_ui.Rd
+++ b/man/data_extract_ui.Rd
@@ -49,6 +49,7 @@ The corresponding server module can be found in \code{\link[=data_extract_srv]{d
}
\examples{
library(shiny)
+library(teal.widgets)
adtte_filters <- filter_spec(
vars = c("PARAMCD", "CNSR"),
@@ -71,7 +72,7 @@ response_spec <- data_extract_spec(
)
)
# Call to use inside your teal module UI function
-teal.widgets::standard_layout(
+standard_layout(
output = tableOutput("table"),
encoding = div(
data_extract_ui(
diff --git a/man/format_data_extract.Rd b/man/format_data_extract.Rd
index 49e32a6a..ceeb67e5 100644
--- a/man/format_data_extract.Rd
+++ b/man/format_data_extract.Rd
@@ -20,33 +20,34 @@ This function formats the output of \code{\link{data_extract_srv}}.
See the example for more information.
}
\examples{
+library(shiny)
simple_des <- data_extract_spec(
dataname = "iris",
filter = filter_spec(vars = "Petal.Length", choices = c("1.4", "1.5")),
select = select_spec(choices = c("Petal.Length", "Species"))
)
-if (interactive()) {
- shiny::shinyApp(
- ui = shiny::fluidPage(
- data_extract_ui(
- id = "extract",
- label = "data extract ui",
- data_extract_spec = simple_des,
- is_single_dataset = TRUE
- ),
- shiny::verbatimTextOutput("formatted_extract")
- ),
- server = function(input, output, session) {
- extracted_input <- data_extract_srv(
- id = "extract",
- datasets = list(iris = iris),
- data_extract_spec = simple_des
- )
- output$formatted_extract <- shiny::renderPrint({
- cat(format_data_extract(extracted_input()))
- })
- }
+ui <- fluidPage(
+ data_extract_ui(
+ id = "extract",
+ label = "data extract ui",
+ data_extract_spec = simple_des,
+ is_single_dataset = TRUE
+ ),
+ verbatimTextOutput("formatted_extract")
+)
+server <- function(input, output, session) {
+ extracted_input <- data_extract_srv(
+ id = "extract",
+ datasets = list(iris = iris),
+ data_extract_spec = simple_des
)
+ output$formatted_extract <- renderPrint({
+ cat(format_data_extract(extracted_input()))
+ })
+}
+
+if (interactive()) {
+ shinyApp(ui, server)
}
}
diff --git a/man/get_initial_filter_values.Rd b/man/get_initial_filter_values.Rd
index f00e9fd9..3d2659a8 100644
--- a/man/get_initial_filter_values.Rd
+++ b/man/get_initial_filter_values.Rd
@@ -18,13 +18,14 @@ named \code{list} with two slots \code{choices} and \code{selected}.
Returns the initial values for the \code{vals} widget of a \code{filter_spec} object
}
\examples{
+library(shiny)
# 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)))
+filtered_data_list <- list(iris = reactive(head(iris)))
filter <- filter_spec(vars = colnames(iris)[1])
filter$dataname <- "iris"
-shiny::isolate(
+isolate(
get_initial_filter_values(filter = filter, datasets = filtered_data_list)
)
diff --git a/man/get_merge_key_i.Rd b/man/get_merge_key_i.Rd
index 63edc4cd..5d6eee57 100644
--- a/man/get_merge_key_i.Rd
+++ b/man/get_merge_key_i.Rd
@@ -29,6 +29,7 @@ ids of the respective
Gets keys needed for join call of two selectors
}
\examples{
+library(teal.data)
# use non-exported function from teal.transform
get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
@@ -52,7 +53,7 @@ selector_list <- list(
)
)
-join_keys <- teal.data::join_keys(teal.data::join_key("X", "Y", c("A", "B")))
+join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
}
diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd
index c4c21fdc..1e0e7571 100644
--- a/man/get_rename_call.Rd
+++ b/man/get_rename_call.Rd
@@ -40,7 +40,7 @@ x <- list(
list(
dataname = "ADSL",
filters = NULL,
- select = utils::head(letters, 3),
+ select = head(letters, 3),
keys = c("STUDYID", "USUBJID"),
reshape = FALSE,
internal_id = "test1"
@@ -56,7 +56,7 @@ x <- list(
list(
dataname = "ADSL",
filters = NULL,
- select = utils::tail(letters, 3),
+ select = tail(letters, 3),
keys = c("STUDYID", "USUBJID"),
reshape = FALSE,
internal_id = "test3"
diff --git a/man/merge_datasets.Rd b/man/merge_datasets.Rd
index 3d8f727b..f724a604 100644
--- a/man/merge_datasets.Rd
+++ b/man/merge_datasets.Rd
@@ -84,10 +84,11 @@ merged_data <- merge_datasets(list(regressor(), response()))
}
\examples{
library(shiny)
+library(teal.data)
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")))
+join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
selector_list <- list(
list(
diff --git a/man/merge_expression_module.Rd b/man/merge_expression_module.Rd
index f879be09..9225c945 100644
--- a/man/merge_expression_module.Rd
+++ b/man/merge_expression_module.Rd
@@ -68,6 +68,9 @@ Compare the example below with that found in \code{\link[=merge_expression_srv]{
}
\examples{
library(shiny)
+library(teal.data)
+library(teal.widgets)
+
ADSL <- data.frame(
STUDYID = "A",
USUBJID = LETTERS[1:10],
@@ -85,17 +88,16 @@ ADLB$AVAL <- rlnorm(120)
ADLB$CHG <- rnorm(120)
data_list <- list(
- ADSL = ADSL,
- ADLB = ADLB
+ ADSL = reactive(ADSL),
+ ADLB = reactive(ADLB)
)
-join_keys <- teal.data::join_keys(
- teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
+join_keys <- join_keys(
+ join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+ join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
+ join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
)
-
adsl_extract <- data_extract_spec(
dataname = "ADSL",
select = select_spec(
@@ -117,36 +119,37 @@ adlb_extract <- data_extract_spec(
fixed = FALSE
)
)
-app <- shinyApp(
- ui = fluidPage(
- teal.widgets::standard_layout(
- output = div(
- verbatimTextOutput("expr"),
- dataTableOutput("data")
- ),
- encoding = tagList(
- data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
- data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
- )
+
+ui <- fluidPage(
+ standard_layout(
+ output = div(
+ verbatimTextOutput("expr"),
+ dataTableOutput("data")
+ ),
+ encoding = tagList(
+ data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
+ data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
)
- ),
- server = function(input, output, session) {
- data_q <- teal.code::qenv()
+ )
+)
+
+server <- function(input, output, session) {
+ data_q <- qenv()
- data_q <- teal.code::eval_code(
- data_q,
- "ADSL <- data.frame(
+ data_q <- eval_code(
+ data_q,
+ "ADSL <- data.frame(
STUDYID = 'A',
USUBJID = LETTERS[1:10],
SEX = rep(c('F', 'M'), 5),
AGE = rpois(10, 30),
BMRKR1 = rlnorm(10)
)"
- )
+ )
- data_q <- teal.code::eval_code(
- data_q,
- "ADLB <- expand.grid(
+ data_q <- eval_code(
+ data_q,
+ "ADLB <- expand.grid(
STUDYID = 'A',
USUBJID = LETTERS[1:10],
PARAMCD = c('ALT', 'CRP', 'IGA'),
@@ -154,26 +157,26 @@ app <- shinyApp(
AVAL = rlnorm(120),
CHG = rlnorm(120)
)"
- )
+ )
- merged_data <- merge_expression_module(
- data_extract = list(adsl_var = adsl_extract, adlb_var = adlb_extract),
- datasets = data_list,
- join_keys = join_keys,
- merge_function = "dplyr::left_join"
- )
+ merged_data <- merge_expression_module(
+ data_extract = list(adsl_var = adsl_extract, adlb_var = adlb_extract),
+ datasets = data_list,
+ join_keys = join_keys,
+ merge_function = "dplyr::left_join"
+ )
- code_merge <- reactive({
- for (exp in merged_data()$expr) data_q <- teal.code::eval_code(data_q, exp)
- data_q
- })
+ code_merge <- reactive({
+ for (exp in merged_data()$expr) data_q <- eval_code(data_q, exp)
+ data_q
+ })
+
+ output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
+ output$data <- renderDataTable(code_merge()[["ANL"]])
+}
- output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
- output$data <- renderDataTable(code_merge()[["ANL"]])
- }
-)
if (interactive()) {
- shinyApp(app$ui, app$server)
+ shinyApp(ui, server)
}
}
\seealso{
diff --git a/man/merge_expression_srv.Rd b/man/merge_expression_srv.Rd
index e15825c0..6f015830 100644
--- a/man/merge_expression_srv.Rd
+++ b/man/merge_expression_srv.Rd
@@ -74,6 +74,8 @@ Compare the example below with that found in \code{\link[=merge_expression_modul
}
\examples{
library(shiny)
+library(teal.data)
+library(teal.widgets)
ADSL <- data.frame(
STUDYID = "A",
@@ -93,14 +95,14 @@ ADLB$AVAL <- rlnorm(120)
ADLB$CHG <- rlnorm(120)
data_list <- list(
- ADSL = ADSL,
- ADLB = ADLB
+ ADSL = reactive(ADSL),
+ ADLB = reactive(ADLB)
)
-join_keys <- teal.data::join_keys(
- teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
+join_keys <- join_keys(
+ join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+ join_key("ADSL", "ADLB", c("STUDYID", "USUBJID")),
+ join_key("ADLB", "ADLB", c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
)
adsl_extract <- data_extract_spec(
@@ -125,36 +127,36 @@ adlb_extract <- data_extract_spec(
)
)
-app <- shinyApp(
- ui = fluidPage(
- teal.widgets::standard_layout(
- output = div(
- verbatimTextOutput("expr"),
- dataTableOutput("data")
- ),
- encoding = tagList(
- data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
- data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
- )
+ui <- fluidPage(
+ standard_layout(
+ output = div(
+ verbatimTextOutput("expr"),
+ dataTableOutput("data")
+ ),
+ encoding = tagList(
+ data_extract_ui("adsl_var", label = "ADSL selection", adsl_extract),
+ data_extract_ui("adlb_var", label = "ADLB selection", adlb_extract)
)
- ),
- server = function(input, output, session) {
- data_q <- teal.code::qenv()
+ )
+)
- data_q <- teal.code::eval_code(
- data_q,
- "ADSL <- data.frame(
+server <- function(input, output, session) {
+ data_q <- qenv()
+
+ data_q <- eval_code(
+ data_q,
+ "ADSL <- data.frame(
STUDYID = 'A',
USUBJID = LETTERS[1:10],
SEX = rep(c('F', 'M'), 5),
AGE = rpois(10, 30),
BMRKR1 = rlnorm(10)
)"
- )
+ )
- data_q <- teal.code::eval_code(
- data_q,
- "ADLB <- expand.grid(
+ data_q <- eval_code(
+ data_q,
+ "ADLB <- expand.grid(
STUDYID = 'A',
USUBJID = LETTERS[1:10],
PARAMCD = c('ALT', 'CRP', 'IGA'),
@@ -162,30 +164,30 @@ app <- shinyApp(
AVAL = rlnorm(120),
CHG = rlnorm(120)
)"
- )
+ )
- selector_list <- data_extract_multiple_srv(
- list(adsl_var = adsl_extract, adlb_var = adlb_extract),
- datasets = data_list
- )
- merged_data <- merge_expression_srv(
- selector_list = selector_list,
- datasets = data_list,
- join_keys = join_keys,
- merge_function = "dplyr::left_join"
- )
+ selector_list <- data_extract_multiple_srv(
+ list(adsl_var = adsl_extract, adlb_var = adlb_extract),
+ datasets = data_list
+ )
+ merged_data <- merge_expression_srv(
+ selector_list = selector_list,
+ datasets = data_list,
+ join_keys = join_keys,
+ merge_function = "dplyr::left_join"
+ )
- code_merge <- reactive({
- for (exp in merged_data()$expr) data_q <- teal.code::eval_code(data_q, exp)
- data_q
- })
+ code_merge <- reactive({
+ for (exp in merged_data()$expr) data_q <- eval_code(data_q, exp)
+ data_q
+ })
+
+ output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
+ output$data <- renderDataTable(code_merge()[["ANL"]])
+}
- output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
- output$data <- renderDataTable(code_merge()[["ANL"]])
- }
-)
if (interactive()) {
- shinyApp(app$ui, app$server)
+ shinyApp(ui, server)
}
}
\seealso{
diff --git a/man/resolve.Rd b/man/resolve.Rd
index 97790655..41d46996 100644
--- a/man/resolve.Rd
+++ b/man/resolve.Rd
@@ -21,12 +21,13 @@ Resolved object.
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\examples{
+library(shiny)
ADSL <- rADSL
attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
-data_list <- list(ADSL = shiny::reactive(ADSL))
+data_list <- list(ADSL = reactive(ADSL))
keys <- list(ADSL = attr(ADSL, "keys"))
-shiny::isolate({
+isolate({
# value_choices example
v1 <- value_choices("ADSL", "SEX", "SEX")
v1
diff --git a/man/resolve_delayed.Rd b/man/resolve_delayed.Rd
index 457d544c..8d96bcd1 100644
--- a/man/resolve_delayed.Rd
+++ b/man/resolve_delayed.Rd
@@ -38,9 +38,10 @@ Resolved object.
}}
\examples{
+library(shiny)
ADSL <- rADSL
-shiny::isolate({
- data_list <- list(ADSL = shiny::reactive(ADSL))
+isolate({
+ data_list <- list(ADSL = reactive(ADSL))
# value_choices example
v1 <- value_choices("ADSL", "SEX", "SEX")
diff --git a/man/variable_choices.Rd b/man/variable_choices.Rd
index 0a3f08af..b2d908a4 100644
--- a/man/variable_choices.Rd
+++ b/man/variable_choices.Rd
@@ -41,6 +41,8 @@ Named \code{character} vector with additional attributes or \code{delayed_data}
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\examples{
+library(teal.data)
+
ADRS <- rADRS
variable_choices(ADRS)
variable_choices(ADRS, subset = c("PARAM", "PARAMCD"))
@@ -48,7 +50,7 @@ variable_choices(ADRS, subset = c("", "PARAM", "PARAMCD"))
variable_choices(
ADRS,
subset = c("", "PARAM", "PARAMCD"),
- key = teal.data::default_cdisc_join_keys["ADRS", "ADRS"]
+ key = default_cdisc_join_keys["ADRS", "ADRS"]
)
# delayed version
From 34baa1122c333d3aa2040a0e460236ea51738cdb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Fri, 9 Feb 2024 12:46:39 +0100
Subject: [PATCH 29/62] Removes `return` call if it is the last expression
(#177)
# Pull Request
Part of #172
Simple change, but I created PR since it touches code
#### Changes description
- Removes `return(...)` call if it is the last expression
- Per NEST guidelines
---------
Co-authored-by: m7pr
---
R/choices_labeled.R | 20 +++++++----------
R/choices_selected.R | 24 ++++++++++----------
R/filter_spec.R | 39 ++++++++++++++++----------------
R/get_dplyr_call.R | 8 ++-----
R/get_merge_call.R | 17 +++++++-------
R/include_css_js.R | 2 +-
R/merge_datasets.R | 4 ++--
R/resolve.R | 49 +++++++++++++++++++++++++----------------
R/select_spec.R | 12 +++++-----
R/utils.R | 2 +-
man/choices_selected.Rd | 2 +-
man/value_choices.Rd | 2 +-
man/variable_choices.Rd | 2 +-
13 files changed, 92 insertions(+), 91 deletions(-)
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 84fde370..0307eacf 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -106,7 +106,8 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
combined_labels <- combined_labels[ord]
types <- types[ord]
}
- choices <- structure(
+
+ structure(
choices,
names = combined_labels,
raw_labels = raw_labels,
@@ -114,8 +115,6 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
class = c("choices_labeled", "character"),
types = types
)
-
- return(choices)
}
#' Wrapper on [choices_labeled] to label variables basing on existing labels in data
@@ -164,7 +163,7 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
#' # functional subset (with delayed data) - return only factor variables
#' variable_choices("ADRS", subset = function(data) {
#' idx <- vapply(data, is.factor, logical(1))
-#' return(names(data)[idx])
+#' names(data)[idx]
#' })
#' @export
#'
@@ -222,7 +221,7 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
subset <- unique(subset)
}
- res <- if ("" %in% subset) {
+ if ("" %in% subset) {
choices_labeled(
choices = c("", names(data)),
labels = c("", unname(teal.data::col_labels(data, fill = fill))),
@@ -237,8 +236,6 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
types = var_types
)
}
-
- return(res)
}
#' Wrapper on [choices_labeled] to label variable values basing on other variable values
@@ -276,7 +273,7 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
#'
#' # functional subset
#' value_choices(ADRS, "PARAMCD", "PARAM", subset = function(data) {
-#' return(levels(data$PARAMCD)[1:2])
+#' levels(data$PARAMCD)[1:2]
#' })
#' @export
#'
@@ -302,7 +299,7 @@ value_choices.character <- function(data,
var_label = NULL,
subset = NULL,
sep = " - ") {
- out <- structure(
+ structure(
list(
data = data,
var_choices = var_choices,
@@ -312,7 +309,6 @@ value_choices.character <- function(data,
),
class = c("delayed_value_choices", "delayed_data", "choices_labeled")
)
- return(out)
}
#' @rdname value_choices
@@ -373,7 +369,7 @@ value_choices.data.frame <- function(data, # nolint
attr(res, "sep") <- sep
attr(res, "var_choices") <- var_choices
attr(res, "var_label") <- var_label
- return(res)
+ res
}
#' Print choices_labeled object
@@ -397,5 +393,5 @@ print.choices_labeled <- function(x, ...) {
sep = "\n"
)
- return(invisible(x))
+ invisible(x)
}
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 0a42bce8..bd72d419 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -104,7 +104,7 @@ no_select_keyword <- "-- no selection --"
#' # with delayed data loading
#' choices_selected(variable_choices("ADSL", subset = function(data) {
#' idx <- vapply(data, is.factor, logical(1))
-#' return(names(data)[idx])
+#' names(data)[idx]
#' }))
#'
#' cs <- choices_selected(
@@ -142,11 +142,12 @@ choices_selected <- function(choices,
}
if (inherits(choices, "delayed_data")) {
- out <- structure(
- list(choices = choices, selected = selected, keep_order = keep_order, fixed = fixed),
- class = c("delayed_choices_selected", "delayed_data", "choices_selected")
+ return(
+ structure(
+ list(choices = choices, selected = selected, keep_order = keep_order, fixed = fixed),
+ class = c("delayed_choices_selected", "delayed_data", "choices_selected")
+ )
)
- return(out)
}
if (!is.null(choices) && no_select_keyword %in% choices) {
@@ -254,8 +255,7 @@ vector_reorder <- function(vec, idx) {
}
attributes(vec) <- vec_attrs
-
- return(vec)
+ vec
}
vector_pop <- function(vec, idx) {
@@ -277,7 +277,7 @@ vector_pop <- function(vec, idx) {
vec <- vec[-idx]
attributes(vec) <- vec_attrs
- return(vec)
+ vec
}
vector_remove_dups <- function(vec) {
@@ -286,12 +286,12 @@ vector_remove_dups <- function(vec) {
idx <- which(duplicated(vec))
if (length(idx) == 0) {
- return(vec)
+ vec
} else if (is.null(attributes(vec))) {
- return(unique(vec))
+ unique(vec)
} else if (identical(names(attributes(vec)), "names")) {
- return(vec[-idx])
+ vec[-idx]
} else {
- return(vector_pop(vec, idx))
+ vector_pop(vec, idx)
}
}
diff --git a/R/filter_spec.R b/R/filter_spec.R
index a3817c5c..66677e14 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -332,7 +332,7 @@ filter_spec_internal.delayed_data <- function(vars_choices, # nolint
checkmate::check_class(selected, "all_choices")
)
- out <- structure(
+ structure(
list(
vars_choices = vars_choices,
vars_selected = vars_selected,
@@ -355,7 +355,6 @@ filter_spec_internal.delayed_data <- function(vars_choices, # nolint
"delayed_data"
)
)
- return(out)
}
#' @rdname filter_spec_internal
@@ -410,23 +409,23 @@ filter_spec_internal.default <- function(vars_choices,
checkmate::assert_subset(selected, choices)
}
- res <- list(
- vars_choices = vars_choices,
- vars_selected = vars_selected,
- vars_label = vars_label,
- vars_fixed = vars_fixed,
- vars_multiple = vars_multiple,
- choices = choices,
- selected = selected,
- label = label,
- multiple = multiple,
- fixed = fixed,
- sep = sep,
- drop_keys = drop_keys,
- dataname = dataname, # modified by data_extract_spec
- initialized = initialized
+ structure(
+ list(
+ vars_choices = vars_choices,
+ vars_selected = vars_selected,
+ vars_label = vars_label,
+ vars_fixed = vars_fixed,
+ vars_multiple = vars_multiple,
+ choices = choices,
+ selected = selected,
+ label = label,
+ multiple = multiple,
+ fixed = fixed,
+ sep = sep,
+ drop_keys = drop_keys,
+ dataname = dataname, # modified by data_extract_spec
+ initialized = initialized
+ ),
+ class = "filter_spec"
)
- class(res) <- "filter_spec"
-
- return(res)
}
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index 722e764b..60797d7a 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -241,12 +241,10 @@ get_dplyr_call <- function(selector_list,
NULL
}
- final_call <- Reduce(
+ Reduce(
function(x, y) call("%>%", x, y),
Filter(function(x) !is.null(x), c(dataname_filtered, filter_call, select_call, rename_call, reshape_call))
)
-
- return(final_call)
}
#' Parse `dplyr` select call
@@ -639,12 +637,10 @@ get_reshape_unite_vals <- function(selector) {
)
unite_cols_vals <- unite_cols_vals[vapply(unite_cols_vals, length, integer(1)) > 0]
- res <- if (length(unite_cols_vals) > 0) {
+ if (length(unite_cols_vals) > 0) {
grid <- do.call(expand.grid, args = list(unite_cols_vals, stringsAsFactors = FALSE))
apply(grid, 1, paste, collapse = "_")
} else {
character(0)
}
-
- res
}
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index 2c84f276..c3edeb6e 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -112,7 +112,8 @@ get_merge_call <- function(selector_list,
anl_merge_call_i
)
}
- return(anl_merge_calls)
+
+ anl_merge_calls
}
#' Gets merge key pair list from keys list
@@ -443,7 +444,7 @@ get_anl_relabel_call <- function(columns_source, datasets, anl_name = "ANL") {
relabel_call
)
- return(relabel_and_assign_call)
+ relabel_and_assign_call
}
#' Create relabel call from named character
@@ -482,12 +483,10 @@ get_relabel_call <- function(labels) {
labels <- labels[!duplicated(names(labels))]
labels <- labels[!is.na(labels)]
- return(
- as.call(
- append(
- quote(teal.data::col_relabel),
- labels
- )
+ as.call(
+ append(
+ quote(teal.data::col_relabel),
+ labels
)
)
}
@@ -517,7 +516,7 @@ get_relabel_cols <- function(columns_source, dplyr_call_data) {
return(NULL)
}
attr(column_source, "dataname") <- dataname
- return(column_source)
+ column_source
}
)
}
diff --git a/R/include_css_js.R b/R/include_css_js.R
index 13d41741..c84bb119 100644
--- a/R/include_css_js.R
+++ b/R/include_css_js.R
@@ -16,5 +16,5 @@ include_css_files <- function(pattern = "*") {
system.file("css", package = "teal.transform", mustWork = TRUE),
pattern = pattern, full.names = TRUE
)
- return(singleton(lapply(css_files, includeCSS)))
+ singleton(lapply(css_files, includeCSS))
}
diff --git a/R/merge_datasets.R b/R/merge_datasets.R
index f49a9cfa..44fe260c 100644
--- a/R/merge_datasets.R
+++ b/R/merge_datasets.R
@@ -170,7 +170,7 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function =
filter_info = filter_info
)
logger::log_trace("merge_datasets merge code executed resulting in { anl_name } dataset.")
- return(res)
+ res
}
#' Merge selectors when `dataname`, `reshape`, `filters` and `keys` entries are identical
@@ -259,7 +259,7 @@ merge_selectors <- function(selector_list) {
}
}
- return(list(res_list, res_map_id))
+ list(res_list, res_map_id)
}
diff --git a/R/resolve.R b/R/resolve.R
index 46815988..b6ee3fb1 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -88,7 +88,8 @@ resolve.delayed_variable_choices <- function(x, datasets, keys) {
if (inherits(x$subset, "function")) {
x$subset <- resolve_delayed_expr(x$subset, ds = x$data, is_value_choices = FALSE)
}
- return(do.call("variable_choices", x))
+
+ do.call("variable_choices", x)
}
#' @export
@@ -97,7 +98,8 @@ resolve.delayed_value_choices <- function(x, datasets, keys) {
if (is.function(x$subset)) {
x$subset <- resolve_delayed_expr(x$subset, ds = x$data, is_value_choices = TRUE)
}
- return(do.call("value_choices", x))
+
+ do.call("value_choices", x)
}
#' @export
@@ -116,7 +118,7 @@ resolve.delayed_choices_selected <- function(x, datasets, keys) {
x$selected <- x$selected[which(x$selected %in% x$choices)]
}
- return(do.call("choices_selected", x))
+ do.call("choices_selected", x)
}
#' @export
@@ -125,7 +127,8 @@ resolve.delayed_select_spec <- function(x, datasets, keys) {
if (inherits(x$selected, "delayed_data")) {
x$selected <- resolve(x$selected, datasets = datasets, keys)
}
- return(do.call("select_spec", x))
+
+ do.call("select_spec", x)
}
#' @export
@@ -143,7 +146,7 @@ resolve.delayed_filter_spec <- function(x, datasets, keys) {
x$selected <- resolve(x$selected, datasets = datasets, keys)
}
- return(do.call("filter_spec_internal", x[intersect(names(x), methods::formalArgs(filter_spec_internal))]))
+ do.call("filter_spec_internal", x[intersect(names(x), methods::formalArgs(filter_spec_internal))])
}
#' @export
@@ -159,19 +162,18 @@ resolve.delayed_data_extract_spec <- function(x, datasets, keys) {
x$filter[idx] <- lapply(x$filter[idx], resolve, datasets = datasets, keys = keys)
}
- return(do.call("data_extract_spec", x))
+ do.call("data_extract_spec", x)
}
#' @export
resolve.list <- function(x, datasets, keys) {
# If specified explicitly, return it unchanged. Otherwise if delayed, resolve.
- res <- lapply(x, resolve, datasets = datasets, keys = keys)
- return(res)
+ lapply(x, resolve, datasets = datasets, keys = keys)
}
#' @export
resolve.default <- function(x, datasets, keys) {
- return(x)
+ x
}
#' Resolve expression after delayed data are loaded
@@ -224,7 +226,7 @@ resolve_delayed_expr <- function(x, ds, is_value_choices) {
}
}
- return(res)
+ res
}
#' @export
@@ -234,7 +236,8 @@ print.delayed_variable_choices <- function(x, indent = 0L, ...) {
cat(indent_msg(indent, paste("variable_choices with delayed data:", x$data)))
cat("\n")
print_delayed_list(x, indent)
- return(invisible(NULL))
+
+ invisible(NULL)
}
#' @export
@@ -244,7 +247,8 @@ print.delayed_value_choices <- function(x, indent = 0L, ...) {
cat(indent_msg(indent, paste("value_choices with delayed data: ", x$data)))
cat("\n")
print_delayed_list(x, indent)
- return(invisible(NULL))
+
+ invisible(NULL)
}
#' @export
@@ -254,7 +258,8 @@ print.delayed_choices_selected <- function(x, indent = 0L, ...) {
cat(indent_msg(indent, paste("choices_selected with delayed data: ", x$choices$data)))
cat("\n")
print_delayed_list(x, indent)
- return(invisible(NULL))
+
+ invisible(NULL)
}
#' @export
@@ -264,7 +269,8 @@ print.delayed_select_spec <- function(x, indent = 0L, ...) {
cat(indent_msg(indent, paste("select_spec with delayed data:", x$choices$data)))
cat("\n")
print_delayed_list(x, indent)
- return(invisible(NULL))
+
+ invisible(NULL)
}
#' @export
@@ -274,7 +280,8 @@ print.filter_spec <- function(x, indent = 0L, ...) {
cat(indent_msg(indent, "filter_spec with delayed data:"))
cat("\n")
print_delayed_list(x, indent)
- return(invisible(NULL))
+
+ invisible(NULL)
}
#' @export
@@ -284,7 +291,8 @@ print.delayed_filter_spec <- function(x, indent = 0L, ...) {
cat(indent_msg(indent, "filter_spec with delayed data:"))
cat("\n")
print_delayed_list(x, indent)
- return(invisible(NULL))
+
+ invisible(NULL)
}
#' @export
@@ -294,14 +302,16 @@ print.delayed_data_extract_spec <- function(x, indent = 0L, ...) {
cat(paste("data_extract_spec with delayed data:", x$dataname))
cat("\n\n")
print_delayed_list(x)
- return(invisible(NULL))
+
+ invisible(NULL)
}
indent_msg <- function(n, msg) {
checkmate::assert_integer(n, len = 1, lower = 0, any.missing = FALSE)
checkmate::assert_character(msg, min.len = 1, any.missing = FALSE)
indent <- paste(rep(" ", n), collapse = "")
- return(paste0(indent, msg))
+
+ paste0(indent, msg)
}
print_delayed_list <- function(obj, n = 0L) {
@@ -320,5 +330,6 @@ print_delayed_list <- function(obj, n = 0L) {
cat("\n")
}
}
- return(invisible(NULL))
+
+ invisible(NULL)
}
diff --git a/R/select_spec.R b/R/select_spec.R
index 7f919692..33ffd3a9 100644
--- a/R/select_spec.R
+++ b/R/select_spec.R
@@ -173,11 +173,11 @@ select_spec.default <- function(choices, # nolint
}
}
- res <- list(
- choices = choices, selected = selected, multiple = multiple, fixed = fixed,
- always_selected = always_selected, ordered = ordered, label = label
+ structure(
+ list(
+ choices = choices, selected = selected, multiple = multiple, fixed = fixed,
+ always_selected = always_selected, ordered = ordered, label = label
+ ),
+ class = "select_spec"
)
- class(res) <- "select_spec"
-
- return(res)
}
diff --git a/R/utils.R b/R/utils.R
index e268dbb5..ead8824d 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -42,7 +42,7 @@ extract_choices_labels <- function(choices, values = NULL) {
res <- res[vapply(values, function(val) which(val == choices), numeric(1))]
}
- return(res)
+ res
}
#' Function to compose `validators` from `data_extract_multiple_srv`
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index ea05aa4a..3b4462c2 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -126,7 +126,7 @@ choices_selected(
# with delayed data loading
choices_selected(variable_choices("ADSL", subset = function(data) {
idx <- vapply(data, is.factor, logical(1))
- return(names(data)[idx])
+ names(data)[idx]
}))
cs <- choices_selected(
diff --git a/man/value_choices.Rd b/man/value_choices.Rd
index de216353..cacb1cf2 100644
--- a/man/value_choices.Rd
+++ b/man/value_choices.Rd
@@ -50,6 +50,6 @@ value_choices("ADRS", c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
# functional subset
value_choices(ADRS, "PARAMCD", "PARAM", subset = function(data) {
- return(levels(data$PARAMCD)[1:2])
+ levels(data$PARAMCD)[1:2]
})
}
diff --git a/man/variable_choices.Rd b/man/variable_choices.Rd
index b2d908a4..fa37be19 100644
--- a/man/variable_choices.Rd
+++ b/man/variable_choices.Rd
@@ -59,6 +59,6 @@ variable_choices("ADRS", subset = c("USUBJID", "STUDYID"))
# functional subset (with delayed data) - return only factor variables
variable_choices("ADRS", subset = function(data) {
idx <- vapply(data, is.factor, logical(1))
- return(names(data)[idx])
+ names(data)[idx]
})
}
From 373c613c3ec0766701ad2788ae51ffe2aabe6854 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Fri, 9 Feb 2024 16:00:26 +0100
Subject: [PATCH 30/62] remove release file as it was propagated to
---
.github/ISSUE_TEMPLATE/cran-release.yaml | 121 -----------------------
1 file changed, 121 deletions(-)
delete mode 100644 .github/ISSUE_TEMPLATE/cran-release.yaml
diff --git a/.github/ISSUE_TEMPLATE/cran-release.yaml b/.github/ISSUE_TEMPLATE/cran-release.yaml
deleted file mode 100644
index 89298b7c..00000000
--- a/.github/ISSUE_TEMPLATE/cran-release.yaml
+++ /dev/null
@@ -1,121 +0,0 @@
----
-name: 🎉 CRAN Release
-description: Template for release to CRAN
-title: "[CRAN Release]: "
-labels: ["release"]
-assignees:
- - KlaudiaBB
- - cicdguy
-body:
- - type: markdown
- attributes:
- value: |
- ⚠️ Please do not link or mention any internal references in this issue. This includes internal URLs, intellectual property and references.
- - type: textarea
- id: blocked-by
- attributes:
- label: Blocked by
- description: Any PRs or issues that this release is blocked by.
- placeholder: Add a list of blocking PRs or issues here.
- value: |
- #### PRs
- - [ ] PR 1
-
- #### Issues
- - [ ] Issue 1
- validations:
- required: true
- - type: textarea
- id: pre-release
- attributes:
- label: Pre-release
- description: Pre-requisites that must be fulfilled before initiating the release process.
- placeholder: Add your list of pre-requisites here.
- value: |
- - [ ] Make sure you adhere to CRAN submission policy:
- * https://cran.r-project.org/web/packages/submission_checklist.html
- * https://cran.r-project.org/web/packages/policies.html.
- - [ ] Make sure that high priority bugs (label "priority" + "bug") have been resolved before going into the release.
- - [ ] Review old/hanging PRs before going into the release (Optional).
- - [ ] Revisit R-package's lifecycle badges (Optional).
- - [ ] Make sure that all upstream dependencies of this package that need to be submitted to CRAN were accepted before going into release activities.
- - [ ] Make sure integration tests are green 2-3 days before the release. Look carefully through logs (check for warnings and notes).
- - [ ] Decide what gets merged in before starting release activities.
- - type: textarea
- id: release
- attributes:
- label: Release
- description: The steps to be taken in order to create a release.
- placeholder: Steps to create a release.
- value: |
- #### Prepare the release
- - [ ] Create a new release candidate branch
- `git checkout -b release-candidate-vX.Y.Z`
- - [ ] Update NEWS.md file: make sure it reflects a holistic summary of what has changed in the package.
- - [ ] Remove the additional fields (`Remotes`) from the DESCRIPTION file where applicable.
- - [ ] Make sure that the minimum dependency versions are updated in the DESCRIPTION file for the package and its reverse dependencies (Optional).
- - [ ] Increase versioned dependency on {package name} to >=X.Y.Z (Optional).
- - [ ] Commit your changes and create the PR on GitHub (add "[skip vbump]" in the PR title). Add all updates, commit, and push changes:
- ```r
- # Make the necessary modifications to your files
- # Stage the changes
- git add
- # Commit the changes
- git commit -m "[skip vbump] "
- git push origin release-candidate-vX.Y.Z
- ```
-
- #### Test the release
- - [ ] Execute the manual tests on Shiny apps that are deployed on various hosting providers (Posit connect and shinyapps.io) - track the results in GitHub issue (Applicable only for frameworks that use Shiny).
- - [ ] Monitor integration tests, if integration fails, create priority issues on the board.
- - [ ] Execute UAT tests (Optional).
-
- #### CRAN submission
- - [ ] Tag the update(s) as a release candidate vX.Y.Z-rc (e.g. v0.5.3-rc1) on the release candidate branch (release-candidate-vX.Y.Z).
- ```r
- # Create rc tag for submission for internal validation
- git tag vX.Y.Z-rc
- git push origin vX.Y.Z-rc
- ```
- - [ ] Build the package locally using the command:`R CMD build .` which will generate a .tar.gz file necessary for the CRAN submission.
- - [ ] Submit the package to https://win-builder.r-project.org/upload.aspx for testing, for more details please see "Building and checking R source packages for Windows": https://win-builder.r-project.org/.
- - [ ] Once tested, send the package that was built in the previous steps to CRAN via this form: https://cran.r-project.org/submit.html.
- - [ ] Address CRAN feedback, tag the package vX.Y.Z-rc(n+1) and repeat the submission to CRAN whenever necessary.
- - [ ] Get the package accepted and published on CRAN.
-
- #### Tag the release
- - [ ] If the additional fields were removed, add them back in a separate PR, and then merge the PR back to main (add "[skip vbump]" in the PR title). If nothing was removed just merge the PR you created in the "Prepare the release" section to 'main'. Note the commit hash of the merged commit. **Note:** additional commits might be added to the `main` branch by a bot or an automation - we do **NOT** want to tag this commit.
-
- ##### Make sure of the following before continuing
- - [ ] CI checks are passing in GH before releasing the package.
- - [ ] Shiny apps are deployable and there are no errors/warnings (Applicable only for frameworks that use Shiny).
-
- - [ ] Create a git tag with the final version set to vX.Y.Z on the main branch. In order to do this:
- 1. Checkout the commit hash.
- `git checkout `
- 2. Tag the hash with the release version (vX.Y.Z).
- `git tag vX.Y.Z`
- 3. Push the tag to make the final release.
- `git push origin vX.Y.Z`
- - [ ] Update downstream package dependencies to (>=X.Y.Z) in {package name}.
- **Note:** Once the release tag is created, the package is automatically published to internal repositories.
- - type: textarea
- id: post-release
- attributes:
- label: Post-release
- description: The list of activities to be completed after the release.
- placeholder: The steps that must be taken after the release.
- value: |
- - [ ] Ensure that CRAN checks are passing for the package.
- - [ ] Make sure that the package is published to internal repositories.
- - [ ] Make sure internal documentation is up to date.
- - [ ] Review and update installation instructions for the package wherever needed (Optional).
- - [ ] Announce the release on ________.
- - type: textarea
- id: decision-tree
- attributes:
- label: Decision tree
- description: Any decision tree(s) that would aid release management
- placeholder: Any decision tree(s) that would aid release management.
- value: |
- Click [here](https://github.com/insightsengineering/.github/blob/main/.github/ISSUE_TEMPLATE/RELEASE_DECISION_TREE.md) to see the release decision tree.
From ba42e7b0f162a14cf7bbd7f3195165a725e083f3 Mon Sep 17 00:00:00 2001
From: kartikeya kirar
Date: Mon, 12 Feb 2024 18:17:42 +0530
Subject: [PATCH 31/62] removing internal functions' examples (#184)
fixes: https://github.com/insightsengineering/teal.transform/issues/181
---
R/call_utils.R | 134 ------------------------
R/data_extract_filter_module.R | 17 ---
R/data_extract_module.R | 9 --
R/data_extract_select_module.R | 8 --
R/data_extract_single_module.R | 5 -
R/filter_spec.R | 22 ----
R/get_dplyr_call.R | 157 ----------------------------
R/get_merge_call.R | 28 -----
R/merge_datasets.R | 30 ------
R/resolve.R | 13 ---
man/call_condition_choice.Rd | 11 --
man/call_condition_logical.Rd | 7 --
man/call_condition_range.Rd | 12 ---
man/call_condition_range_date.Rd | 9 --
man/call_condition_range_posixct.Rd | 12 ---
man/call_extract_array.Rd | 16 ---
man/call_extract_list.Rd | 10 --
man/call_extract_matrix.Rd | 15 ---
man/call_with_colon.Rd | 36 -------
man/calls_combine_by.Rd | 16 ---
man/cond_data_extract_single_ui.Rd | 10 --
man/data_extract_filter_ui.Rd | 6 --
man/data_extract_select_ui.Rd | 9 --
man/data_extract_single_ui.Rd | 6 --
man/filter_spec_internal.Rd | 23 ----
man/get_dplyr_call.Rd | 74 -------------
man/get_filter_call.Rd | 12 ---
man/get_initial_filter_values.Rd | 13 ---
man/get_merge_key_i.Rd | 29 -----
man/get_rename_call.Rd | 43 --------
man/get_reshape_call.Rd | 27 -----
man/get_select_call.Rd | 6 --
man/merge_selectors.Rd | 31 ------
man/resolve_delayed_expr.Rd | 14 ---
34 files changed, 870 deletions(-)
diff --git a/R/call_utils.R b/R/call_utils.R
index 08a97db5..cb8cac58 100644
--- a/R/call_utils.R
+++ b/R/call_utils.R
@@ -54,16 +54,6 @@ call_check_parse_varname <- function(varname) {
#'
#' @return `call`.
#'
-#' @examples
-#' # 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())
#' @keywords internal
#'
call_condition_choice <- function(varname, choices) {
@@ -104,17 +94,6 @@ call_condition_choice <- function(varname, choices) {
#'
#' @return `call`.
#'
-#' @examples
-#' # 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)
-#' )
#' @keywords internal
#'
call_condition_range <- function(varname, range) {
@@ -140,12 +119,6 @@ call_condition_range <- function(varname, range) {
#'
#' @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)
#' @keywords internal
#'
call_condition_logical <- function(varname, choice) {
@@ -177,17 +150,6 @@ call_condition_logical <- function(varname, choice) {
#'
#' @return `call`.
#'
-#' @examples
-#' # 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"
-#' )
#' @keywords internal
#'
call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone()) {
@@ -220,14 +182,6 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone
#'
#' @return `call`.
#'
-#' @examples
-#' # 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)
-#' )
#' @keywords internal
#'
call_condition_range_date <- function(varname, range) {
@@ -254,21 +208,6 @@ call_condition_range_date <- function(varname, range) {
#'
#' @return [Extract()] `call` for 3-dimensional array in `x[i, j, k]` notation.
#'
-#' @examples
-#' # 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 = call_condition_choice("my_array$SEX", "M"),
-#' column = call("c", "SEX", "AGE"),
-#' aisle = "RNAseq_rnaaccess"
-#' )
-#' call_extract_array(
-#' "mae_object",
-#' column = call_condition_choice("SEX", "M")
-#' )
#' @keywords internal
#'
call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle = NULL) {
@@ -317,20 +256,6 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle
#'
#' @return [Extract()] `call` for matrix in `x[i, j]` notation.
#'
-#' @examples
-#' # 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 = call_condition_choice("my_array$SEX", "M"),
-#' column = call("c", "SEX", "AGE")
-#' )
-#' call_extract_matrix(
-#' "mae_object",
-#' column = call_condition_choice("SEX", "M")
-#' )
#' @keywords internal
#'
call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) {
@@ -372,15 +297,6 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) {
#'
#' @return [Extract()] `call` in `$` or `[[` notation (depending on parameters).
#'
-#' @examples
-#' # 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) {
@@ -416,41 +332,6 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) {
#'
#' @return `call`.
#'
-#' @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(
-#' call_with_colon("glue::glue", "x = {x}", x = 10)
-#' )
-#'
-#' # mtcars$cyl evaluated
-#' print_call_and_eval(
-#' call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6)
-#' )
-#'
-#' # mtcars$cyl argument not evaluated immediately (in call expression)
-#' print_call_and_eval(
-#' call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6))
-#' )
-#'
-#' # does not work because argument is evaluated and the
-#' # non-dplyr filter does not look inside mtcars
-#' # cannot eval because it does not pass checks because of non-standard evaluation
-#' call("filter", as.name("mtcars"), quote(cyl == 6))
-#' # works, but non-dplyr filter is taken
-#' call("filter", as.name("mtcars"), mtcars$cyl == 6)
-#'
-#' nb_args <- function(...) nargs()
-#' print_call_and_eval(
-#' call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3))
-#' )
-#' # duplicate arguments
-#' 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()) {
@@ -472,21 +353,6 @@ call_with_colon <- function(name, ..., unlist_args = list()) {
#'
#' @return A combined `call`.
#'
-#' @examples
-#' # 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(
-#' call_condition_choice("SEX", "F"),
-#' call_condition_range("AGE", c(20, 50)),
-#' call_condition_choice("ARM", "ARM: A"),
-#' TRUE
-#' )
-#' )
#' @keywords internal
#'
calls_combine_by <- function(operator, calls) {
diff --git a/R/data_extract_filter_module.R b/R/data_extract_filter_module.R
index 3e52dfb4..419d357b 100644
--- a/R/data_extract_filter_module.R
+++ b/R/data_extract_filter_module.R
@@ -8,11 +8,6 @@
#'
#' @return `shiny.tag` defining the `filter_spec`'s UI element.
#'
-#' @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") {
@@ -141,18 +136,6 @@ data_extract_filter_srv <- function(id, datasets, filter) {
#'
#' @return named `list` with two slots `choices` and `selected`.
#'
-#' @examples
-#' library(shiny)
-#' # use non-exported function from teal.transform
-#' get_initial_filter_values <- getFromNamespace("get_initial_filter_values", "teal.transform")
-#'
-#' filtered_data_list <- list(iris = reactive(head(iris)))
-#' filter <- filter_spec(vars = colnames(iris)[1])
-#' filter$dataname <- "iris"
-#' isolate(
-#' get_initial_filter_values(filter = filter, datasets = filtered_data_list)
-#' )
-#'
#' @keywords internal
#'
get_initial_filter_values <- function(filter, datasets) {
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index 66674188..45f7cbcc 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -32,15 +32,6 @@ id_for_dataset <- function(dataname) {
#'
#' @return `shiny.tag` with the HTML code for the panel.
#'
-#' @examples
-#' library(shiny)
-#' # 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(
-#' NS("TEST"),
-#' data_extract_spec(dataname = "test")
-#' )
#' @keywords internal
#'
cond_data_extract_single_ui <- function(ns, single_data_extract_spec) {
diff --git a/R/data_extract_select_module.R b/R/data_extract_select_module.R
index b45f042a..63e8c696 100644
--- a/R/data_extract_select_module.R
+++ b/R/data_extract_select_module.R
@@ -7,14 +7,6 @@
#'
#' @return `shiny.tag.list` with the UI.
#'
-#' @examples
-#' # 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"
-#' )
#' @keywords internal
#'
data_extract_select_ui <- function(select, id = "select") {
diff --git a/R/data_extract_single_module.R b/R/data_extract_single_module.R
index da21e143..7c835af3 100644
--- a/R/data_extract_single_module.R
+++ b/R/data_extract_single_module.R
@@ -10,11 +10,6 @@
#'
#' @return `shiny.tag` the HTML element defining the UI.
#'
-#' @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) {
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 66677e14..14250d49 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -208,28 +208,6 @@ filter_spec <- function(vars,
#'
#' @seealso filter_spec
#'
-#' @examples
-#' # 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 <- rADRS
-#' filter_spec_internal(
-#' vars_choices = variable_choices(ADRS),
-#' vars_selected = "PARAMCD",
-#' vars_multiple = TRUE
-#' )
-#'
-#' filter_spec_internal(
-#' vars_choices = variable_choices("ADRS"),
-#' vars_selected = "PARAMCD",
-#' vars_multiple = TRUE
-#' )
#' @keywords internal
#'
filter_spec_internal <- function(vars_choices,
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index 60797d7a..5a137bba 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -130,79 +130,6 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys(
#'
#' @return (`call`) 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
-#' get_dplyr_call(
-#' list(list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = character(0),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test1"
-#' ))
-#' )
-#' get_dplyr_call(
-#' list(list(
-#' dataname = "ADSL",
-#' filters = list(list(columns = "SEX", selected = list("F", "M"))),
-#' select = character(0),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test1"
-#' ))
-#' )
-#' get_dplyr_call(
-#' list(list(
-#' dataname = "ADSL",
-#' filters = list(list(columns = "SEX", selected = list("F", "M"))),
-#' select = c("AVAL"),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test1"
-#' ))
-#' )
-#'
-#' # two datasets with rename part
-#' get_dplyr_call(
-#' list(
-#' list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = c("COL_1", "COL_2"),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test1"
-#' ),
-#' list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = c("COL_2", "COL_3"),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test2"
-#' )
-#' ),
-#' idx = 1L
-#' )
-#'
-#' # long dataset with reshape part
-#' get_dplyr_call(
-#' list(list(
-#' dataname = "ADLB",
-#' filters = list(list(
-#' columns = c("PARAMCD", "AVISIT"),
-#' selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE"))
-#' )),
-#' select = c("AVAL"),
-#' keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
-#' reshape = TRUE,
-#' internal_id = "test1"
-#' ))
-#' )
#' @keywords internal
#'
get_dplyr_call <- function(selector_list,
@@ -253,11 +180,6 @@ get_dplyr_call <- function(selector_list,
#'
#' @return `dplyr` select `call`.
#'
-#' @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) {
@@ -279,17 +201,6 @@ get_select_call <- function(select) {
#'
#' @return `dplyr` filter `call`.
#'
-#' @examples
-#' # 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")))
-#' )
-#' get_filter_call(filter = list(
-#' 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) {
@@ -420,48 +331,6 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) {
#'
#' @return (`call`) `dplyr` rename call.
#'
-#' @examples
-#' # use non-exported function from teal.transform
-#' get_rename_call <- getFromNamespace("get_rename_call", "teal.transform")
-#'
-#' x <- list(
-#' list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = head(letters, 3),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test1"
-#' ),
-#' list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = letters,
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test2"
-#' ),
-#' list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = tail(letters, 3),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test3"
-#' ),
-#' list(
-#' dataname = "ADSL",
-#' filters = NULL,
-#' select = c("aa", "bb"),
-#' keys = c("STUDYID", "USUBJID"),
-#' reshape = FALSE,
-#' internal_id = "test4"
-#' )
-#' )
-#' get_rename_call(x, 1L)
-#' get_rename_call(x, 2L)
-#' get_rename_call(x, 3L)
-#' get_rename_call(x, 4L)
#' @keywords internal
#'
get_rename_call <- function(selector_list = list(),
@@ -498,32 +367,6 @@ get_rename_call <- function(selector_list = list(),
#'
#' @return List of multiple `dplyr` calls that reshape data.
#'
-#' @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"))
-#' )
-#' select <- "AVAL"
-#' internal_id <- "ADLB"
-#'
-#' x <- list(
-#' list(
-#' dataname = "ADLB",
-#' filters = list(list(
-#' columns = c("PARAMCD", "AVISIT"),
-#' selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE")),
-#' multiple = FALSE
-#' )),
-#' select = "AVAL",
-#' keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
-#' reshape = TRUE,
-#' internal_id = "test"
-#' )
-#' )
-#' get_reshape_call(x, 1L)
#' @keywords internal
#'
get_reshape_call <- function(selector_list = list(),
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index c3edeb6e..ff7ecff6 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -206,34 +206,6 @@ get_merge_key_pair <- function(selector_from, selector_to, key_from) {
#'
#' @return `character` list of keys.
#'
-#' @examples
-#' library(teal.data)
-#' # use non-exported function from teal.transform
-#' get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
-#' get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
-#'
-#' 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"
-#' )
-#' )
-#'
-#' join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
-#' get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
-#'
#' @keywords internal
#'
get_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call_data(selector_list)) {
diff --git a/R/merge_datasets.R b/R/merge_datasets.R
index 44fe260c..817298fd 100644
--- a/R/merge_datasets.R
+++ b/R/merge_datasets.R
@@ -180,36 +180,6 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function =
#' @return List of merged selectors or original parameter if the conditions to merge are
#' not applicable.
#'
-#' @examples
-#' # use non-exported function from teal.transform
-#' merge_selectors <- getFromNamespace("merge_selectors", "teal.transform")
-#'
-#' selector_list <- list(
-#' # ADSL - SEX
-#' list(
-#' filters = NULL, select = "AGE", always_selected = NULL,
-#' reshape = FALSE, dataname = "ADSL",
-#' internal_id = "adsl_var", keys = c("STUDYID", "USUBJID")
-#' ),
-#'
-#' # ADSL - AGE
-#' list(
-#' filters = NULL, select = "SEX", always_selected = NULL,
-#' reshape = FALSE, dataname = "ADSL",
-#' internal_id = "adsl_var2", keys = c("STUDYID", "USUBJID")
-#' ),
-#'
-#' # ADLB - AVAL
-#' list(
-#' filters = NULL, select = "AVAL", always_selected = NULL,
-#' reshape = FALSE, dataname = "ADLB",
-#' internal_id = "adlb_var", keys = c(
-#' "STUDYID", "USUBJID",
-#' "PARAMCD", "AVISIT"
-#' )
-#' )
-#' )
-#' merge_selectors(selector_list)
#' @keywords internal
#'
merge_selectors <- function(selector_list) {
diff --git a/R/resolve.R b/R/resolve.R
index b6ee3fb1..fc82e837 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -186,19 +186,6 @@ resolve.default <- function(x, datasets, keys) {
#'
#' @return Character vector - result of calling function `x` on dataset `ds`.
#'
-#' @examples
-#' # 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) {
-#' idx <- vapply(data, function(x) is.numeric(x) && length(unique(x)) <= 6, logical(1))
-#' colnames(data)[idx]
-#' },
-#' ds = mtcars,
-#' is_value_choices = FALSE
-#' )
#' @keywords internal
#'
resolve_delayed_expr <- function(x, ds, is_value_choices) {
diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd
index 97af3df4..940252e0 100644
--- a/man/call_condition_choice.Rd
+++ b/man/call_condition_choice.Rd
@@ -33,15 +33,4 @@ could be insufficient for exact comparison. In this case one should specify
\description{
Compose choices condition call from inputs.
}
-\examples{
-# 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 44e9b6f5..44c2dd4d 100644
--- a/man/call_condition_logical.Rd
+++ b/man/call_condition_logical.Rd
@@ -19,11 +19,4 @@ chosen value}
\description{
Compose \code{logical} variable condition call from inputs.
}
-\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)
-}
\keyword{internal}
diff --git a/man/call_condition_range.Rd b/man/call_condition_range.Rd
index 7a803c5e..6fc816a8 100644
--- a/man/call_condition_range.Rd
+++ b/man/call_condition_range.Rd
@@ -19,16 +19,4 @@ range of the variable.}
\description{
Compose \code{numeric} range condition call from inputs.
}
-\examples{
-# 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)
-)
-}
\keyword{internal}
diff --git a/man/call_condition_range_date.Rd b/man/call_condition_range_date.Rd
index 818a237a..ec16327e 100644
--- a/man/call_condition_range_date.Rd
+++ b/man/call_condition_range_date.Rd
@@ -17,13 +17,4 @@ call_condition_range_date(varname, range)
\description{
Compose \code{Date} range condition call from inputs.
}
-\examples{
-# 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)
-)
-}
\keyword{internal}
diff --git a/man/call_condition_range_posixct.Rd b/man/call_condition_range_posixct.Rd
index bf5806c5..3f2bc967 100644
--- a/man/call_condition_range_posixct.Rd
+++ b/man/call_condition_range_posixct.Rd
@@ -22,16 +22,4 @@ By default \code{Sys.timezone()} is used.}
\description{
Compose \code{POSIXct} range condition call from inputs.
}
-\examples{
-# 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"
-)
-}
\keyword{internal}
diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd
index a1be6f44..313de084 100644
--- a/man/call_extract_array.Rd
+++ b/man/call_extract_array.Rd
@@ -24,20 +24,4 @@ name of the \code{row} or condition.}
\description{
Get call to subset and select array
}
-\examples{
-# 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 = call_condition_choice("my_array$SEX", "M"),
- column = call("c", "SEX", "AGE"),
- aisle = "RNAseq_rnaaccess"
-)
-call_extract_array(
- "mae_object",
- column = call_condition_choice("SEX", "M")
-)
-}
\keyword{internal}
diff --git a/man/call_extract_list.Rd b/man/call_extract_list.Rd
index 958ef715..49029ae8 100644
--- a/man/call_extract_list.Rd
+++ b/man/call_extract_list.Rd
@@ -19,14 +19,4 @@ call_extract_list(dataname, varname, dollar = TRUE)
\description{
Compose extract call with \code{$} operator
}
-\examples{
-# 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 be3bd026..3325c3df 100644
--- a/man/call_extract_matrix.Rd
+++ b/man/call_extract_matrix.Rd
@@ -21,19 +21,4 @@ name of the \code{column} or condition.}
\description{
Get call to subset and select matrix
}
-\examples{
-# 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 = call_condition_choice("my_array$SEX", "M"),
- column = call("c", "SEX", "AGE")
-)
-call_extract_matrix(
- "mae_object",
- column = call_condition_choice("SEX", "M")
-)
-}
\keyword{internal}
diff --git a/man/call_with_colon.Rd b/man/call_with_colon.Rd
index 2ed895b6..42f4e6ce 100644
--- a/man/call_with_colon.Rd
+++ b/man/call_with_colon.Rd
@@ -21,40 +21,4 @@ avoids the use of \code{do.call} with this function.}
\description{
The dot arguments in \code{...} 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(
- call_with_colon("glue::glue", "x = {x}", x = 10)
-)
-
-# mtcars$cyl evaluated
-print_call_and_eval(
- call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6)
-)
-
-# mtcars$cyl argument not evaluated immediately (in call expression)
-print_call_and_eval(
- call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6))
-)
-
-# does not work because argument is evaluated and the
-# non-dplyr filter does not look inside mtcars
-# cannot eval because it does not pass checks because of non-standard evaluation
-call("filter", as.name("mtcars"), quote(cyl == 6))
-# works, but non-dplyr filter is taken
-call("filter", as.name("mtcars"), mtcars$cyl == 6)
-
-nb_args <- function(...) nargs()
-print_call_and_eval(
- call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3))
-)
-# duplicate arguments
-print_call_and_eval(
- call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2))
-)
-}
\keyword{internal}
diff --git a/man/calls_combine_by.Rd b/man/calls_combine_by.Rd
index 93accf73..8d3fa9f6 100644
--- a/man/calls_combine_by.Rd
+++ b/man/calls_combine_by.Rd
@@ -17,20 +17,4 @@ A combined \code{call}.
\description{
Combine list of calls by specific operator.
}
-\examples{
-# 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(
- call_condition_choice("SEX", "F"),
- call_condition_range("AGE", c(20, 50)),
- call_condition_choice("ARM", "ARM: A"),
- TRUE
- )
-)
-}
\keyword{internal}
diff --git a/man/cond_data_extract_single_ui.Rd b/man/cond_data_extract_single_ui.Rd
index 65b10b99..81b2026d 100644
--- a/man/cond_data_extract_single_ui.Rd
+++ b/man/cond_data_extract_single_ui.Rd
@@ -22,14 +22,4 @@ Generated by \code{\link[=data_extract_spec]{data_extract_spec()}}.}
Creates a panel that displays (with filter and column selection)
conditionally on \code{input[ns("dataset")] == dataname}
}
-\examples{
-library(shiny)
-# 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(
- NS("TEST"),
- data_extract_spec(dataname = "test")
-)
-}
\keyword{internal}
diff --git a/man/data_extract_filter_ui.Rd b/man/data_extract_filter_ui.Rd
index 89ef6a41..85daec48 100644
--- a/man/data_extract_filter_ui.Rd
+++ b/man/data_extract_filter_ui.Rd
@@ -21,10 +21,4 @@ Returns a \code{shiny.tag} object with the UI for a \code{filter_spec} object
Creates two \code{optionSelectInput} elements (one for column and one for values) based
on a definition of a \code{\link[=filter_spec]{filter_spec()}} object.
}
-\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")
-}
\keyword{internal}
diff --git a/man/data_extract_select_ui.Rd b/man/data_extract_select_ui.Rd
index e17a5c61..a30731ff 100644
--- a/man/data_extract_select_ui.Rd
+++ b/man/data_extract_select_ui.Rd
@@ -19,13 +19,4 @@ to the variable selection order.}
\description{
Returns a \code{shiny.tag.list} object with the UI for a \code{select_spec} object
}
-\examples{
-# 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"
-)
-}
\keyword{internal}
diff --git a/man/data_extract_single_ui.Rd b/man/data_extract_single_ui.Rd
index a044d8db..84122a93 100644
--- a/man/data_extract_single_ui.Rd
+++ b/man/data_extract_single_ui.Rd
@@ -22,10 +22,4 @@ Returns a \code{shiny.tag} with the UI elements for a \code{data_extract_spec}
Creates a \code{shiny.tag} element defining the UI elements corresponding to a
single \code{data_extract_spec} object.
}
-\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"))
-}
\keyword{internal}
diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd
index c2efe253..09e38b11 100644
--- a/man/filter_spec_internal.Rd
+++ b/man/filter_spec_internal.Rd
@@ -126,29 +126,6 @@ Builds a configuration for the \code{data_extract_ui} module. This function cove
the configuration of filtering datasets (so called \code{filter_spec}), which then
is used to build the UI element in the \code{teal} app.
}
-\examples{
-# 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 <- rADRS
-filter_spec_internal(
- vars_choices = variable_choices(ADRS),
- vars_selected = "PARAMCD",
- vars_multiple = TRUE
-)
-
-filter_spec_internal(
- vars_choices = variable_choices("ADRS"),
- vars_selected = "PARAMCD",
- vars_multiple = TRUE
-)
-}
\seealso{
filter_spec
}
diff --git a/man/get_dplyr_call.Rd b/man/get_dplyr_call.Rd
index fbeb8a36..056eeabe 100644
--- a/man/get_dplyr_call.Rd
+++ b/man/get_dplyr_call.Rd
@@ -35,78 +35,4 @@ selections, reshapes etc. All necessary data for merging.}
\description{
Parses 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
-get_dplyr_call(
- list(list(
- dataname = "ADSL",
- filters = NULL,
- select = character(0),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test1"
- ))
-)
-get_dplyr_call(
- list(list(
- dataname = "ADSL",
- filters = list(list(columns = "SEX", selected = list("F", "M"))),
- select = character(0),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test1"
- ))
-)
-get_dplyr_call(
- list(list(
- dataname = "ADSL",
- filters = list(list(columns = "SEX", selected = list("F", "M"))),
- select = c("AVAL"),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test1"
- ))
-)
-
-# two datasets with rename part
-get_dplyr_call(
- list(
- list(
- dataname = "ADSL",
- filters = NULL,
- select = c("COL_1", "COL_2"),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test1"
- ),
- list(
- dataname = "ADSL",
- filters = NULL,
- select = c("COL_2", "COL_3"),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test2"
- )
- ),
- idx = 1L
-)
-
-# long dataset with reshape part
-get_dplyr_call(
- list(list(
- dataname = "ADLB",
- filters = list(list(
- columns = c("PARAMCD", "AVISIT"),
- selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE"))
- )),
- select = c("AVAL"),
- keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
- reshape = TRUE,
- internal_id = "test1"
- ))
-)
-}
\keyword{internal}
diff --git a/man/get_filter_call.Rd b/man/get_filter_call.Rd
index d3afea45..cea1a7d6 100644
--- a/man/get_filter_call.Rd
+++ b/man/get_filter_call.Rd
@@ -19,16 +19,4 @@ get_filter_call(filter, dataname = NULL, datasets = NULL)
\description{
Build a \code{dplyr} filter call
}
-\examples{
-# 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")))
-)
-get_filter_call(filter = list(
- list(columns = "SEX", selected = list(NA, "F", "M")),
- list(columns = "VAR", selected = list("LEVEL1", "LEVEL2"))
-))
-}
\keyword{internal}
diff --git a/man/get_initial_filter_values.Rd b/man/get_initial_filter_values.Rd
index 3d2659a8..afa709b9 100644
--- a/man/get_initial_filter_values.Rd
+++ b/man/get_initial_filter_values.Rd
@@ -16,18 +16,5 @@ named \code{list} with two slots \code{choices} and \code{selected}.
}
\description{
Returns the initial values for the \code{vals} widget of a \code{filter_spec} object
-}
-\examples{
-library(shiny)
-# use non-exported function from teal.transform
-get_initial_filter_values <- getFromNamespace("get_initial_filter_values", "teal.transform")
-
-filtered_data_list <- list(iris = reactive(head(iris)))
-filter <- filter_spec(vars = colnames(iris)[1])
-filter$dataname <- "iris"
-isolate(
- get_initial_filter_values(filter = filter, datasets = filtered_data_list)
-)
-
}
\keyword{internal}
diff --git a/man/get_merge_key_i.Rd b/man/get_merge_key_i.Rd
index 5d6eee57..7705272e 100644
--- a/man/get_merge_key_i.Rd
+++ b/man/get_merge_key_i.Rd
@@ -27,34 +27,5 @@ ids of the respective
}
\description{
Gets keys needed for join call of two selectors
-}
-\examples{
-library(teal.data)
-# use non-exported function from teal.transform
-get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
-get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
-
-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"
- )
-)
-
-join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
-get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
-
}
\keyword{internal}
diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd
index 1e0e7571..d6e12628 100644
--- a/man/get_rename_call.Rd
+++ b/man/get_rename_call.Rd
@@ -32,47 +32,4 @@ selections, reshapes etc. All necessary data for merging.}
\description{
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",
- filters = NULL,
- select = head(letters, 3),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test1"
- ),
- list(
- dataname = "ADSL",
- filters = NULL,
- select = letters,
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test2"
- ),
- list(
- dataname = "ADSL",
- filters = NULL,
- select = tail(letters, 3),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test3"
- ),
- list(
- dataname = "ADSL",
- filters = NULL,
- select = c("aa", "bb"),
- keys = c("STUDYID", "USUBJID"),
- reshape = FALSE,
- internal_id = "test4"
- )
-)
-get_rename_call(x, 1L)
-get_rename_call(x, 2L)
-get_rename_call(x, 3L)
-get_rename_call(x, 4L)
-}
\keyword{internal}
diff --git a/man/get_reshape_call.Rd b/man/get_reshape_call.Rd
index 9edb7e38..b4149970 100644
--- a/man/get_reshape_call.Rd
+++ b/man/get_reshape_call.Rd
@@ -32,31 +32,4 @@ List of multiple \code{dplyr} calls that reshape data.
\description{
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"))
-)
-select <- "AVAL"
-internal_id <- "ADLB"
-
-x <- list(
- list(
- dataname = "ADLB",
- filters = list(list(
- columns = c("PARAMCD", "AVISIT"),
- selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE")),
- multiple = FALSE
- )),
- select = "AVAL",
- keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
- reshape = TRUE,
- internal_id = "test"
- )
-)
-get_reshape_call(x, 1L)
-}
\keyword{internal}
diff --git a/man/get_select_call.Rd b/man/get_select_call.Rd
index 0deac17f..5cbc8a74 100644
--- a/man/get_select_call.Rd
+++ b/man/get_select_call.Rd
@@ -15,10 +15,4 @@ get_select_call(select)
\description{
Parse \code{dplyr} select call
}
-\examples{
-# use non-exported function from teal.transform
-get_select_call <- getFromNamespace("get_select_call", "teal.transform")
-
-get_select_call(letters)
-}
\keyword{internal}
diff --git a/man/merge_selectors.Rd b/man/merge_selectors.Rd
index 6d9ba3a7..738794d5 100644
--- a/man/merge_selectors.Rd
+++ b/man/merge_selectors.Rd
@@ -21,35 +21,4 @@ not applicable.
\description{
Merge selectors when \code{dataname}, \code{reshape}, \code{filters} and \code{keys} entries are identical
}
-\examples{
-# use non-exported function from teal.transform
-merge_selectors <- getFromNamespace("merge_selectors", "teal.transform")
-
-selector_list <- list(
- # ADSL - SEX
- list(
- filters = NULL, select = "AGE", always_selected = NULL,
- reshape = FALSE, dataname = "ADSL",
- internal_id = "adsl_var", keys = c("STUDYID", "USUBJID")
- ),
-
- # ADSL - AGE
- list(
- filters = NULL, select = "SEX", always_selected = NULL,
- reshape = FALSE, dataname = "ADSL",
- internal_id = "adsl_var2", keys = c("STUDYID", "USUBJID")
- ),
-
- # ADLB - AVAL
- list(
- filters = NULL, select = "AVAL", always_selected = NULL,
- reshape = FALSE, dataname = "ADLB",
- internal_id = "adlb_var", keys = c(
- "STUDYID", "USUBJID",
- "PARAMCD", "AVISIT"
- )
- )
-)
-merge_selectors(selector_list)
-}
\keyword{internal}
diff --git a/man/resolve_delayed_expr.Rd b/man/resolve_delayed_expr.Rd
index bcac61dc..d77701db 100644
--- a/man/resolve_delayed_expr.Rd
+++ b/man/resolve_delayed_expr.Rd
@@ -20,18 +20,4 @@ Character vector - result of calling function \code{x} on dataset \code{ds}.
\description{
Resolve expression after delayed data are loaded
}
-\examples{
-# 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) {
- idx <- vapply(data, function(x) is.numeric(x) && length(unique(x)) <= 6, logical(1))
- colnames(data)[idx]
- },
- ds = mtcars,
- is_value_choices = FALSE
-)
-}
\keyword{internal}
From aff0f350e58dd2272e94633ffe0f8ecf370571c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Mon, 12 Feb 2024 14:28:10 +0100
Subject: [PATCH 32/62] revert export of resolve
---
NAMESPACE | 1 -
R/resolve.R | 70 +++++++--------------------------
man/resolve.Rd | 104 +++++++++++++++++++++++--------------------------
3 files changed, 61 insertions(+), 114 deletions(-)
diff --git a/NAMESPACE b/NAMESPACE
index 7cef7a44..49700e8d 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -58,7 +58,6 @@ export(merge_datasets)
export(merge_expression_module)
export(merge_expression_srv)
export(no_selected_as_NULL)
-export(resolve)
export(resolve_delayed)
export(select_spec)
export(select_spec.default)
diff --git a/R/resolve.R b/R/resolve.R
index fc82e837..91db8126 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -2,6 +2,9 @@
#'
#' `r lifecycle::badge("stable")`
#'
+#' @note This is an internal function that is used by [resolve_delayed()].
+#' All the methods are used internally only.
+#'
#' @param x (`delayed_data`) object to resolve.
#' @param datasets (named `list` of `data.frame`) to use in evaluation.
#' @param keys (named `list` of `character`) to be used as the keys for each dataset.
@@ -9,63 +12,7 @@
#'
#' @return Resolved object.
#'
-#' @examples
-#' library(shiny)
-#' ADSL <- rADSL
-#'
-#' attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
-#' data_list <- list(ADSL = reactive(ADSL))
-#' keys <- list(ADSL = attr(ADSL, "keys"))
-#' isolate({
-#' # value_choices example
-#' v1 <- value_choices("ADSL", "SEX", "SEX")
-#' v1
-#' resolve(v1, data_list, keys)
-#'
-#' # variable_choices example
-#' v2 <- variable_choices("ADSL", c("BMRKR1", "BMRKR2"))
-#' v2
-#' resolve(v2, data_list, keys)
-#'
-#' # data_extract_spec example
-#' adsl_filter <- filter_spec(
-#' vars = variable_choices("ADSL", "SEX"),
-#' sep = "-",
-#' choices = value_choices("ADSL", "SEX", "SEX"),
-#' selected = "F",
-#' multiple = FALSE,
-#' label = "Choose endpoint and Censor"
-#' )
-#'
-#' adsl_select <- select_spec(
-#' label = "Select variable:",
-#' choices = variable_choices("ADSL", c("BMRKR1", "BMRKR2")),
-#' selected = "BMRKR1",
-#' multiple = FALSE,
-#' fixed = FALSE
-#' )
-#'
-#' adsl_de <- data_extract_spec(
-#' dataname = "ADSL",
-#' select = adsl_select,
-#' filter = adsl_filter
-#' )
-#'
-#' 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(
-#' ARMCD = list(
-#' ref = variable_choices("ADSL"),
-#' comp = variable_choices("ADSL")
-#' )
-#' )
-#'
-#' resolve(arm_ref_comp, data_list, keys)
-#' })
-#' @export
+#' @keywords internal
#'
resolve <- function(x, datasets, keys = NULL) {
checkmate::assert_list(datasets, types = "reactive", min.len = 1, names = "named")
@@ -79,6 +26,7 @@ resolve <- function(x, datasets, keys = NULL) {
UseMethod("resolve")
}
+#' @describeIn resolve Call [variable_choices()] on the delayed `variable_choices` object.
#' @export
resolve.delayed_variable_choices <- function(x, datasets, keys) {
if (is.null(x$key)) {
@@ -92,6 +40,7 @@ resolve.delayed_variable_choices <- function(x, datasets, keys) {
do.call("variable_choices", x)
}
+#' @describeIn resolve Call [value_choices()] on the delayed `value_choices` object.
#' @export
resolve.delayed_value_choices <- function(x, datasets, keys) {
x$data <- datasets[[x$data]]()
@@ -102,6 +51,7 @@ resolve.delayed_value_choices <- function(x, datasets, keys) {
do.call("value_choices", x)
}
+#' @describeIn resolve Call [select_spec()] on the delayed `choices_selected` object.
#' @export
resolve.delayed_choices_selected <- function(x, datasets, keys) {
if (inherits(x$selected, "delayed_data")) {
@@ -121,6 +71,7 @@ resolve.delayed_choices_selected <- function(x, datasets, keys) {
do.call("choices_selected", x)
}
+#' @describeIn resolve Call [select_spec()] on the delayed specification.
#' @export
resolve.delayed_select_spec <- function(x, datasets, keys) {
x$choices <- resolve(x$choices, datasets = datasets, keys)
@@ -131,6 +82,7 @@ resolve.delayed_select_spec <- function(x, datasets, keys) {
do.call("select_spec", x)
}
+#' @describeIn resolve Call [filter_spec()] on the delayed specification.
#' @export
resolve.delayed_filter_spec <- function(x, datasets, keys) {
if (inherits(x$vars_choices, "delayed_data")) {
@@ -149,6 +101,7 @@ resolve.delayed_filter_spec <- function(x, datasets, keys) {
do.call("filter_spec_internal", x[intersect(names(x), methods::formalArgs(filter_spec_internal))])
}
+#' @describeIn resolve Call [data_extract_spec()] on the delayed specification.
#' @export
resolve.delayed_data_extract_spec <- function(x, datasets, keys) {
x$select <- `if`(
@@ -165,12 +118,15 @@ resolve.delayed_data_extract_spec <- function(x, datasets, keys) {
do.call("data_extract_spec", x)
}
+#' @describeIn resolve Iterates over elements of the list and recursively calls
+#' `resolve`.
#' @export
resolve.list <- function(x, datasets, keys) {
# If specified explicitly, return it unchanged. Otherwise if delayed, resolve.
lapply(x, resolve, datasets = datasets, keys = keys)
}
+#' @describeIn resolve Default method that does nothing and returns `x` itself.
#' @export
resolve.default <- function(x, datasets, keys) {
x
diff --git a/man/resolve.Rd b/man/resolve.Rd
index 41d46996..104962f1 100644
--- a/man/resolve.Rd
+++ b/man/resolve.Rd
@@ -2,9 +2,33 @@
% Please edit documentation in R/resolve.R
\name{resolve}
\alias{resolve}
+\alias{resolve.delayed_variable_choices}
+\alias{resolve.delayed_value_choices}
+\alias{resolve.delayed_choices_selected}
+\alias{resolve.delayed_select_spec}
+\alias{resolve.delayed_filter_spec}
+\alias{resolve.delayed_data_extract_spec}
+\alias{resolve.list}
+\alias{resolve.default}
\title{Resolve delayed inputs by evaluating the code within the provided datasets}
\usage{
resolve(x, datasets, keys = NULL)
+
+\method{resolve}{delayed_variable_choices}(x, datasets, keys)
+
+\method{resolve}{delayed_value_choices}(x, datasets, keys)
+
+\method{resolve}{delayed_choices_selected}(x, datasets, keys)
+
+\method{resolve}{delayed_select_spec}(x, datasets, keys)
+
+\method{resolve}{delayed_filter_spec}(x, datasets, keys)
+
+\method{resolve}{delayed_data_extract_spec}(x, datasets, keys)
+
+\method{resolve}{list}(x, datasets, keys)
+
+\method{resolve}{default}(x, datasets, keys)
}
\arguments{
\item{x}{(\code{delayed_data}) object to resolve.}
@@ -20,60 +44,28 @@ Resolved object.
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
-\examples{
-library(shiny)
-ADSL <- rADSL
-
-attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
-data_list <- list(ADSL = reactive(ADSL))
-keys <- list(ADSL = attr(ADSL, "keys"))
-isolate({
- # value_choices example
- v1 <- value_choices("ADSL", "SEX", "SEX")
- v1
- resolve(v1, data_list, keys)
-
- # variable_choices example
- v2 <- variable_choices("ADSL", c("BMRKR1", "BMRKR2"))
- v2
- resolve(v2, data_list, keys)
-
- # data_extract_spec example
- adsl_filter <- filter_spec(
- vars = variable_choices("ADSL", "SEX"),
- sep = "-",
- choices = value_choices("ADSL", "SEX", "SEX"),
- selected = "F",
- multiple = FALSE,
- label = "Choose endpoint and Censor"
- )
-
- adsl_select <- select_spec(
- label = "Select variable:",
- choices = variable_choices("ADSL", c("BMRKR1", "BMRKR2")),
- selected = "BMRKR1",
- multiple = FALSE,
- fixed = FALSE
- )
-
- adsl_de <- data_extract_spec(
- dataname = "ADSL",
- select = adsl_select,
- filter = adsl_filter
- )
-
- 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(
- ARMCD = list(
- ref = variable_choices("ADSL"),
- comp = variable_choices("ADSL")
- )
- )
-
- resolve(arm_ref_comp, data_list, keys)
-})
+\section{Methods (by class)}{
+\itemize{
+\item \code{resolve(delayed_variable_choices)}: Call \code{\link[=variable_choices]{variable_choices()}} on the delayed \code{variable_choices} object.
+
+\item \code{resolve(delayed_value_choices)}: Call \code{\link[=value_choices]{value_choices()}} on the delayed \code{value_choices} object.
+
+\item \code{resolve(delayed_choices_selected)}: Call \code{\link[=select_spec]{select_spec()}} on the delayed \code{choices_selected} object.
+
+\item \code{resolve(delayed_select_spec)}: Call \code{\link[=select_spec]{select_spec()}} on the delayed specification.
+
+\item \code{resolve(delayed_filter_spec)}: Call \code{\link[=filter_spec]{filter_spec()}} on the delayed specification.
+
+\item \code{resolve(delayed_data_extract_spec)}: Call \code{\link[=data_extract_spec]{data_extract_spec()}} on the delayed specification.
+
+\item \code{resolve(list)}: Iterates over elements of the list and recursively calls
+\code{resolve}.
+
+\item \code{resolve(default)}: Default method that does nothing and returns \code{x} itself.
+
+}}
+\note{
+This is an internal function that is used by \code{\link[=resolve_delayed]{resolve_delayed()}}.
+All the methods are used internally only.
}
+\keyword{internal}
From 39568f86462327c645590da1460b25371d02df89 Mon Sep 17 00:00:00 2001
From: kartikeya kirar
Date: Tue, 13 Feb 2024 15:54:51 +0530
Subject: [PATCH 33/62] Reverting internal function's example (#187)
This reverts commit ba42e7b0f162a14cf7bbd7f3195165a725e083f3.
---
R/call_utils.R | 134 ++++++++++++++++++++++++
R/data_extract_filter_module.R | 17 +++
R/data_extract_module.R | 9 ++
R/data_extract_select_module.R | 8 ++
R/data_extract_single_module.R | 5 +
R/filter_spec.R | 22 ++++
R/get_dplyr_call.R | 157 ++++++++++++++++++++++++++++
R/get_merge_call.R | 28 +++++
R/merge_datasets.R | 30 ++++++
R/resolve.R | 13 +++
man/call_condition_choice.Rd | 11 ++
man/call_condition_logical.Rd | 7 ++
man/call_condition_range.Rd | 12 +++
man/call_condition_range_date.Rd | 9 ++
man/call_condition_range_posixct.Rd | 12 +++
man/call_extract_array.Rd | 16 +++
man/call_extract_list.Rd | 10 ++
man/call_extract_matrix.Rd | 15 +++
man/call_with_colon.Rd | 36 +++++++
man/calls_combine_by.Rd | 16 +++
man/cond_data_extract_single_ui.Rd | 10 ++
man/data_extract_filter_ui.Rd | 6 ++
man/data_extract_select_ui.Rd | 9 ++
man/data_extract_single_ui.Rd | 6 ++
man/filter_spec_internal.Rd | 23 ++++
man/get_dplyr_call.Rd | 74 +++++++++++++
man/get_filter_call.Rd | 12 +++
man/get_initial_filter_values.Rd | 13 +++
man/get_merge_key_i.Rd | 29 +++++
man/get_rename_call.Rd | 43 ++++++++
man/get_reshape_call.Rd | 27 +++++
man/get_select_call.Rd | 6 ++
man/merge_selectors.Rd | 31 ++++++
man/resolve_delayed_expr.Rd | 14 +++
34 files changed, 870 insertions(+)
diff --git a/R/call_utils.R b/R/call_utils.R
index cb8cac58..08a97db5 100644
--- a/R/call_utils.R
+++ b/R/call_utils.R
@@ -54,6 +54,16 @@ call_check_parse_varname <- function(varname) {
#'
#' @return `call`.
#'
+#' @examples
+#' # 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())
#' @keywords internal
#'
call_condition_choice <- function(varname, choices) {
@@ -94,6 +104,17 @@ call_condition_choice <- function(varname, choices) {
#'
#' @return `call`.
#'
+#' @examples
+#' # 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)
+#' )
#' @keywords internal
#'
call_condition_range <- function(varname, range) {
@@ -119,6 +140,12 @@ call_condition_range <- function(varname, range) {
#'
#' @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)
#' @keywords internal
#'
call_condition_logical <- function(varname, choice) {
@@ -150,6 +177,17 @@ call_condition_logical <- function(varname, choice) {
#'
#' @return `call`.
#'
+#' @examples
+#' # 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"
+#' )
#' @keywords internal
#'
call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone()) {
@@ -182,6 +220,14 @@ call_condition_range_posixct <- function(varname, range, timezone = Sys.timezone
#'
#' @return `call`.
#'
+#' @examples
+#' # 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)
+#' )
#' @keywords internal
#'
call_condition_range_date <- function(varname, range) {
@@ -208,6 +254,21 @@ call_condition_range_date <- function(varname, range) {
#'
#' @return [Extract()] `call` for 3-dimensional array in `x[i, j, k]` notation.
#'
+#' @examples
+#' # 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 = call_condition_choice("my_array$SEX", "M"),
+#' column = call("c", "SEX", "AGE"),
+#' aisle = "RNAseq_rnaaccess"
+#' )
+#' call_extract_array(
+#' "mae_object",
+#' column = call_condition_choice("SEX", "M")
+#' )
#' @keywords internal
#'
call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle = NULL) {
@@ -256,6 +317,20 @@ call_extract_array <- function(dataname = ".", row = NULL, column = NULL, aisle
#'
#' @return [Extract()] `call` for matrix in `x[i, j]` notation.
#'
+#' @examples
+#' # 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 = call_condition_choice("my_array$SEX", "M"),
+#' column = call("c", "SEX", "AGE")
+#' )
+#' call_extract_matrix(
+#' "mae_object",
+#' column = call_condition_choice("SEX", "M")
+#' )
#' @keywords internal
#'
call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) {
@@ -297,6 +372,15 @@ call_extract_matrix <- function(dataname = ".", row = NULL, column = NULL) {
#'
#' @return [Extract()] `call` in `$` or `[[` notation (depending on parameters).
#'
+#' @examples
+#' # 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) {
@@ -332,6 +416,41 @@ call_extract_list <- function(dataname, varname, dollar = TRUE) {
#'
#' @return `call`.
#'
+#' @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(
+#' call_with_colon("glue::glue", "x = {x}", x = 10)
+#' )
+#'
+#' # mtcars$cyl evaluated
+#' print_call_and_eval(
+#' call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6)
+#' )
+#'
+#' # mtcars$cyl argument not evaluated immediately (in call expression)
+#' print_call_and_eval(
+#' call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6))
+#' )
+#'
+#' # does not work because argument is evaluated and the
+#' # non-dplyr filter does not look inside mtcars
+#' # cannot eval because it does not pass checks because of non-standard evaluation
+#' call("filter", as.name("mtcars"), quote(cyl == 6))
+#' # works, but non-dplyr filter is taken
+#' call("filter", as.name("mtcars"), mtcars$cyl == 6)
+#'
+#' nb_args <- function(...) nargs()
+#' print_call_and_eval(
+#' call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3))
+#' )
+#' # duplicate arguments
+#' 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()) {
@@ -353,6 +472,21 @@ call_with_colon <- function(name, ..., unlist_args = list()) {
#'
#' @return A combined `call`.
#'
+#' @examples
+#' # 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(
+#' call_condition_choice("SEX", "F"),
+#' call_condition_range("AGE", c(20, 50)),
+#' call_condition_choice("ARM", "ARM: A"),
+#' TRUE
+#' )
+#' )
#' @keywords internal
#'
calls_combine_by <- function(operator, calls) {
diff --git a/R/data_extract_filter_module.R b/R/data_extract_filter_module.R
index 419d357b..3e52dfb4 100644
--- a/R/data_extract_filter_module.R
+++ b/R/data_extract_filter_module.R
@@ -8,6 +8,11 @@
#'
#' @return `shiny.tag` defining the `filter_spec`'s UI element.
#'
+#' @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") {
@@ -136,6 +141,18 @@ data_extract_filter_srv <- function(id, datasets, filter) {
#'
#' @return named `list` with two slots `choices` and `selected`.
#'
+#' @examples
+#' library(shiny)
+#' # use non-exported function from teal.transform
+#' get_initial_filter_values <- getFromNamespace("get_initial_filter_values", "teal.transform")
+#'
+#' filtered_data_list <- list(iris = reactive(head(iris)))
+#' filter <- filter_spec(vars = colnames(iris)[1])
+#' filter$dataname <- "iris"
+#' isolate(
+#' get_initial_filter_values(filter = filter, datasets = filtered_data_list)
+#' )
+#'
#' @keywords internal
#'
get_initial_filter_values <- function(filter, datasets) {
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index 45f7cbcc..66674188 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -32,6 +32,15 @@ id_for_dataset <- function(dataname) {
#'
#' @return `shiny.tag` with the HTML code for the panel.
#'
+#' @examples
+#' library(shiny)
+#' # 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(
+#' NS("TEST"),
+#' data_extract_spec(dataname = "test")
+#' )
#' @keywords internal
#'
cond_data_extract_single_ui <- function(ns, single_data_extract_spec) {
diff --git a/R/data_extract_select_module.R b/R/data_extract_select_module.R
index 63e8c696..b45f042a 100644
--- a/R/data_extract_select_module.R
+++ b/R/data_extract_select_module.R
@@ -7,6 +7,14 @@
#'
#' @return `shiny.tag.list` with the UI.
#'
+#' @examples
+#' # 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"
+#' )
#' @keywords internal
#'
data_extract_select_ui <- function(select, id = "select") {
diff --git a/R/data_extract_single_module.R b/R/data_extract_single_module.R
index 7c835af3..da21e143 100644
--- a/R/data_extract_single_module.R
+++ b/R/data_extract_single_module.R
@@ -10,6 +10,11 @@
#'
#' @return `shiny.tag` the HTML element defining the UI.
#'
+#' @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) {
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 14250d49..66677e14 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -208,6 +208,28 @@ filter_spec <- function(vars,
#'
#' @seealso filter_spec
#'
+#' @examples
+#' # 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 <- rADRS
+#' filter_spec_internal(
+#' vars_choices = variable_choices(ADRS),
+#' vars_selected = "PARAMCD",
+#' vars_multiple = TRUE
+#' )
+#'
+#' filter_spec_internal(
+#' vars_choices = variable_choices("ADRS"),
+#' vars_selected = "PARAMCD",
+#' vars_multiple = TRUE
+#' )
#' @keywords internal
#'
filter_spec_internal <- function(vars_choices,
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index 5a137bba..60797d7a 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -130,6 +130,79 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys(
#'
#' @return (`call`) 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
+#' get_dplyr_call(
+#' list(list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = character(0),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test1"
+#' ))
+#' )
+#' get_dplyr_call(
+#' list(list(
+#' dataname = "ADSL",
+#' filters = list(list(columns = "SEX", selected = list("F", "M"))),
+#' select = character(0),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test1"
+#' ))
+#' )
+#' get_dplyr_call(
+#' list(list(
+#' dataname = "ADSL",
+#' filters = list(list(columns = "SEX", selected = list("F", "M"))),
+#' select = c("AVAL"),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test1"
+#' ))
+#' )
+#'
+#' # two datasets with rename part
+#' get_dplyr_call(
+#' list(
+#' list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = c("COL_1", "COL_2"),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test1"
+#' ),
+#' list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = c("COL_2", "COL_3"),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test2"
+#' )
+#' ),
+#' idx = 1L
+#' )
+#'
+#' # long dataset with reshape part
+#' get_dplyr_call(
+#' list(list(
+#' dataname = "ADLB",
+#' filters = list(list(
+#' columns = c("PARAMCD", "AVISIT"),
+#' selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE"))
+#' )),
+#' select = c("AVAL"),
+#' keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
+#' reshape = TRUE,
+#' internal_id = "test1"
+#' ))
+#' )
#' @keywords internal
#'
get_dplyr_call <- function(selector_list,
@@ -180,6 +253,11 @@ get_dplyr_call <- function(selector_list,
#'
#' @return `dplyr` select `call`.
#'
+#' @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) {
@@ -201,6 +279,17 @@ get_select_call <- function(select) {
#'
#' @return `dplyr` filter `call`.
#'
+#' @examples
+#' # 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")))
+#' )
+#' get_filter_call(filter = list(
+#' 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) {
@@ -331,6 +420,48 @@ rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) {
#'
#' @return (`call`) `dplyr` rename call.
#'
+#' @examples
+#' # use non-exported function from teal.transform
+#' get_rename_call <- getFromNamespace("get_rename_call", "teal.transform")
+#'
+#' x <- list(
+#' list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = head(letters, 3),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test1"
+#' ),
+#' list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = letters,
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test2"
+#' ),
+#' list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = tail(letters, 3),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test3"
+#' ),
+#' list(
+#' dataname = "ADSL",
+#' filters = NULL,
+#' select = c("aa", "bb"),
+#' keys = c("STUDYID", "USUBJID"),
+#' reshape = FALSE,
+#' internal_id = "test4"
+#' )
+#' )
+#' get_rename_call(x, 1L)
+#' get_rename_call(x, 2L)
+#' get_rename_call(x, 3L)
+#' get_rename_call(x, 4L)
#' @keywords internal
#'
get_rename_call <- function(selector_list = list(),
@@ -367,6 +498,32 @@ get_rename_call <- function(selector_list = list(),
#'
#' @return List of multiple `dplyr` calls that reshape data.
#'
+#' @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"))
+#' )
+#' select <- "AVAL"
+#' internal_id <- "ADLB"
+#'
+#' x <- list(
+#' list(
+#' dataname = "ADLB",
+#' filters = list(list(
+#' columns = c("PARAMCD", "AVISIT"),
+#' selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE")),
+#' multiple = FALSE
+#' )),
+#' select = "AVAL",
+#' keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
+#' reshape = TRUE,
+#' internal_id = "test"
+#' )
+#' )
+#' get_reshape_call(x, 1L)
#' @keywords internal
#'
get_reshape_call <- function(selector_list = list(),
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index ff7ecff6..c3edeb6e 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -206,6 +206,34 @@ get_merge_key_pair <- function(selector_from, selector_to, key_from) {
#'
#' @return `character` list of keys.
#'
+#' @examples
+#' library(teal.data)
+#' # use non-exported function from teal.transform
+#' get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
+#' get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
+#'
+#' 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"
+#' )
+#' )
+#'
+#' join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
+#' get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
+#'
#' @keywords internal
#'
get_merge_key_i <- function(selector_list, idx, dplyr_call_data = get_dplyr_call_data(selector_list)) {
diff --git a/R/merge_datasets.R b/R/merge_datasets.R
index 817298fd..44fe260c 100644
--- a/R/merge_datasets.R
+++ b/R/merge_datasets.R
@@ -180,6 +180,36 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function =
#' @return List of merged selectors or original parameter if the conditions to merge are
#' not applicable.
#'
+#' @examples
+#' # use non-exported function from teal.transform
+#' merge_selectors <- getFromNamespace("merge_selectors", "teal.transform")
+#'
+#' selector_list <- list(
+#' # ADSL - SEX
+#' list(
+#' filters = NULL, select = "AGE", always_selected = NULL,
+#' reshape = FALSE, dataname = "ADSL",
+#' internal_id = "adsl_var", keys = c("STUDYID", "USUBJID")
+#' ),
+#'
+#' # ADSL - AGE
+#' list(
+#' filters = NULL, select = "SEX", always_selected = NULL,
+#' reshape = FALSE, dataname = "ADSL",
+#' internal_id = "adsl_var2", keys = c("STUDYID", "USUBJID")
+#' ),
+#'
+#' # ADLB - AVAL
+#' list(
+#' filters = NULL, select = "AVAL", always_selected = NULL,
+#' reshape = FALSE, dataname = "ADLB",
+#' internal_id = "adlb_var", keys = c(
+#' "STUDYID", "USUBJID",
+#' "PARAMCD", "AVISIT"
+#' )
+#' )
+#' )
+#' merge_selectors(selector_list)
#' @keywords internal
#'
merge_selectors <- function(selector_list) {
diff --git a/R/resolve.R b/R/resolve.R
index 91db8126..e2a8e220 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -142,6 +142,19 @@ resolve.default <- function(x, datasets, keys) {
#'
#' @return Character vector - result of calling function `x` on dataset `ds`.
#'
+#' @examples
+#' # 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) {
+#' idx <- vapply(data, function(x) is.numeric(x) && length(unique(x)) <= 6, logical(1))
+#' colnames(data)[idx]
+#' },
+#' ds = mtcars,
+#' is_value_choices = FALSE
+#' )
#' @keywords internal
#'
resolve_delayed_expr <- function(x, ds, is_value_choices) {
diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd
index 940252e0..97af3df4 100644
--- a/man/call_condition_choice.Rd
+++ b/man/call_condition_choice.Rd
@@ -33,4 +33,15 @@ could be insufficient for exact comparison. In this case one should specify
\description{
Compose choices condition call from inputs.
}
+\examples{
+# 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 44c2dd4d..44e9b6f5 100644
--- a/man/call_condition_logical.Rd
+++ b/man/call_condition_logical.Rd
@@ -19,4 +19,11 @@ chosen value}
\description{
Compose \code{logical} variable condition call from inputs.
}
+\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)
+}
\keyword{internal}
diff --git a/man/call_condition_range.Rd b/man/call_condition_range.Rd
index 6fc816a8..7a803c5e 100644
--- a/man/call_condition_range.Rd
+++ b/man/call_condition_range.Rd
@@ -19,4 +19,16 @@ range of the variable.}
\description{
Compose \code{numeric} range condition call from inputs.
}
+\examples{
+# 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)
+)
+}
\keyword{internal}
diff --git a/man/call_condition_range_date.Rd b/man/call_condition_range_date.Rd
index ec16327e..818a237a 100644
--- a/man/call_condition_range_date.Rd
+++ b/man/call_condition_range_date.Rd
@@ -17,4 +17,13 @@ call_condition_range_date(varname, range)
\description{
Compose \code{Date} range condition call from inputs.
}
+\examples{
+# 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)
+)
+}
\keyword{internal}
diff --git a/man/call_condition_range_posixct.Rd b/man/call_condition_range_posixct.Rd
index 3f2bc967..bf5806c5 100644
--- a/man/call_condition_range_posixct.Rd
+++ b/man/call_condition_range_posixct.Rd
@@ -22,4 +22,16 @@ By default \code{Sys.timezone()} is used.}
\description{
Compose \code{POSIXct} range condition call from inputs.
}
+\examples{
+# 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"
+)
+}
\keyword{internal}
diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd
index 313de084..a1be6f44 100644
--- a/man/call_extract_array.Rd
+++ b/man/call_extract_array.Rd
@@ -24,4 +24,20 @@ name of the \code{row} or condition.}
\description{
Get call to subset and select array
}
+\examples{
+# 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 = call_condition_choice("my_array$SEX", "M"),
+ column = call("c", "SEX", "AGE"),
+ aisle = "RNAseq_rnaaccess"
+)
+call_extract_array(
+ "mae_object",
+ column = call_condition_choice("SEX", "M")
+)
+}
\keyword{internal}
diff --git a/man/call_extract_list.Rd b/man/call_extract_list.Rd
index 49029ae8..958ef715 100644
--- a/man/call_extract_list.Rd
+++ b/man/call_extract_list.Rd
@@ -19,4 +19,14 @@ call_extract_list(dataname, varname, dollar = TRUE)
\description{
Compose extract call with \code{$} operator
}
+\examples{
+# 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 3325c3df..be3bd026 100644
--- a/man/call_extract_matrix.Rd
+++ b/man/call_extract_matrix.Rd
@@ -21,4 +21,19 @@ name of the \code{column} or condition.}
\description{
Get call to subset and select matrix
}
+\examples{
+# 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 = call_condition_choice("my_array$SEX", "M"),
+ column = call("c", "SEX", "AGE")
+)
+call_extract_matrix(
+ "mae_object",
+ column = call_condition_choice("SEX", "M")
+)
+}
\keyword{internal}
diff --git a/man/call_with_colon.Rd b/man/call_with_colon.Rd
index 42f4e6ce..2ed895b6 100644
--- a/man/call_with_colon.Rd
+++ b/man/call_with_colon.Rd
@@ -21,4 +21,40 @@ avoids the use of \code{do.call} with this function.}
\description{
The dot arguments in \code{...} 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(
+ call_with_colon("glue::glue", "x = {x}", x = 10)
+)
+
+# mtcars$cyl evaluated
+print_call_and_eval(
+ call_with_colon("dplyr::filter", as.name("mtcars"), mtcars$cyl == 6)
+)
+
+# mtcars$cyl argument not evaluated immediately (in call expression)
+print_call_and_eval(
+ call_with_colon("dplyr::filter", as.name("mtcars"), quote(cyl == 6))
+)
+
+# does not work because argument is evaluated and the
+# non-dplyr filter does not look inside mtcars
+# cannot eval because it does not pass checks because of non-standard evaluation
+call("filter", as.name("mtcars"), quote(cyl == 6))
+# works, but non-dplyr filter is taken
+call("filter", as.name("mtcars"), mtcars$cyl == 6)
+
+nb_args <- function(...) nargs()
+print_call_and_eval(
+ call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args3 = 3))
+)
+# duplicate arguments
+print_call_and_eval(
+ call_with_colon("nb_args", arg1 = 1, unlist_args = list(arg2 = 2, args2 = 2))
+)
+}
\keyword{internal}
diff --git a/man/calls_combine_by.Rd b/man/calls_combine_by.Rd
index 8d3fa9f6..93accf73 100644
--- a/man/calls_combine_by.Rd
+++ b/man/calls_combine_by.Rd
@@ -17,4 +17,20 @@ A combined \code{call}.
\description{
Combine list of calls by specific operator.
}
+\examples{
+# 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(
+ call_condition_choice("SEX", "F"),
+ call_condition_range("AGE", c(20, 50)),
+ call_condition_choice("ARM", "ARM: A"),
+ TRUE
+ )
+)
+}
\keyword{internal}
diff --git a/man/cond_data_extract_single_ui.Rd b/man/cond_data_extract_single_ui.Rd
index 81b2026d..65b10b99 100644
--- a/man/cond_data_extract_single_ui.Rd
+++ b/man/cond_data_extract_single_ui.Rd
@@ -22,4 +22,14 @@ Generated by \code{\link[=data_extract_spec]{data_extract_spec()}}.}
Creates a panel that displays (with filter and column selection)
conditionally on \code{input[ns("dataset")] == dataname}
}
+\examples{
+library(shiny)
+# 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(
+ NS("TEST"),
+ data_extract_spec(dataname = "test")
+)
+}
\keyword{internal}
diff --git a/man/data_extract_filter_ui.Rd b/man/data_extract_filter_ui.Rd
index 85daec48..89ef6a41 100644
--- a/man/data_extract_filter_ui.Rd
+++ b/man/data_extract_filter_ui.Rd
@@ -21,4 +21,10 @@ Returns a \code{shiny.tag} object with the UI for a \code{filter_spec} object
Creates two \code{optionSelectInput} elements (one for column and one for values) based
on a definition of a \code{\link[=filter_spec]{filter_spec()}} object.
}
+\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")
+}
\keyword{internal}
diff --git a/man/data_extract_select_ui.Rd b/man/data_extract_select_ui.Rd
index a30731ff..e17a5c61 100644
--- a/man/data_extract_select_ui.Rd
+++ b/man/data_extract_select_ui.Rd
@@ -19,4 +19,13 @@ to the variable selection order.}
\description{
Returns a \code{shiny.tag.list} object with the UI for a \code{select_spec} object
}
+\examples{
+# 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"
+)
+}
\keyword{internal}
diff --git a/man/data_extract_single_ui.Rd b/man/data_extract_single_ui.Rd
index 84122a93..a044d8db 100644
--- a/man/data_extract_single_ui.Rd
+++ b/man/data_extract_single_ui.Rd
@@ -22,4 +22,10 @@ Returns a \code{shiny.tag} with the UI elements for a \code{data_extract_spec}
Creates a \code{shiny.tag} element defining the UI elements corresponding to a
single \code{data_extract_spec} object.
}
+\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"))
+}
\keyword{internal}
diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd
index 09e38b11..c2efe253 100644
--- a/man/filter_spec_internal.Rd
+++ b/man/filter_spec_internal.Rd
@@ -126,6 +126,29 @@ Builds a configuration for the \code{data_extract_ui} module. This function cove
the configuration of filtering datasets (so called \code{filter_spec}), which then
is used to build the UI element in the \code{teal} app.
}
+\examples{
+# 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 <- rADRS
+filter_spec_internal(
+ vars_choices = variable_choices(ADRS),
+ vars_selected = "PARAMCD",
+ vars_multiple = TRUE
+)
+
+filter_spec_internal(
+ vars_choices = variable_choices("ADRS"),
+ vars_selected = "PARAMCD",
+ vars_multiple = TRUE
+)
+}
\seealso{
filter_spec
}
diff --git a/man/get_dplyr_call.Rd b/man/get_dplyr_call.Rd
index 056eeabe..fbeb8a36 100644
--- a/man/get_dplyr_call.Rd
+++ b/man/get_dplyr_call.Rd
@@ -35,4 +35,78 @@ selections, reshapes etc. All necessary data for merging.}
\description{
Parses 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
+get_dplyr_call(
+ list(list(
+ dataname = "ADSL",
+ filters = NULL,
+ select = character(0),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test1"
+ ))
+)
+get_dplyr_call(
+ list(list(
+ dataname = "ADSL",
+ filters = list(list(columns = "SEX", selected = list("F", "M"))),
+ select = character(0),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test1"
+ ))
+)
+get_dplyr_call(
+ list(list(
+ dataname = "ADSL",
+ filters = list(list(columns = "SEX", selected = list("F", "M"))),
+ select = c("AVAL"),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test1"
+ ))
+)
+
+# two datasets with rename part
+get_dplyr_call(
+ list(
+ list(
+ dataname = "ADSL",
+ filters = NULL,
+ select = c("COL_1", "COL_2"),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test1"
+ ),
+ list(
+ dataname = "ADSL",
+ filters = NULL,
+ select = c("COL_2", "COL_3"),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test2"
+ )
+ ),
+ idx = 1L
+)
+
+# long dataset with reshape part
+get_dplyr_call(
+ list(list(
+ dataname = "ADLB",
+ filters = list(list(
+ columns = c("PARAMCD", "AVISIT"),
+ selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE"))
+ )),
+ select = c("AVAL"),
+ keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
+ reshape = TRUE,
+ internal_id = "test1"
+ ))
+)
+}
\keyword{internal}
diff --git a/man/get_filter_call.Rd b/man/get_filter_call.Rd
index cea1a7d6..d3afea45 100644
--- a/man/get_filter_call.Rd
+++ b/man/get_filter_call.Rd
@@ -19,4 +19,16 @@ get_filter_call(filter, dataname = NULL, datasets = NULL)
\description{
Build a \code{dplyr} filter call
}
+\examples{
+# 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")))
+)
+get_filter_call(filter = list(
+ list(columns = "SEX", selected = list(NA, "F", "M")),
+ list(columns = "VAR", selected = list("LEVEL1", "LEVEL2"))
+))
+}
\keyword{internal}
diff --git a/man/get_initial_filter_values.Rd b/man/get_initial_filter_values.Rd
index afa709b9..3d2659a8 100644
--- a/man/get_initial_filter_values.Rd
+++ b/man/get_initial_filter_values.Rd
@@ -16,5 +16,18 @@ named \code{list} with two slots \code{choices} and \code{selected}.
}
\description{
Returns the initial values for the \code{vals} widget of a \code{filter_spec} object
+}
+\examples{
+library(shiny)
+# use non-exported function from teal.transform
+get_initial_filter_values <- getFromNamespace("get_initial_filter_values", "teal.transform")
+
+filtered_data_list <- list(iris = reactive(head(iris)))
+filter <- filter_spec(vars = colnames(iris)[1])
+filter$dataname <- "iris"
+isolate(
+ get_initial_filter_values(filter = filter, datasets = filtered_data_list)
+)
+
}
\keyword{internal}
diff --git a/man/get_merge_key_i.Rd b/man/get_merge_key_i.Rd
index 7705272e..5d6eee57 100644
--- a/man/get_merge_key_i.Rd
+++ b/man/get_merge_key_i.Rd
@@ -27,5 +27,34 @@ ids of the respective
}
\description{
Gets keys needed for join call of two selectors
+}
+\examples{
+library(teal.data)
+# use non-exported function from teal.transform
+get_merge_key_i <- getFromNamespace("get_merge_key_i", "teal.transform")
+get_dplyr_call_data <- getFromNamespace("get_dplyr_call_data", "teal.transform")
+
+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"
+ )
+)
+
+join_keys <- join_keys(join_key("X", "Y", c("A", "B")))
+get_merge_key_i(selector_list, 2L, get_dplyr_call_data(selector_list, join_keys))
+
}
\keyword{internal}
diff --git a/man/get_rename_call.Rd b/man/get_rename_call.Rd
index d6e12628..1e0e7571 100644
--- a/man/get_rename_call.Rd
+++ b/man/get_rename_call.Rd
@@ -32,4 +32,47 @@ selections, reshapes etc. All necessary data for merging.}
\description{
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",
+ filters = NULL,
+ select = head(letters, 3),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test1"
+ ),
+ list(
+ dataname = "ADSL",
+ filters = NULL,
+ select = letters,
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test2"
+ ),
+ list(
+ dataname = "ADSL",
+ filters = NULL,
+ select = tail(letters, 3),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test3"
+ ),
+ list(
+ dataname = "ADSL",
+ filters = NULL,
+ select = c("aa", "bb"),
+ keys = c("STUDYID", "USUBJID"),
+ reshape = FALSE,
+ internal_id = "test4"
+ )
+)
+get_rename_call(x, 1L)
+get_rename_call(x, 2L)
+get_rename_call(x, 3L)
+get_rename_call(x, 4L)
+}
\keyword{internal}
diff --git a/man/get_reshape_call.Rd b/man/get_reshape_call.Rd
index b4149970..9edb7e38 100644
--- a/man/get_reshape_call.Rd
+++ b/man/get_reshape_call.Rd
@@ -32,4 +32,31 @@ List of multiple \code{dplyr} calls that reshape data.
\description{
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"))
+)
+select <- "AVAL"
+internal_id <- "ADLB"
+
+x <- list(
+ list(
+ dataname = "ADLB",
+ filters = list(list(
+ columns = c("PARAMCD", "AVISIT"),
+ selected = list(c("ALBCV", "SCREENING"), c("ALBCV", "BASELINE")),
+ multiple = FALSE
+ )),
+ select = "AVAL",
+ keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"),
+ reshape = TRUE,
+ internal_id = "test"
+ )
+)
+get_reshape_call(x, 1L)
+}
\keyword{internal}
diff --git a/man/get_select_call.Rd b/man/get_select_call.Rd
index 5cbc8a74..0deac17f 100644
--- a/man/get_select_call.Rd
+++ b/man/get_select_call.Rd
@@ -15,4 +15,10 @@ get_select_call(select)
\description{
Parse \code{dplyr} select call
}
+\examples{
+# use non-exported function from teal.transform
+get_select_call <- getFromNamespace("get_select_call", "teal.transform")
+
+get_select_call(letters)
+}
\keyword{internal}
diff --git a/man/merge_selectors.Rd b/man/merge_selectors.Rd
index 738794d5..6d9ba3a7 100644
--- a/man/merge_selectors.Rd
+++ b/man/merge_selectors.Rd
@@ -21,4 +21,35 @@ not applicable.
\description{
Merge selectors when \code{dataname}, \code{reshape}, \code{filters} and \code{keys} entries are identical
}
+\examples{
+# use non-exported function from teal.transform
+merge_selectors <- getFromNamespace("merge_selectors", "teal.transform")
+
+selector_list <- list(
+ # ADSL - SEX
+ list(
+ filters = NULL, select = "AGE", always_selected = NULL,
+ reshape = FALSE, dataname = "ADSL",
+ internal_id = "adsl_var", keys = c("STUDYID", "USUBJID")
+ ),
+
+ # ADSL - AGE
+ list(
+ filters = NULL, select = "SEX", always_selected = NULL,
+ reshape = FALSE, dataname = "ADSL",
+ internal_id = "adsl_var2", keys = c("STUDYID", "USUBJID")
+ ),
+
+ # ADLB - AVAL
+ list(
+ filters = NULL, select = "AVAL", always_selected = NULL,
+ reshape = FALSE, dataname = "ADLB",
+ internal_id = "adlb_var", keys = c(
+ "STUDYID", "USUBJID",
+ "PARAMCD", "AVISIT"
+ )
+ )
+)
+merge_selectors(selector_list)
+}
\keyword{internal}
diff --git a/man/resolve_delayed_expr.Rd b/man/resolve_delayed_expr.Rd
index d77701db..bcac61dc 100644
--- a/man/resolve_delayed_expr.Rd
+++ b/man/resolve_delayed_expr.Rd
@@ -20,4 +20,18 @@ Character vector - result of calling function \code{x} on dataset \code{ds}.
\description{
Resolve expression after delayed data are loaded
}
+\examples{
+# 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) {
+ idx <- vapply(data, function(x) is.numeric(x) && length(unique(x)) <= 6, logical(1))
+ colnames(data)[idx]
+ },
+ ds = mtcars,
+ is_value_choices = FALSE
+)
+}
\keyword{internal}
From 38e237c2f3026384c2b4761426a0824b4ace6817 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 11:50:41 +0100
Subject: [PATCH 34/62] restore `@examples` for resolve
---
R/resolve.R | 71 ++++++++++++++++++++++++++++++-------
man/resolve.Rd | 59 ++++++++++++++++++++++++++++++
man/resolve_delayed_expr.Rd | 14 --------
3 files changed, 117 insertions(+), 27 deletions(-)
diff --git a/R/resolve.R b/R/resolve.R
index e2a8e220..8e25588c 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -12,6 +12,64 @@
#'
#' @return Resolved object.
#'
+#' @examples
+#' resolve <- getFromNamespace("resolve", "teal.transform")
+#' library(shiny)
+#' ADSL <- rADSL
+#'
+#' attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
+#' data_list <- list(ADSL = reactive(ADSL))
+#' keys <- list(ADSL = attr(ADSL, "keys"))
+#' isolate({
+#' # value_choices example
+#' v1 <- value_choices("ADSL", "SEX", "SEX")
+#' v1
+#' resolve(v1, data_list, keys)
+#'
+#' # variable_choices example
+#' v2 <- variable_choices("ADSL", c("BMRKR1", "BMRKR2"))
+#' v2
+#' resolve(v2, data_list, keys)
+#'
+#' # data_extract_spec example
+#' adsl_filter <- filter_spec(
+#' vars = variable_choices("ADSL", "SEX"),
+#' sep = "-",
+#' choices = value_choices("ADSL", "SEX", "SEX"),
+#' selected = "F",
+#' multiple = FALSE,
+#' label = "Choose endpoint and Censor"
+#' )
+#'
+#' adsl_select <- select_spec(
+#' label = "Select variable:",
+#' choices = variable_choices("ADSL", c("BMRKR1", "BMRKR2")),
+#' selected = "BMRKR1",
+#' multiple = FALSE,
+#' fixed = FALSE
+#' )
+#'
+#' adsl_de <- data_extract_spec(
+#' dataname = "ADSL",
+#' select = adsl_select,
+#' filter = adsl_filter
+#' )
+#'
+#' 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(
+#' ARMCD = list(
+#' ref = variable_choices("ADSL"),
+#' comp = variable_choices("ADSL")
+#' )
+#' )
+#'
+#' resolve(arm_ref_comp, data_list, keys)
+#' })
+#'
#' @keywords internal
#'
resolve <- function(x, datasets, keys = NULL) {
@@ -142,19 +200,6 @@ resolve.default <- function(x, datasets, keys) {
#'
#' @return Character vector - result of calling function `x` on dataset `ds`.
#'
-#' @examples
-#' # 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) {
-#' idx <- vapply(data, function(x) is.numeric(x) && length(unique(x)) <= 6, logical(1))
-#' colnames(data)[idx]
-#' },
-#' ds = mtcars,
-#' is_value_choices = FALSE
-#' )
#' @keywords internal
#'
resolve_delayed_expr <- function(x, ds, is_value_choices) {
diff --git a/man/resolve.Rd b/man/resolve.Rd
index 104962f1..c1fe5d1a 100644
--- a/man/resolve.Rd
+++ b/man/resolve.Rd
@@ -67,5 +67,64 @@ Resolved object.
\note{
This is an internal function that is used by \code{\link[=resolve_delayed]{resolve_delayed()}}.
All the methods are used internally only.
+}
+\examples{
+resolve <- getFromNamespace("resolve", "teal.transform")
+library(shiny)
+ADSL <- rADSL
+
+attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
+data_list <- list(ADSL = reactive(ADSL))
+keys <- list(ADSL = attr(ADSL, "keys"))
+isolate({
+ # value_choices example
+ v1 <- value_choices("ADSL", "SEX", "SEX")
+ v1
+ resolve(v1, data_list, keys)
+
+ # variable_choices example
+ v2 <- variable_choices("ADSL", c("BMRKR1", "BMRKR2"))
+ v2
+ resolve(v2, data_list, keys)
+
+ # data_extract_spec example
+ adsl_filter <- filter_spec(
+ vars = variable_choices("ADSL", "SEX"),
+ sep = "-",
+ choices = value_choices("ADSL", "SEX", "SEX"),
+ selected = "F",
+ multiple = FALSE,
+ label = "Choose endpoint and Censor"
+ )
+
+ adsl_select <- select_spec(
+ label = "Select variable:",
+ choices = variable_choices("ADSL", c("BMRKR1", "BMRKR2")),
+ selected = "BMRKR1",
+ multiple = FALSE,
+ fixed = FALSE
+ )
+
+ adsl_de <- data_extract_spec(
+ dataname = "ADSL",
+ select = adsl_select,
+ filter = adsl_filter
+ )
+
+ 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(
+ ARMCD = list(
+ ref = variable_choices("ADSL"),
+ comp = variable_choices("ADSL")
+ )
+ )
+
+ resolve(arm_ref_comp, data_list, keys)
+})
+
}
\keyword{internal}
diff --git a/man/resolve_delayed_expr.Rd b/man/resolve_delayed_expr.Rd
index bcac61dc..d77701db 100644
--- a/man/resolve_delayed_expr.Rd
+++ b/man/resolve_delayed_expr.Rd
@@ -20,18 +20,4 @@ Character vector - result of calling function \code{x} on dataset \code{ds}.
\description{
Resolve expression after delayed data are loaded
}
-\examples{
-# 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) {
- idx <- vapply(data, function(x) is.numeric(x) && length(unique(x)) <= 6, logical(1))
- colnames(data)[idx]
- },
- ds = mtcars,
- is_value_choices = FALSE
-)
-}
\keyword{internal}
From cba2255e53081a21ee00768df822dc3b41f6b79a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 11:59:03 +0100
Subject: [PATCH 35/62] backticks on site and adds --as-cran to project
settings
---
_pkgdown.yml | 2 +-
teal.transform.Rproj | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/_pkgdown.yml b/_pkgdown.yml
index d547d427..5d33ca80 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -23,7 +23,7 @@ navbar:
reference:
- title: Data extract constructors
desc: >-
- Functions used to create transform instructions for teal applications.
+ Functions used to create transform instructions for `teal` applications.
contents:
- add_no_selected_choices
- all_choices
diff --git a/teal.transform.Rproj b/teal.transform.Rproj
index cba1b6b7..0ee12cde 100644
--- a/teal.transform.Rproj
+++ b/teal.transform.Rproj
@@ -18,4 +18,5 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
+PackageCheckArgs: --as-cran
PackageRoxygenize: rd,collate,namespace
From 18727eb94c84506b4273a5154fca2dddcca37a2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 12:06:10 +0100
Subject: [PATCH 36/62] Update README.md
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: kartikeya kirar
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 0d9ec9f6..87c66518 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.slice')
+install.packages('teal.transform')
# install.packages("pak")
pak::pak("insightsengineering/teal.transform@*release")
From a6515000b0a158432191237011bf3d6304b3bdcd Mon Sep 17 00:00:00 2001
From: unknown
Date: Tue, 13 Feb 2024 16:39:56 +0530
Subject: [PATCH 37/62] adding cran badges and updated text (consistent with
other packages)
---
README.md | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 0d9ec9f6..8bf2b29d 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,11 @@
# teal.transform
+[![CRAN Version](https://www.r-pkg.org/badges/version/teal.transform?color=green)](https://cran.r-project.org/package=teal.transform)
+[![Total Downloads](http://cranlogs.r-pkg.org/badges/grand-total/teal.transform?color=green)](https://cran.r-project.org/package=teal.transform)
+[![Last Month Downloads](http://cranlogs.r-pkg.org/badges/last-month/teal.transform?color=green)](https://cran.r-project.org/package=teal.transform)
+[![Last Week Downloads](http://cranlogs.r-pkg.org/badges/last-week/teal.transform?color=green)](https://cran.r-project.org/package=teal.transform)
+
[![Check 🛠](https://github.com/insightsengineering/teal.transform/actions/workflows/check.yaml/badge.svg)](https://insightsengineering.github.io/teal.transform/main/unit-test-report/)
[![Docs 📚](https://github.com/insightsengineering/teal.transform/actions/workflows/docs.yaml/badge.svg)](https://insightsengineering.github.io/teal.transform/latest-tag/)
[![Code Coverage 📔](https://raw.githubusercontent.com/insightsengineering/teal.transform/_xml_coverage_reports/data/main/badge.svg)](https://insightsengineering.github.io/teal.transform/main/coverage-report/)
@@ -73,7 +78,7 @@ shinyApp(ui, server)
## Getting help
-If you encounter a bug or you have a feature request - please file an issue. For questions, discussions and staying up to date, please use the "teal" channel in the [`pharmaverse` slack workspace](https://pharmaverse.slack.com).
+If you encounter a bug or have a feature request, please file an issue. For questions, discussions, and staying up to date, please use the `teal` channel in the [`pharmaverse` slack workspace](https://pharmaverse.slack.com).
## Stargazers and Forkers
From 9edc4280d3cef046e072c53a443c2bd2644c8cea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 12:27:03 +0100
Subject: [PATCH 38/62] revert to use pkg prefix for rAD** calls (see #142)
---
R/choices_labeled.R | 8 ++++----
R/choices_selected.R | 2 +-
R/filter_spec.R | 2 +-
R/resolve.R | 2 +-
R/resolve_delayed.R | 2 +-
README.md | 2 +-
data-raw/data.R | 3 +++
man/choices_labeled.Rd | 4 ++--
man/choices_selected.Rd | 2 +-
man/filter_spec_internal.Rd | 2 +-
man/resolve.Rd | 2 +-
man/resolve_delayed.Rd | 2 +-
man/value_choices.Rd | 2 +-
man/variable_choices.Rd | 2 +-
tests/testthat/test-data_extract_module.R | 4 ++--
tests/testthat/test-data_extract_multiple_srv.R | 6 +++---
tests/testthat/test-data_extract_spec.R | 4 ++--
tests/testthat/test-data_extract_srv.R | 6 +++---
tests/testthat/test-delayed_data_extract.R | 8 ++++----
tests/testthat/test-filter_spec.R | 6 +++---
tests/testthat/test-resolve.R | 4 ++--
tests/testthat/test-resolve_delayed.R | 4 ++--
tests/testthat/test-select_spec.R | 4 ++--
tests/testthat/test-value_choices.R | 4 ++--
tests/testthat/test-variable_choices.R | 4 ++--
vignettes/data-extract-merge.Rmd | 4 ++--
vignettes/data-extract.Rmd | 4 ++--
vignettes/data-merge.Rmd | 4 ++--
28 files changed, 53 insertions(+), 50 deletions(-)
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 0307eacf..dbf41d29 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -23,8 +23,8 @@
#' library(shiny)
#' library(teal.data)
#'
-#' ADSL <- rADSL
-#' ADTTE <- rADTTE
+#' ADSL <- teal.transform::rADSL
+#' ADTTE <- teal.transform::rADTTE
#'
#' choices1 <- choices_labeled(names(ADSL), col_labels(ADSL, fill = FALSE))
#' choices2 <- choices_labeled(ADTTE$PARAMCD, ADTTE$PARAM)
@@ -147,7 +147,7 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
#' @examples
#' library(teal.data)
#'
-#' ADRS <- rADRS
+#' ADRS <- teal.transform::rADRS
#' variable_choices(ADRS)
#' variable_choices(ADRS, subset = c("PARAM", "PARAMCD"))
#' variable_choices(ADRS, subset = c("", "PARAM", "PARAMCD"))
@@ -260,7 +260,7 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
#' @return named character vector or `delayed_data` object.
#'
#' @examples
-#' ADRS <- rADRS
+#' ADRS <- teal.transform::rADRS
#' value_choices(ADRS, "PARAMCD", "PARAM", subset = c("BESRSPI", "INVET"))
#' value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
#' value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"),
diff --git a/R/choices_selected.R b/R/choices_selected.R
index bd07d120..551ace4e 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -50,7 +50,7 @@ no_select_keyword <- "-- no selection --"
#' selected = "C"
#' )
#'
-#' ADSL <- rADSL
+#' ADSL <- teal.transform::rADSL
#' choices_selected(variable_choices(ADSL), "SEX")
#'
#' # How to select nothing
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 66677e14..034dd9ae 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -218,7 +218,7 @@ filter_spec <- function(vars,
#' vars_multiple = TRUE
#' )
#'
-#' ADRS <- rADRS
+#' ADRS <- teal.transform::rADRS
#' filter_spec_internal(
#' vars_choices = variable_choices(ADRS),
#' vars_selected = "PARAMCD",
diff --git a/R/resolve.R b/R/resolve.R
index 241ee8b0..c7a54f10 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -15,7 +15,7 @@
#' @examples
#' resolve <- getFromNamespace("resolve", "teal.transform")
#' library(shiny)
-#' ADSL <- rADSL
+#' ADSL <- teal.transform::rADSL
#'
#' attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
#' data_list <- list(ADSL = reactive(ADSL))
diff --git a/R/resolve_delayed.R b/R/resolve_delayed.R
index 394f8f72..96b0fb9a 100644
--- a/R/resolve_delayed.R
+++ b/R/resolve_delayed.R
@@ -11,7 +11,7 @@
#'
#' @examples
#' library(shiny)
-#' ADSL <- rADSL
+#' ADSL <- teal.transform::rADSL
#' isolate({
#' data_list <- list(ADSL = reactive(ADSL))
#'
diff --git a/README.md b/README.md
index 18652122..3824c993 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ Below is a small example usage:
```r
library(teal.transform)
-ADSL <- rADSL
+ADSL <- teal.transform::rADSL
adsl_extract <- data_extract_spec(
dataname = "ADSL",
diff --git a/data-raw/data.R b/data-raw/data.R
index 3d0abb23..b9d0a1ec 100644
--- a/data-raw/data.R
+++ b/data-raw/data.R
@@ -14,3 +14,6 @@ usethis::use_data(rADSL)
rADTTE <- synthetic_cdisc_data("latest")$adtte # nolint
usethis::use_data(rADTTE)
+
+# Use :: prefix in examples/tests/vignettes when accessing rAD## data
+# objects in case similar dataset is also exported exist in other packages.
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index 29ee91d0..aa00afbc 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -47,8 +47,8 @@ Duplicated elements from \code{choices} get removed.
library(shiny)
library(teal.data)
-ADSL <- rADSL
-ADTTE <- rADTTE
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
choices1 <- choices_labeled(names(ADSL), col_labels(ADSL, fill = FALSE))
choices2 <- choices_labeled(ADTTE$PARAMCD, ADTTE$PARAM)
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index 3b4462c2..f0b40e75 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -72,7 +72,7 @@ choices_selected(
selected = "C"
)
-ADSL <- rADSL
+ADSL <- teal.transform::rADSL
choices_selected(variable_choices(ADSL), "SEX")
# How to select nothing
diff --git a/man/filter_spec_internal.Rd b/man/filter_spec_internal.Rd
index c2efe253..9be3650d 100644
--- a/man/filter_spec_internal.Rd
+++ b/man/filter_spec_internal.Rd
@@ -136,7 +136,7 @@ filter_spec_internal(
vars_multiple = TRUE
)
-ADRS <- rADRS
+ADRS <- teal.transform::rADRS
filter_spec_internal(
vars_choices = variable_choices(ADRS),
vars_selected = "PARAMCD",
diff --git a/man/resolve.Rd b/man/resolve.Rd
index c1fe5d1a..66068787 100644
--- a/man/resolve.Rd
+++ b/man/resolve.Rd
@@ -71,7 +71,7 @@ All the methods are used internally only.
\examples{
resolve <- getFromNamespace("resolve", "teal.transform")
library(shiny)
-ADSL <- rADSL
+ADSL <- teal.transform::rADSL
attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
data_list <- list(ADSL = reactive(ADSL))
diff --git a/man/resolve_delayed.Rd b/man/resolve_delayed.Rd
index 8d96bcd1..6f9dc400 100644
--- a/man/resolve_delayed.Rd
+++ b/man/resolve_delayed.Rd
@@ -39,7 +39,7 @@ Resolved object.
}}
\examples{
library(shiny)
-ADSL <- rADSL
+ADSL <- teal.transform::rADSL
isolate({
data_list <- list(ADSL = reactive(ADSL))
diff --git a/man/value_choices.Rd b/man/value_choices.Rd
index cacb1cf2..d933ef12 100644
--- a/man/value_choices.Rd
+++ b/man/value_choices.Rd
@@ -37,7 +37,7 @@ named character vector or \code{delayed_data} object.
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\examples{
-ADRS <- rADRS
+ADRS <- teal.transform::rADRS
value_choices(ADRS, "PARAMCD", "PARAM", subset = c("BESRSPI", "INVET"))
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"))
value_choices(ADRS, c("PARAMCD", "ARMCD"), c("PARAM", "ARM"),
diff --git a/man/variable_choices.Rd b/man/variable_choices.Rd
index fa37be19..7cba1aac 100644
--- a/man/variable_choices.Rd
+++ b/man/variable_choices.Rd
@@ -43,7 +43,7 @@ Named \code{character} vector with additional attributes or \code{delayed_data}
\examples{
library(teal.data)
-ADRS <- rADRS
+ADRS <- teal.transform::rADRS
variable_choices(ADRS)
variable_choices(ADRS, subset = c("PARAM", "PARAMCD"))
variable_choices(ADRS, subset = c("", "PARAM", "PARAMCD"))
diff --git a/tests/testthat/test-data_extract_module.R b/tests/testthat/test-data_extract_module.R
index 55bbbffa..2a3bef53 100644
--- a/tests/testthat/test-data_extract_module.R
+++ b/tests/testthat/test-data_extract_module.R
@@ -1,5 +1,5 @@
-ADLB <- rADLB # nolint
-ADTTE <- rADTTE # nolint
+ADLB <- teal.transform::rADLB # nolint
+ADTTE <- teal.transform::rADTTE # nolint
testthat::test_that("Single filter", {
data_extract <- data_extract_spec(
diff --git a/tests/testthat/test-data_extract_multiple_srv.R b/tests/testthat/test-data_extract_multiple_srv.R
index a43cf5ef..6db3efc1 100644
--- a/tests/testthat/test-data_extract_multiple_srv.R
+++ b/tests/testthat/test-data_extract_multiple_srv.R
@@ -1,6 +1,6 @@
-ADSL <- rADSL # nolint
-ADLB <- rADLB # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADLB <- teal.transform::rADLB # nolint
+ADTTE <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
diff --git a/tests/testthat/test-data_extract_spec.R b/tests/testthat/test-data_extract_spec.R
index 6d2e4855..ee6c80d1 100644
--- a/tests/testthat/test-data_extract_spec.R
+++ b/tests/testthat/test-data_extract_spec.R
@@ -199,8 +199,8 @@ testthat::test_that("delayed data_extract_spec works", {
testthat::expect_identical(expected_spec, mix3_res)
})
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
key_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-data_extract_srv.R b/tests/testthat/test-data_extract_srv.R
index f0e946c5..0ef403f5 100644
--- a/tests/testthat/test-data_extract_srv.R
+++ b/tests/testthat/test-data_extract_srv.R
@@ -1,6 +1,6 @@
-ADSL <- rADSL # nolint
-ADLB <- rADLB # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADLB <- teal.transform::rADLB # nolint
+ADTTE <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
diff --git a/tests/testthat/test-delayed_data_extract.R b/tests/testthat/test-delayed_data_extract.R
index 6c016c08..d698ed8b 100644
--- a/tests/testthat/test-delayed_data_extract.R
+++ b/tests/testthat/test-delayed_data_extract.R
@@ -1,9 +1,9 @@
# Contains integration tests between delayed data loading objects and
# the objects responsible for loading, pulling and filtering the data
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
-ADAE <- rADAE # nolint
-ADRS <- rADRS # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
+ADAE <- teal.transform::rADAE # nolint
+ADRS <- teal.transform::rADRS # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADAE = reactive(ADAE), ADRS = reactive(ADRS))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADAE", "ADRS")]
diff --git a/tests/testthat/test-filter_spec.R b/tests/testthat/test-filter_spec.R
index 24ea6003..9e3ce2b4 100644
--- a/tests/testthat/test-filter_spec.R
+++ b/tests/testthat/test-filter_spec.R
@@ -1,5 +1,5 @@
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
primary_keys_list <- lapply(join_keys, function(x) x[[1]])
@@ -218,7 +218,7 @@ testthat::test_that("filter_spec_internal", {
})
testthat::test_that("filter_spec_internal contains dataname", {
- ADSL <- rADSL # nolint
+ ADSL <- teal.transform::rADSL # nolint
x_filter <- filter_spec_internal(
vars_choices = variable_choices(ADSL)
diff --git a/tests/testthat/test-resolve.R b/tests/testthat/test-resolve.R
index 139ce7c3..296c3eb4 100644
--- a/tests/testthat/test-resolve.R
+++ b/tests/testthat/test-resolve.R
@@ -1,5 +1,5 @@
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
arm_ref_comp <- list(
ARMCD = list(
diff --git a/tests/testthat/test-resolve_delayed.R b/tests/testthat/test-resolve_delayed.R
index a5610b09..3e8ff93c 100644
--- a/tests/testthat/test-resolve_delayed.R
+++ b/tests/testthat/test-resolve_delayed.R
@@ -1,5 +1,5 @@
-adsl <- rADSL # nolint
-adtte <- rADTTE # nolint
+adsl <- teal.transform::rADSL # nolint
+adtte <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(adsl), ADTTE = reactive(adtte))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE")]
diff --git a/tests/testthat/test-select_spec.R b/tests/testthat/test-select_spec.R
index 2a69d0d0..1fc4dc5a 100644
--- a/tests/testthat/test-select_spec.R
+++ b/tests/testthat/test-select_spec.R
@@ -1,5 +1,5 @@
-adsl <- rADSL # nolint
-adtte <- rADTTE # nolint
+adsl <- teal.transform::rADSL # nolint
+adtte <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(adsl), ADTTE = reactive(adtte))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-value_choices.R b/tests/testthat/test-value_choices.R
index 2d8b6466..cdf3923c 100644
--- a/tests/testthat/test-value_choices.R
+++ b/tests/testthat/test-value_choices.R
@@ -1,5 +1,5 @@
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-variable_choices.R b/tests/testthat/test-variable_choices.R
index 3b289fcd..3b3821f1 100644
--- a/tests/testthat/test-variable_choices.R
+++ b/tests/testthat/test-variable_choices.R
@@ -1,5 +1,5 @@
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/vignettes/data-extract-merge.Rmd b/vignettes/data-extract-merge.Rmd
index 4b9ecc08..6bdb4d83 100644
--- a/vignettes/data-extract-merge.Rmd
+++ b/vignettes/data-extract-merge.Rmd
@@ -119,8 +119,8 @@ where a list of necessary join keys per `data.frame` object is required:
```{r}
# Define data.frame objects
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
# create a list of data.frame objects
datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
diff --git a/vignettes/data-extract.Rmd b/vignettes/data-extract.Rmd
index 1e1beacd..9bde1e2e 100644
--- a/vignettes/data-extract.Rmd
+++ b/vignettes/data-extract.Rmd
@@ -72,8 +72,8 @@ where a list of necessary join keys per `data.frame` object is required:
```{r}
# Define data.frame objects
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
# create a list of data.frame objects
datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
diff --git a/vignettes/data-merge.Rmd b/vignettes/data-merge.Rmd
index c07a4ffa..0c78302d 100644
--- a/vignettes/data-merge.Rmd
+++ b/vignettes/data-merge.Rmd
@@ -99,8 +99,8 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
}
# Define data.frame objects
-ADSL <- rADSL # nolint
-ADTTE <- rADTTE # nolint
+ADSL <- teal.transform::rADSL # nolint
+ADTTE <- teal.transform::rADTTE # nolint
# create a list of data.frame objects
datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
From 3ec9d7bec33dfbc197bec75118712b4f0040bf7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 13:40:51 +0100
Subject: [PATCH 39/62] remove unused test functions
---
tests/testthat/setup-skip_if_too_deep.R | 60 -------------------------
1 file changed, 60 deletions(-)
delete mode 100644 tests/testthat/setup-skip_if_too_deep.R
diff --git a/tests/testthat/setup-skip_if_too_deep.R b/tests/testthat/setup-skip_if_too_deep.R
deleted file mode 100644
index 954dd280..00000000
--- a/tests/testthat/setup-skip_if_too_deep.R
+++ /dev/null
@@ -1,60 +0,0 @@
-#' Returns testing depth set by an environmental variable.
-#'
-#' @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.
-#'
-#' @return `numeric(1)` the testing depth.
-#'
-testing_depth <- function() { # nolint # nousage
- testing_depth <- getOption("TESTING_DEPTH")
- if (is.null(testing_depth)) testing_depth <- Sys.getenv("TESTING_DEPTH")
-
- testing_depth <- tryCatch(
- as.numeric(testing_depth),
- error = function(error) 3,
- warning = function(warning) 3
- )
-
- if (length(testing_depth) != 1 || is.na(testing_depth)) testing_depth <- 3
-
- testing_depth
-}
-
-#' Skipping tests in the testthat pipeline under specific scope
-#'
-#' @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
-#'
-#' @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
- if (test_to_depth < depth) {
- testthat::skip(paste("testing depth", test_to_depth, "is below current testing specification", depth))
- }
-}
From 61fb0999c2b2cf8631d0d123c0a79510e768007c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 15:21:10 +0100
Subject: [PATCH 40/62] Apply suggestions from @kartikeyakirar
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: kartikeya kirar
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
---
R/Queue.R | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/R/Queue.R b/R/Queue.R
index 7e1f1977..67ccc7d3 100644
--- a/R/Queue.R
+++ b/R/Queue.R
@@ -7,6 +7,7 @@
#'
#' Abstract data type that stores and returns any number of elements.
#'
+#' @details
#' A `Queue` object stores all elements in a single vector,
#' thus all data types can be stored, but silent coercion may occur.
#'
@@ -79,7 +80,7 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Returns the number of elements in `Queue`.
#'
- #' @return Integer of length 1.
+ #' @return `integer(1)`.
#'
size = function() {
length(self$get())
From 6f14fbc2570172d4a23219344ebeccba60327252 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: Tue, 13 Feb 2024 14:23:58 +0000
Subject: [PATCH 41/62] [skip actions] Roxygen Man Pages Auto Update
---
man/Queue.Rd | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/man/Queue.Rd b/man/Queue.Rd
index e86adc2c..f42bf455 100644
--- a/man/Queue.Rd
+++ b/man/Queue.Rd
@@ -7,7 +7,8 @@
\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.
-
+}
+\details{
A \code{Queue} object stores all elements in a single vector,
thus all data types can be stored, but silent coercion may occur.
@@ -118,7 +119,7 @@ Returns the number of elements in \code{Queue}.
}
\subsection{Returns}{
-Integer of length 1.
+\code{integer(1)}.
}
}
\if{html}{\out{ }}
From 0a348aafd50d658bb7b3a9c9e9c1efbd1ace42bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 15:28:12 +0100
Subject: [PATCH 42/62] adds `@doctype` to Queue
---
R/Queue.R | 2 ++
man/Queue.Rd | 1 +
2 files changed, 3 insertions(+)
diff --git a/R/Queue.R b/R/Queue.R
index 67ccc7d3..5bc9b286 100644
--- a/R/Queue.R
+++ b/R/Queue.R
@@ -1,6 +1,7 @@
# Queue ====
#' R6 Class - A First-In-First-Out Abstract Data Type
+#' @docType class
#'
#' @description
#' `r lifecycle::badge("experimental")`
@@ -13,6 +14,7 @@
#'
#' Elements are returned in the same order that they were added.
#'
+#' @name Queue
#' @keywords internal
#'
Queue <- R6::R6Class( # nolint
diff --git a/man/Queue.Rd b/man/Queue.Rd
index f42bf455..e052eaa4 100644
--- a/man/Queue.Rd
+++ b/man/Queue.Rd
@@ -1,5 +1,6 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Queue.R
+\docType{class}
\name{Queue}
\alias{Queue}
\title{R6 Class - A First-In-First-Out Abstract Data Type}
From f20642a394a84de0e6cadd07bf003e34ccdf91af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?=
<211358+averissimo@users.noreply.github.com>
Date: Tue, 13 Feb 2024 15:30:24 +0100
Subject: [PATCH 43/62] Change Self to `self`
---
R/Queue.R | 8 ++++----
man/Queue.Rd | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/R/Queue.R b/R/Queue.R
index 5bc9b286..c5b47292 100644
--- a/R/Queue.R
+++ b/R/Queue.R
@@ -26,7 +26,7 @@ Queue <- R6::R6Class( # nolint
#'
#' @param new_elements vector of elements to add.
#'
- #' @return Self, invisibly.
+ #' @return `self`, invisibly.
#'
push = function(new_elements) {
for (i in seq_along(new_elements)) {
@@ -61,7 +61,7 @@ Queue <- R6::R6Class( # nolint
#'
#' @param elements vector of elements to remove from `Queue`.
#'
- #' @return Self, invisibly.
+ #' @return `self`, invisibly.
#'
remove = function(elements) {
for (el in elements) {
@@ -73,7 +73,7 @@ Queue <- R6::R6Class( # nolint
#' @description
#' Removes all elements from `Queue`.
#'
- #' @return Self, invisibly.
+ #' @return `self`, invisibly.
#'
empty = function() {
private$array <- c()
@@ -92,7 +92,7 @@ Queue <- R6::R6Class( # nolint
#'
#' @param ... Additional arguments to this method, ignored.
#'
- #' @return invisibly self
+ #' @return `self`, invisibly.
print = function(...) {
cat(
sprintf(
diff --git a/man/Queue.Rd b/man/Queue.Rd
index e052eaa4..0a432d97 100644
--- a/man/Queue.Rd
+++ b/man/Queue.Rd
@@ -46,7 +46,7 @@ Adds element(s) to \code{Queue}.
\if{html}{\out{}}
}
\subsection{Returns}{
-Self, invisibly.
+\code{self}, invisibly.
}
}
\if{html}{\out{ }}
@@ -94,7 +94,7 @@ Relies on implicit type conversions of R identify elements to remove.
\if{html}{\out{}}
}
\subsection{Returns}{
-Self, invisibly.
+\code{self}, invisibly.
}
}
\if{html}{\out{ }}
@@ -107,7 +107,7 @@ Removes all elements from \code{Queue}.
}
\subsection{Returns}{
-Self, invisibly.
+\code{self}, invisibly.
}
}
\if{html}{\out{ }}
@@ -140,7 +140,7 @@ Prints this \code{Queue}.
\if{html}{\out{}}
}
\subsection{Returns}{
-invisibly self
+\code{self}, invisibly.
}
}
\if{html}{\out{ }}
From 6accb86356a37f16102bf33d80debc87c75de5b9 Mon Sep 17 00:00:00 2001
From: kartikeya kirar
Date: Tue, 13 Feb 2024 20:37:00 +0530
Subject: [PATCH 44/62] Fixing vignettes (#183)
this is part of
https://github.com/insightsengineering/teal.transform/pull/176
- [x] Sanity check of all vignettes, make sure there is no typo, no
wrong format, etc.
---------
Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com>
Co-authored-by: m7pr
Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com>
---
vignettes/data-extract-merge.Rmd | 65 +++++++++++++----------
vignettes/data-extract.Rmd | 60 ++++++++++++----------
vignettes/data-merge.Rmd | 88 +++++++++++++++++++-------------
vignettes/teal-transform.Rmd | 3 +-
4 files changed, 124 insertions(+), 92 deletions(-)
diff --git a/vignettes/data-extract-merge.Rmd b/vignettes/data-extract-merge.Rmd
index 6bdb4d83..f6143c73 100644
--- a/vignettes/data-extract-merge.Rmd
+++ b/vignettes/data-extract-merge.Rmd
@@ -17,22 +17,24 @@ knitr::opts_chunk$set(
)
```
-`teal.transform` provides `merge_expression_srv` which converts `data_extract_srv` into R expression to transform data
-for analytical purposes. For example, we may wish to select `AGE` from `ADSL` and select `AVAL` from `ADTTE` filtered
-for rows where `PARAMCD` is `OS` and merge the results (using the primary keys) to create an analysis dataset
-`ANL` to be used in the module, as this diagram shows:
+`teal.transform` provides `merge_expression_srv`, which converts `data_extract_srv` into `R` expressions to transform data
+for analytical purposes.
+For example, you may wish to select `AGE` from `ADSL` and select `AVAL` from `ADTTE`, filtered for rows where `PARAMCD` is `OS`, and then merge the results using the primary keys to create an analysis dataset `ANL`.
+This diagram illustrates the concept:
```{r echo=FALSE, out.width='100%'}
knitr::include_graphics("./images/data_extract_spec/basic_concept.png")
```
-In the following code block we create a `data_extract_spec` object per dataset as illustrated above.
+In the following code block, we create a `data_extract_spec` object for each dataset, as illustrated above.
```{r}
library(teal.transform)
+library(teal.widgets)
+library(teal.data)
library(shiny)
-adsl_extract <- teal.transform::data_extract_spec(
+adsl_extract <- data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
@@ -43,7 +45,7 @@ adsl_extract <- teal.transform::data_extract_spec(
)
)
-adtte_extract <- teal.transform::data_extract_spec(
+adtte_extract <- data_extract_spec(
dataname = "ADTTE",
select = select_spec(
choices = c("AVAL", "ASEQ"),
@@ -63,24 +65,24 @@ data_extracts <- list(adsl_extract = adsl_extract, adtte_extract = adtte_extract
#### Example module
-Here, we create the `merge_ui` and the `merge_srv` functions which will be used to create the `ui` and the `srv`
-components of the shiny app, respectively.
+Here, we define the `merge_ui` and `merge_srv` functions, which will be used to create the UI and the server
+components of the `shiny` app, respectively.
```{r}
merge_ui <- function(id, data_extracts) {
ns <- NS(id)
- teal.widgets::standard_layout(
- output = teal.widgets::white_small_well(
+ standard_layout(
+ output = white_small_well(
verbatimTextOutput(ns("expr")),
dataTableOutput(ns("data"))
),
encoding = div(
- teal.transform::data_extract_ui(
+ data_extract_ui(
ns("adsl_extract"), # must correspond with data_extracts list names
label = "ADSL extract",
data_extracts[[1]]
),
- teal.transform::data_extract_ui(
+ data_extract_ui(
ns("adtte_extract"), # must correspond with data_extracts list names
label = "ADTTE extract",
data_extracts[[2]]
@@ -91,16 +93,19 @@ merge_ui <- function(id, data_extracts) {
merge_srv <- function(id, datasets, data_extracts, join_keys) {
moduleServer(id, function(input, output, session) {
- selector_list <- teal.transform::data_extract_multiple_srv(data_extracts, datasets, join_keys)
- merged_data <- teal.transform::merge_expression_srv(
+ selector_list <- data_extract_multiple_srv(data_extracts, datasets, join_keys)
+ merged_data <- merge_expression_srv(
selector_list = selector_list,
datasets = datasets,
join_keys = join_keys,
merge_function = "dplyr::left_join"
)
- ANL <- reactive({ # nolint
- eval(envir = list2env(datasets), expr = as.expression(merged_data()$expr))
+
+ ANL <- reactive({
+ data_list <- lapply(datasets, function(ds) ds())
+ eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
+
output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
output$data <- renderDataTable(ANL())
})
@@ -108,13 +113,14 @@ merge_srv <- function(id, datasets, data_extracts, join_keys) {
```
Output from `data_extract_srv` (`reactive`) should be passed to `merge_expression_srv` together with `datasets`
-(list of `data.frame` objects) and `join_keys` list. `merge_expression_srv` returns a reactive list containing merge expression and information needed to perform the transformation - see more in `merge_expression_srv` documentation.
+(list of reactive `data.frame` objects) and `join_keys` object.
+`merge_expression_srv` returns a reactive list containing merge expression and information needed to perform the transformation - see more in `merge_expression_srv` documentation.
#### Example data
-`data_extract_srv` module depends on either a list of reactive or non-reactive `data.frame` objects. Here, we show the
-usage of a list of `data.frame` objects as input to `datasets`
-where a list of necessary join keys per `data.frame` object is required:
+The `data_extract_srv` module depends on a list of reactive or non-reactive `data.frame` objects.
+Here, we demonstrate the usage of a list of reactive `data.frame` objects as input to `datasets`,
+along with a list of necessary join keys per `data.frame` object:
```{r}
@@ -122,20 +128,23 @@ where a list of necessary join keys per `data.frame` object is required:
ADSL <- teal.transform::rADSL # nolint
ADTTE <- teal.transform::rADTTE # nolint
-# create a list of data.frame objects
-datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
+# create a list of reactive data.frame objects
+datasets <- list(
+ ADSL = reactive(ADSL),
+ ADTTE = reactive(ADTTE)
+)
# create join_keys
-join_keys <- teal.data::join_keys(
- teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADSL", "ADTTE", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADTTE", "ADTTE", c("STUDYID", "USUBJID", "PARAMCD"))
+join_keys <- join_keys(
+ join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+ join_key("ADSL", "ADTTE", c("STUDYID", "USUBJID")),
+ join_key("ADTTE", "ADTTE", c("STUDYID", "USUBJID", "PARAMCD"))
)
```
#### Shiny app
-Finally, we pass `merge_ui` and `merge_srv` to the `ui` and `server` functions of the `shinyApp`
+Finally, we include `merge_ui` and `merge_srv` to the UI and server component of the `shinyApp`, respectively,
using the `data_extract`s defined in the first code block and the `datasets` object:
```{r eval=FALSE}
diff --git a/vignettes/data-extract.Rmd b/vignettes/data-extract.Rmd
index 9bde1e2e..b109d865 100644
--- a/vignettes/data-extract.Rmd
+++ b/vignettes/data-extract.Rmd
@@ -17,35 +17,37 @@ knitr::opts_chunk$set(
)
```
-There are times when an app developer wants to showcase more than just one fixed slice of their dataset in their
-custom module. Relinquishing control of the application to a user demands the developer gives their users a degree
-of freedom. In case of analyzing data, `teal` allows app developers to open up their applications to users, letting them
-decide exactly what app data to analyze in the module.
-
-A lot of `teal` modules use `data_extract_spec` objects and modules to tackle user input. You can find many examples in
-e.g. `teal.modules.general` and `teal.modules.clinical`.
+There are times when an app developer wants to offer users more flexibility in analyzing data within their custom module.
+In such cases, relinquishing control of the application to users requires developers to provide a degree of freedom.
+With `teal`, app developers can open up their applications to users, allowing them to decide exactly which app data to
+analyze within the module.
+Many `teal` modules leverage `data_extract_spec` objects and modules to handle user input.
+Examples can be found in `teal.modules.general` and `teal.modules.clinical`.
### `data_extract_spec`
-`data_extract_spec`'s task is two-fold: create a UI component in a `shiny` application and pass the user input from the
- UI to the module itself. Having that formulated, let's have a look at how it supports both its responsibilities.
+The role of `data_extract_spec` is twofold: to create a UI component in a `shiny` application and to pass user input
+from the UI to the module itself.
+Let's delve into how it fulfills both of these responsibilities.
#### Example module
-In order to showcase different initialization options of `data_extract_spec`, first we define a `shiny` module which
-uses `data_extract_ui` and `data_extract_srv` designed to handle `data_extract_spec` objects. The module creates a UI
-component for a single `data_extract_spec` and prints a list of values returned from `data_extract_srv` module. Please see
-package documentation for more information about `data_extract_ui` and `data_extract_srv`.
+To demonstrate different initialization options of `data_extract_spec`, let's first define a `shiny` module that
+utilizes `data_extract_ui` and `data_extract_srv` to handle `data_extract_spec` objects.
+This module creates a UI component for a single `data_extract_spec` and prints a list of values returned from the `data_extract_srv` module.
+For more information about `data_extract_ui` and `data_extract_srv`, please refer to the package documentation.
```{r}
library(teal.transform)
+library(teal.widgets)
+library(teal.data)
library(shiny)
extract_ui <- function(id, data_extract) {
ns <- NS(id)
- teal.widgets::standard_layout(
- output = teal.widgets::white_small_well(verbatimTextOutput(ns("output"))),
+ standard_layout(
+ output = white_small_well(verbatimTextOutput(ns("output"))),
encoding = data_extract_ui(ns("data_extract"), label = "variable", data_extract)
)
}
@@ -66,29 +68,31 @@ extract_srv <- function(id, datasets, data_extract, join_keys) {
#### Example data
-`data_extract_srv` module depends on either a list of reactive or non-reactive `data.frame` objects. Here, we show the
-usage of a list of `data.frame` objects as input to `datasets`
-where a list of necessary join keys per `data.frame` object is required:
+The `data_extract_srv` module depends on a list of reactive or non-reactive `data.frame` objects.
+Here, we demonstrate the usage of a list of reactive `data.frame` objects as input to `datasets`,
+along with a list of necessary join keys per `data.frame` object:
```{r}
# Define data.frame objects
ADSL <- teal.transform::rADSL # nolint
ADTTE <- teal.transform::rADTTE # nolint
-# create a list of data.frame objects
-datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
-
+# create a list of reactive data.frame objects
+datasets <- list(
+ ADSL = reactive(ADSL),
+ ADTTE = reactive(ADTTE)
+)
# create join_keys
-join_keys <- teal.data::join_keys(
- teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADSL", "ADTTE", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADTTE", "ADTTE", c("STUDYID", "USUBJID", "PARAMCD"))
+join_keys <- join_keys(
+ join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+ join_key("ADSL", "ADTTE", c("STUDYID", "USUBJID")),
+ join_key("ADTTE", "ADTTE", c("STUDYID", "USUBJID", "PARAMCD"))
)
```
Consider the following example, where we create two UI elements, one to filter on a specific level from `SEX` variable,
-and a second one to select a variable from `c("BMRKR1", "AGE")`. `data_extract_spec` object is handed over to the shiny
-app and gives instructions to generate UI components.
+and a second one to select a variable from `c("BMRKR1", "AGE")`.
+`data_extract_spec` object is handed over to the `shiny` app and gives instructions to generate UI components.
```{r}
simple_des <- data_extract_spec(
@@ -100,7 +104,7 @@ simple_des <- data_extract_spec(
#### Shiny app
-Finally, we pass `extract_ui` to the `ui` of the `shinyApp` and we use `extract_srv` in the server function of the `shinyApp`:
+Finally, we include `extract_ui` in the UI of the `shinyApp`, and utilize `extract_srv` in the server function of the `shinyApp`:
```{r eval=FALSE}
shinyApp(
diff --git a/vignettes/data-merge.Rmd b/vignettes/data-merge.Rmd
index 0c78302d..8df6b372 100644
--- a/vignettes/data-merge.Rmd
+++ b/vignettes/data-merge.Rmd
@@ -17,26 +17,33 @@ knitr::opts_chunk$set(
)
```
-Combining datasets is a crucial step when using modules with more than one dataset. In the context of `teal`, we use
-the term "merge" to combine datasets where two functions are offered `merge_expression_module` and `merge_expression_srv`. Depending on the specific scenario, one or the other shall be used.
+Combining datasets is an essential step when working with modules that involve multiple datasets.
+Within the context of `teal`, we use the term "merge" to refer to the process of combining datasets.
+To support this, two functions are provided: `merge_expression_module` and `merge_expression_srv`, each tailored for different use cases.
-When no processing of the `data_extract` list is required, the `merge_expression_module` function is used to read the data and the `data_extract_spec`'s list and apply the merging. It is a wrapper that combines `data_extract_multiple_srv()` and `merge_expression_srv()` see below for more details.
-With additional processing of the `data_extract` list input, `merge_expression_srv()` can be combined with `data_extract_multiple_srv()` or `data_extract_srv()` to customize the `selector_list` input.
+Use `merge_expression_module` when there is no need to process the `data_extract` list.
+This function reads the data and the list of `data_extract_spec` objects and applies the merging.
+Essentially, it serves as a wrapper that combines `data_extract_multiple_srv()` and `merge_expression_srv()`.
+Further details are provided below.
+In scenarios where additional processing of the `data_extract` list is necessary,
+`merge_expression_srv()` can be used along with `data_extract_multiple_srv()` or `data_extract_srv()` to customize the `selector_list` input.
-In the coming sections, we will show examples of both scenarios.
+The following sections provide examples for both scenarios.
### `merge_expression_module`
-With `merge_expression_module` solely, all you would need is a list of `data_extract_spec` objects for the `data_extract` argument, a list of reactive or non-reactive `data.frame` objects and a list of join keys
-corresponding to every `data.frame` object.
+Using `merge_expression_module` alone requires a list of `data_extract_spec` objects for the `data_extract` argument,
+a list of reactive or non-reactive `data.frame` objects, and a list of join keys corresponding to each `data.frame` object.
#### App code
```{r}
library(teal.transform)
+library(teal.widgets)
+library(teal.data)
library(shiny)
-adsl_extract <- teal.transform::data_extract_spec(
+adsl_extract <- data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
@@ -47,7 +54,7 @@ adsl_extract <- teal.transform::data_extract_spec(
)
)
-adtte_extract <- teal.transform::data_extract_spec(
+adtte_extract <- data_extract_spec(
dataname = "ADTTE",
select = select_spec(
choices = c("AVAL", "ASEQ"),
@@ -61,18 +68,18 @@ data_extracts <- list(adsl_extract = adsl_extract, adtte_extract = adtte_extract
merge_ui <- function(id, data_extracts) {
ns <- NS(id)
- teal.widgets::standard_layout(
- output = teal.widgets::white_small_well(
+ standard_layout(
+ output = white_small_well(
verbatimTextOutput(ns("expr")),
dataTableOutput(ns("data"))
),
encoding = div(
- teal.transform::data_extract_ui(
+ data_extract_ui(
ns("adsl_extract"), # must correspond with data_extracts list names
label = "ADSL extract",
data_extracts[[1]]
),
- teal.transform::data_extract_ui(
+ data_extract_ui(
ns("adtte_extract"), # must correspond with data_extracts list names
label = "ADTTE extract",
data_extracts[[2]]
@@ -83,7 +90,7 @@ merge_ui <- function(id, data_extracts) {
merge_module <- function(id, datasets, data_extracts, join_keys) {
moduleServer(id, function(input, output, session) {
- merged_data <- teal.transform::merge_expression_module(
+ merged_data <- merge_expression_module(
data_extract = data_extracts,
datasets = datasets,
join_keys = join_keys,
@@ -91,7 +98,8 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
)
ANL <- reactive({ # nolint
- eval(envir = list2env(datasets), expr = as.expression(merged_data()$expr))
+ data_list <- lapply(datasets, function(ds) ds())
+ eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
output$data <- renderDataTable(ANL())
@@ -102,14 +110,17 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
ADSL <- teal.transform::rADSL # nolint
ADTTE <- teal.transform::rADTTE # nolint
-# create a list of data.frame objects
-datasets <- list(ADSL = ADSL, ADTTE = ADTTE)
+# create a list of reactive data.frame objects
+datasets <- list(
+ ADSL = reactive(ADSL),
+ ADTTE = reactive(ADTTE)
+)
# create join_keys
-join_keys <- teal.data::join_keys(
- teal.data::join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADSL", "ADTTE", c("STUDYID", "USUBJID")),
- teal.data::join_key("ADTTE", "ADTTE", c("STUDYID", "USUBJID", "PARAMCD"))
+join_keys <- join_keys(
+ join_key("ADSL", "ADSL", c("STUDYID", "USUBJID")),
+ join_key("ADSL", "ADTTE", c("STUDYID", "USUBJID")),
+ join_key("ADTTE", "ADTTE", c("STUDYID", "USUBJID", "PARAMCD"))
)
```
@@ -126,12 +137,15 @@ shinyApp(
### `data_extract_multiple_srv` + `merge_expression_srv`
-In the scenario above, if the user deselects the `ADTTE` variable, the merging between `ADTTE` and `ADSL` would still take place even though `ADTTE` is not used or needed here. Here, the developer might update the `selector_list` input in a reactive manner so that it gets updated based on conditions set by the developer. Below, we reuse the input from above and we update the `app` server so that the `adtte_extract` is removed from the `selector_list` input when no `ADTTE` variable is selected and the `reactive_selector_list` is passed to `merge_expression_srv`:
+In the scenario above, if the user deselects the `ADTTE` variable, the merging between `ADTTE` and `ADSL` would still occur, even though `ADTTE` is not used or needed.
+Here, the developer might update the `selector_list` input reactively so that it gets updated based on conditions set by the developer.
+Below, we reuse the input from above and update the app server so that the `adtte_extract` is removed from the selector_list input when no `ADTTE` variable is selected.
+The `reactive_selector_list` is then passed to `merge_expression_srv`:
```{r}
merge_module <- function(id, datasets, data_extracts, join_keys) {
moduleServer(id, function(input, output, session) {
- selector_list <- teal.transform::data_extract_multiple_srv(data_extracts, datasets, join_keys)
+ selector_list <- data_extract_multiple_srv(data_extracts, datasets, join_keys)
reactive_selector_list <- reactive({
if (is.null(selector_list()$adtte_extract) || length(selector_list()$adtte_extract()$select) == 0) {
selector_list()[names(selector_list()) != "adtte_extract"]
@@ -140,7 +154,7 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
}
})
- merged_data <- teal.transform::merge_expression_srv(
+ merged_data <- merge_expression_srv(
selector_list = reactive_selector_list,
datasets = datasets,
join_keys = join_keys,
@@ -148,7 +162,8 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
)
ANL <- reactive({ # nolint
- eval(envir = list2env(datasets), expr = as.expression(merged_data()$expr))
+ data_list <- lapply(datasets, function(ds) ds())
+ eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
output$data <- renderDataTable(ANL())
@@ -169,22 +184,25 @@ shinyApp(
`merge_expression_module` is replaced here with three parts:
-1) `selector_list`: output of `data_extract_multiple_srv` which loops over the list of data_extract given and runs `data_extract_srv` for each one returning a list of reactive objects.
-2) `reactive_selector_list`: intermediate reactive list updating `selector_list` content
-3) `merged_data`: output of `merge_expression_srv` using `reactive_selector_list` as input
+1) `selector_list`: the output of `data_extract_multiple_srv`, which loops over the list of `data_extract` given and runs `data_extract_srv` for each one, returning a list of reactive objects.
+2) `reactive_selector_list`: an intermediate reactive list updating `selector_list` content.
+3) `merged_data`: the output of `merge_expression_srv` using `reactive_selector_list` as input.
### Output from merging
Both merge functions, `merge_expression_srv` and `merge_expression_module`, return a reactive object which contains a list of the following elements:
-- `expr`: code needed to replicate merged dataset
-- `columns_source`: list of columns selected per selector
-- `keys`: the keys of the merged dataset
-- `filter_info`: filters that are applied on the data
+- `expr`: code needed to replicate merged dataset.
+- `columns_source`: list of columns selected per selector.
+- `keys`: the keys of the merged dataset.
+- `filter_info`: filters that are applied on the data.
-These elements can be further used inside the server to retrieve and use information about the selections, data, filters, ...
+These elements can be further used inside the server to retrieve and use information about the selections, data, filters, etc.
## Merging of non `CDISC` datasets
-General datasets do not share the same relationships as `CDISC` datasets thus these relationships must be specified by the `join_keys` functions. For more information, please refer to the `Join Keys` [vignette](https://insightsengineering.github.io/teal.data/latest-tag/articles/join-keys).
-The data merge module respects the relationships given by the user and in the case of multiple datasets to merge, the order is specified by the order of elements in the `data_extract` argument of the `merge_expression_module` function. Merging groups of datasets with complex relationships can quickly become challenging to specify so please take extra care when setting this up.
+General datasets do not have the same relationships as `CDISC` datasets, so these relationships must be specified using the `join_keys` functions.
+For more information, please refer to the `Join Keys` [vignette](https://insightsengineering.github.io/teal.data/latest-tag/articles/join-keys).
+The data merge module respects the relationships given by the user.
+In the case of multiple datasets to merge, the order is specified by the order of elements in the `data_extract` argument of the `merge_expression_module` function.
+Merging groups of datasets with complex relationships can quickly become challenging to specify so please take extra care when setting this up.
diff --git a/vignettes/teal-transform.Rmd b/vignettes/teal-transform.Rmd
index 99f87b89..b94a41ab 100644
--- a/vignettes/teal-transform.Rmd
+++ b/vignettes/teal-transform.Rmd
@@ -19,7 +19,8 @@ knitr::opts_chunk$set(
## Introduction
-The `teal.transform` package is an integral component of the `teal` framework. It serves a dual purpose:
+The `teal.transform` package is an integral component of the `teal` framework.
+It serves a dual purpose:
- For `teal` module developers, it offers a standardized user interface for column selection from datasets and facilitates dataset merging, resulting in the creation of analysis datasets for use within their modules.
- For `teal` application developers, it provides a means to specify which dataset columns can be accessed through the user interface, streamlining column selection within their applications.
From 87e68a9a2745d432a1034917dd2720be182bd77d Mon Sep 17 00:00:00 2001
From: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Date: Tue, 13 Feb 2024 15:09:26 +0000
Subject: [PATCH 45/62] [skip actions] Restyle files
---
vignettes/data-extract-merge.Rmd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vignettes/data-extract-merge.Rmd b/vignettes/data-extract-merge.Rmd
index f6143c73..311a4f7d 100644
--- a/vignettes/data-extract-merge.Rmd
+++ b/vignettes/data-extract-merge.Rmd
@@ -100,12 +100,12 @@ merge_srv <- function(id, datasets, data_extracts, join_keys) {
join_keys = join_keys,
merge_function = "dplyr::left_join"
)
-
+
ANL <- reactive({
data_list <- lapply(datasets, function(ds) ds())
eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
-
+
output$expr <- renderText(paste(merged_data()$expr, collapse = "\n"))
output$data <- renderDataTable(ANL())
})
From 7a18606910a321506f229211083952f23e7c68e4 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, 14 Feb 2024 01:15:10 +0100
Subject: [PATCH 46/62] docs: fix title of long function
---
R/all_choices.R | 8 ++++++--
man/all_choices.Rd | 6 ++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/R/all_choices.R b/R/all_choices.R
index 29a79918..be01f441 100644
--- a/R/all_choices.R
+++ b/R/all_choices.R
@@ -1,8 +1,11 @@
-#' An S3 structure representing the selection of all possible choices in a
-#' `filter_spec`, `select_spec` or `choices_selected` object
+#' Bare constructor for `all_choices` object
#'
+#' @description
#' `r lifecycle::badge("experimental")`
#'
+#' An S3 structure representing the selection of all possible choices in a
+#' `filter_spec`, `select_spec` or `choices_selected` object
+#'
#' @return `all_choices` object.
#'
#' @examples
@@ -22,6 +25,7 @@
#' choices_selected(choices = letters, selected = letters)
#' choices_selected(choices = letters, selected = all_choices())
#' @export
+#'
all_choices <- function() {
structure(list(), class = "all_choices")
}
diff --git a/man/all_choices.Rd b/man/all_choices.Rd
index eda7f650..6110ced5 100644
--- a/man/all_choices.Rd
+++ b/man/all_choices.Rd
@@ -2,8 +2,7 @@
% 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{Bare constructor for \code{all_choices} object}
\usage{
all_choices()
}
@@ -12,6 +11,9 @@ all_choices()
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
+
+An S3 structure representing the selection of all possible choices in a
+\code{filter_spec}, \code{select_spec} or \code{choices_selected} object
}
\examples{
# Both structures are semantically identical
From b1c0bcd1db3fc30359d5cf9e795bb5713508f587 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, 14 Feb 2024 01:24:17 +0100
Subject: [PATCH 47/62] Apply suggestions from code review
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: kartikeya kirar
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
---
R/call_utils.R | 6 +++---
R/check_selector.R | 2 +-
R/choices_labeled.R | 2 +-
R/choices_selected.R | 1 -
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/R/call_utils.R b/R/call_utils.R
index 08a97db5..9eb3354f 100644
--- a/R/call_utils.R
+++ b/R/call_utils.R
@@ -2,7 +2,7 @@
#'
#' Checks `varname` type and parse if it's a `character`
#'
-#' @param varname (`name`, `call` or `character(1)`)
+#' @param varname (`name` or `call` or `character(1)`)
#' name of the variable
#'
#' @returns the parsed `varname`.
@@ -35,7 +35,7 @@ call_check_parse_varname <- function(varname) {
#'
#' Compose choices condition call from inputs.
#'
-#' @param varname (`name`, `call` or `character(1)`)
+#' @param varname (`name` or `call` or `character(1)`)
#' name of the variable.
#' @param choices (`vector`)
#' `varname` values to match using the `==` (single value) or `%in%` (vector)
@@ -245,7 +245,7 @@ call_condition_range_date <- function(varname, range) {
#' Get call to subset and select array
#'
#' @param dataname (`character(1)` or `name`).
-#' @param row (optional `name`, `call`, `logical`, `integer` or `character`)
+#' @param row (optional `name` or `call` or `logical` or `integer` or `character`)
#' name of the `row` or condition.
#' @param column (optional `name`, `call`, `logical`, `integer` or `character`)
#' name of the `column` or condition.
diff --git a/R/check_selector.R b/R/check_selector.R
index 3747bb9f..95175e4b 100644
--- a/R/check_selector.R
+++ b/R/check_selector.R
@@ -14,7 +14,7 @@ check_selector_dataname <- function(dataname) {
#'
#' @param filters (`list`) selector element generated by `data_extract_srv`.
#'
-#' @return Raises and error when check fails, otherwise it returns `NULL`, invisibly.
+#' @return Raises an error when the check fails, otherwise it returns `NULL`, invisibly.
#'
#' @noRd
check_selector_filters <- function(filters) {
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index dbf41d29..4c815562 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -3,7 +3,7 @@
#' @description
#' `r lifecycle::badge("stable")`
#'
-#' This is often useful for [choices_selected] as it marks up the drop-down boxes
+#' This is often useful for [choices_selected()] as it marks up the drop-down boxes
#' for [shiny::selectInput()].
#'
#' @param choices A character / factor / numeric / logical vector.
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 551ace4e..79f5e7cd 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -185,7 +185,6 @@ choices_selected <- function(choices,
#' Check if an object is a choices_selected class
#'
-#' `r lifecycle::badge("stable")`
#'
#' @rdname choices_selected
#'
From 31908a334a7e61d2bf9ef7b0c1519f01f87b53f5 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, 14 Feb 2024 00:27:03 +0000
Subject: [PATCH 48/62] [skip actions] Roxygen Man Pages Auto Update
---
man/call_check_parse_varname.Rd | 2 +-
man/call_condition_choice.Rd | 2 +-
man/call_extract_array.Rd | 2 +-
man/choices_labeled.Rd | 2 +-
man/choices_selected.Rd | 2 --
5 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/man/call_check_parse_varname.Rd b/man/call_check_parse_varname.Rd
index 04ec6172..002d5015 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)})
+\item{varname}{(\code{name} or \code{call} or \code{character(1)})
name of the variable}
}
\value{
diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd
index 97af3df4..d117e0c2 100644
--- a/man/call_condition_choice.Rd
+++ b/man/call_condition_choice.Rd
@@ -7,7 +7,7 @@
call_condition_choice(varname, choices)
}
\arguments{
-\item{varname}{(\code{name}, \code{call} or \code{character(1)})
+\item{varname}{(\code{name} or \code{call} or \code{character(1)})
name of the variable.}
\item{choices}{(\code{vector})
diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd
index a1be6f44..4bb76980 100644
--- a/man/call_extract_array.Rd
+++ b/man/call_extract_array.Rd
@@ -9,7 +9,7 @@ call_extract_array(dataname = ".", row = NULL, column = NULL, aisle = NULL)
\arguments{
\item{dataname}{(\code{character(1)} or \code{name}).}
-\item{row}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character})
+\item{row}{(optional \code{name} or \code{call} or \code{logical} or \code{integer} or \code{character})
name of the \code{row} or condition.}
\item{column}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character})
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index aa00afbc..4dc9df64 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -34,7 +34,7 @@ Named \code{character} vector.
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
-This is often useful for \link{choices_selected} as it marks up the drop-down boxes
+This is often useful for \code{\link[=choices_selected]{choices_selected()}} as it marks up the drop-down boxes
for \code{\link[shiny:selectInput]{shiny::selectInput()}}.
\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/choices_selected.Rd b/man/choices_selected.Rd
index f0b40e75..db858901 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -47,8 +47,6 @@ additional settings such as to order the choices with the selected elements appe
or whether to block the user from making selections.
Can be used in \code{ui} input elements such as \code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}}.
-
-\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\details{
Please note that the order of selected will always follow the order of choices. The \code{keep_order}
From d54ed7f0d0b348dec54da4b3f64c0ba08a996dcc 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, 14 Feb 2024 01:33:47 +0100
Subject: [PATCH 49/62] change from comma to 'or' in param allowed types
---
R/call_utils.R | 8 ++++----
R/choices_labeled.R | 15 +++++++++------
R/data_extract_datanames.R | 4 ++--
R/data_extract_module.R | 6 +++---
R/data_extract_spec.R | 2 +-
R/filter_spec.R | 2 +-
R/format_data_extract.R | 2 +-
R/resolve.R | 2 +-
R/select_spec.R | 2 +-
R/utils.R | 5 +++--
man/call_extract_array.Rd | 4 ++--
man/call_extract_matrix.Rd | 4 ++--
man/choices_labeled.Rd | 9 +++++----
man/data_extract_multiple_srv.Rd | 6 +++---
man/data_extract_spec.Rd | 2 +-
man/extract_choices_labels.Rd | 3 ++-
man/filter_spec.Rd | 2 +-
man/format_data_extract.Rd | 2 +-
man/get_extract_datanames.Rd | 4 ++--
man/resolve_delayed_expr.Rd | 2 +-
man/select_spec.Rd | 2 +-
21 files changed, 47 insertions(+), 41 deletions(-)
diff --git a/R/call_utils.R b/R/call_utils.R
index 9eb3354f..0ac6ae11 100644
--- a/R/call_utils.R
+++ b/R/call_utils.R
@@ -247,9 +247,9 @@ call_condition_range_date <- function(varname, range) {
#' @param dataname (`character(1)` or `name`).
#' @param row (optional `name` or `call` or `logical` or `integer` or `character`)
#' name of the `row` or condition.
-#' @param column (optional `name`, `call`, `logical`, `integer` or `character`)
+#' @param column (optional `name` or `call` or `logical`, `integer` or `character`)
#' name of the `column` or condition.
-#' @param aisle (optional `name`, `call`, `logical`, `integer` or `character`)
+#' @param aisle (optional `name` or `call` or `logical` or `integer` or `character`)
#' name of the `row` or condition.
#'
#' @return [Extract()] `call` for 3-dimensional array in `x[i, j, k]` notation.
@@ -310,9 +310,9 @@ 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 (optional `name`, `call`, `logical`, `integer` or `character`)
+#' @param row (optional `name` or `call` or `logical` or `integer` or `character`)
#' name of the `row` or condition.
-#' @param column (optional `name`, `call`, `logical`, `integer` or `character`)
+#' @param column (optional `name` or `call` or `logical` or `integer` or `character`)
#' name of the `column` or condition.
#'
#' @return [Extract()] `call` for matrix in `x[i, j]` notation.
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 4c815562..2bdea6fd 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -6,16 +6,19 @@
#' This is often useful for [choices_selected()] as it marks up the drop-down boxes
#' for [shiny::selectInput()].
#'
-#' @param choices A character / factor / numeric / logical vector.
-#' @param labels character vector containing labels to be applied to `choices`.
+#' @details
+#' If either `choices` or `labels` are factors, they are coerced to character.
+#' Duplicated elements from `choices` get removed.
+#'
+#' @param choices (`character` or `factor` or `numeric` or `logical`) vector.
+#' @param labels (`character`) vector containing labels to be applied to `choices`.
#' If `NA` then "Label Missing" will be used.
-#' @param subset a vector that is a subset of `choices`.
+#' @param subset (`character` or `factor` or `numeric` or `logical`) vector that
+#' is a subset of `choices`.
#' This is useful if only a few variables need to be named.
#' If this argument is used, the returned vector will match its order.
-#' @param types Character vector containing the types of the columns to be used for applying the appropriate
+#' @param types (`character`) vector containing the types of the columns to be used for applying the appropriate
#' icons to the [choices_selected] drop down box (e.g. "numeric").
-#' @details If either `choices` or `labels` are factors, they are coerced to character.
-#' Duplicated elements from `choices` get removed.
#'
#' @return Named `character` vector.
#'
diff --git a/R/data_extract_datanames.R b/R/data_extract_datanames.R
index 64437081..10acb0cf 100644
--- a/R/data_extract_datanames.R
+++ b/R/data_extract_datanames.R
@@ -28,10 +28,10 @@ datanames_input <- function(data_extracts) {
#' 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 `data_extract_spec` object or a list (of lists)
+#' @param data_extracts (`data_extract_spec(1)`) object or a list (of lists)
#' of `data_extract_spec`.
#'
-#' @return A character vector with the unique `dataname` set.
+#' @return `character` vector with the unique `dataname` set.
#'
#' @export
#'
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index 66674188..a9ba9e44 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -719,7 +719,7 @@ data_extract_multiple_srv.FilteredData <- function(data_extract, datasets, ...)
#' @rdname data_extract_multiple_srv
#'
#' @param join_keys (`join_keys` or `NULL`) of join keys per dataset in `datasets`.
-#' @param select_validation_rule (`NULL`, `function` or `named list` of `function`)
+#' @param select_validation_rule (`NULL` or `function` or `named list` of `function`)
#' Should there be any `shinyvalidate` input validation of the select parts of the `data_extract_ui`.
#' If all `data_extract` require the same validation function then this can be used directly
#' (i.e. `select_validation_rule = shinyvalidate::sv_required()`).
@@ -731,9 +731,9 @@ data_extract_multiple_srv.FilteredData <- function(data_extract, datasets, ...)
#' If `NULL` then no validation will be added.
#'
#' See example for more details.
-#' @param filter_validation_rule (`NULL`, `function` or `named list` of `function`) Same as
+#' @param filter_validation_rule (`NULL` or `function` or `named list` of `function`) Same as
#' `select_validation_rule` but for the filter (values) part of the `data_extract_ui`.
-#' @param dataset_validation_rule (`NULL`, `function` or `named list` of `function`) Same as
+#' @param dataset_validation_rule (`NULL` or `function` or `named list` of `function`) Same as
#' `select_validation_rule` but for the choose dataset part of the `data_extract_ui`
#'
#' @export
diff --git a/R/data_extract_spec.R b/R/data_extract_spec.R
index 47b09bed..1420aee0 100644
--- a/R/data_extract_spec.R
+++ b/R/data_extract_spec.R
@@ -16,7 +16,7 @@
#'
#' @param dataname (`character`)
#' The name of the dataset to be extracted.
-#' @param select (`NULL`, `select_spec`-S3 class or `delayed_select_spec`)
+#' @param select (`NULL` or `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)
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 034dd9ae..f4ee14b0 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -14,7 +14,7 @@
#' the drop-down menu the app user will see.
#'
#' @inheritParams select_spec
-#' @param vars (`character`) or (`delayed_data`) object.
+#' @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()],
diff --git a/R/format_data_extract.R b/R/format_data_extract.R
index 8749df63..1de543bb 100644
--- a/R/format_data_extract.R
+++ b/R/format_data_extract.R
@@ -7,7 +7,7 @@
#'
#' @param data_extract `list` the list output of `data_extract_srv`.
-#' @return A string (`character(1)`) representation of the `data_extract` object.
+#' @return `character(1)` representation of the `data_extract` object.
#'
#' @examples
#' library(shiny)
diff --git a/R/resolve.R b/R/resolve.R
index c7a54f10..354c6433 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -198,7 +198,7 @@ resolve.default <- function(x, datasets, keys) {
#' @param ds (`data.frame`) Dataset.
#' @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`.
+#' @return `character` vector - result of calling function `x` on dataset `ds`.
#'
#' @keywords internal
#'
diff --git a/R/select_spec.R b/R/select_spec.R
index 4d901704..a3fb202a 100644
--- a/R/select_spec.R
+++ b/R/select_spec.R
@@ -13,7 +13,7 @@
#' 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 `character`, `NULL`, `all_choices` or `delayed_data`).
+#' @param selected (optional `character` or `NULL` or `all_choices` or `delayed_data`).
#' 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 `choices` or `NULL` for delayed data loading.
diff --git a/R/utils.R b/R/utils.R
index 7db0c35c..0c90e30a 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -22,7 +22,8 @@ split_by_sep <- function(x, sep) {
#' Extract labels from choices basing on attributes and names
#'
#' @param choices (`list` or `vector`) select choices.
-#' @param values optional, choices subset for which labels should be extracted, `NULL` for all choices.
+#' @param values (optional `list` or `vector`) with subset of `choices` for which
+#' labels should be extracted, `NULL` for all choices.
#'
#' @return `character` vector with labels.
#'
@@ -167,7 +168,7 @@ compose_and_enable_validators <- function(iv, selector_list, validator_names = N
#' Ensures datasets is a list of reactive expression
#'
-#' @param datasets (`reactive` `teal_data` object or `list`) of `data.frame`
+#' @param datasets (`reactive` or `teal_data` object or `list`) of `data.frame`
#' wrapped or not in a reactive expression.
#'
#' @return List of reactive expression that contains all the individual `datasets`.
diff --git a/man/call_extract_array.Rd b/man/call_extract_array.Rd
index 4bb76980..66a466f2 100644
--- a/man/call_extract_array.Rd
+++ b/man/call_extract_array.Rd
@@ -12,10 +12,10 @@ call_extract_array(dataname = ".", row = NULL, column = NULL, aisle = NULL)
\item{row}{(optional \code{name} or \code{call} or \code{logical} or \code{integer} or \code{character})
name of the \code{row} or condition.}
-\item{column}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character})
+\item{column}{(optional \code{name} or \code{call} or \code{logical}, \code{integer} or \code{character})
name of the \code{column} or condition.}
-\item{aisle}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character})
+\item{aisle}{(optional \code{name} or \code{call} or \code{logical} or \code{integer} or \code{character})
name of the \code{row} or condition.}
}
\value{
diff --git a/man/call_extract_matrix.Rd b/man/call_extract_matrix.Rd
index be3bd026..e9c9137f 100644
--- a/man/call_extract_matrix.Rd
+++ b/man/call_extract_matrix.Rd
@@ -9,10 +9,10 @@ call_extract_matrix(dataname = ".", row = NULL, column = NULL)
\arguments{
\item{dataname}{(\code{character(1)} or \code{name}).}
-\item{row}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character})
+\item{row}{(optional \code{name} or \code{call} or \code{logical} or \code{integer} or \code{character})
name of the \code{row} or condition.}
-\item{column}{(optional \code{name}, \code{call}, \code{logical}, \code{integer} or \code{character})
+\item{column}{(optional \code{name} or \code{call} or \code{logical} or \code{integer} or \code{character})
name of the \code{column} or condition.}
}
\value{
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index 4dc9df64..b99b27a5 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -10,16 +10,17 @@ choices_labeled(choices, labels, subset = NULL, types = NULL)
\method{print}{choices_labeled}(x, ...)
}
\arguments{
-\item{choices}{A character / factor / numeric / logical vector.}
+\item{choices}{(\code{character} or \code{factor} or \code{numeric} or \code{logical}) vector.}
-\item{labels}{character vector containing labels to be applied to \code{choices}.
+\item{labels}{(\code{character}) vector containing labels to be applied to \code{choices}.
If \code{NA} then "Label Missing" will be used.}
-\item{subset}{a vector that is a subset of \code{choices}.
+\item{subset}{(\code{character} or \code{factor} or \code{numeric} or \code{logical}) vector that
+is a subset of \code{choices}.
This is useful if only a few variables need to be named.
If this argument is used, the returned vector will match its order.}
-\item{types}{Character vector containing the types of the columns to be used for applying the appropriate
+\item{types}{(\code{character}) vector containing the types of the columns to be used for applying the appropriate
icons to the \link{choices_selected} drop down box (e.g. "numeric").}
\item{x}{an object used to select a method.}
diff --git a/man/data_extract_multiple_srv.Rd b/man/data_extract_multiple_srv.Rd
index 01f7f68e..7551751f 100644
--- a/man/data_extract_multiple_srv.Rd
+++ b/man/data_extract_multiple_srv.Rd
@@ -45,7 +45,7 @@ It shall contain the keys per dataset in \code{datasets}.}
\item{join_keys}{(\code{join_keys} or \code{NULL}) of join keys per dataset in \code{datasets}.}
-\item{select_validation_rule}{(\code{NULL}, \code{function} or \verb{named list} of \code{function})
+\item{select_validation_rule}{(\code{NULL} or \code{function} or \verb{named list} of \code{function})
Should there be any \code{shinyvalidate} input validation of the select parts of the \code{data_extract_ui}.
If all \code{data_extract} require the same validation function then this can be used directly
(i.e. \code{select_validation_rule = shinyvalidate::sv_required()}).
@@ -58,10 +58,10 @@ If \code{NULL} then no validation will be added.
See example for more details.}
-\item{filter_validation_rule}{(\code{NULL}, \code{function} or \verb{named list} of \code{function}) Same as
+\item{filter_validation_rule}{(\code{NULL} or \code{function} or \verb{named list} of \code{function}) Same as
\code{select_validation_rule} but for the filter (values) part of the \code{data_extract_ui}.}
-\item{dataset_validation_rule}{(\code{NULL}, \code{function} or \verb{named list} of \code{function}) Same as
+\item{dataset_validation_rule}{(\code{NULL} or \code{function} or \verb{named list} of \code{function}) Same as
\code{select_validation_rule} but for the choose dataset part of the \code{data_extract_ui}}
}
\value{
diff --git a/man/data_extract_spec.Rd b/man/data_extract_spec.Rd
index 0d9d2727..30756a37 100644
--- a/man/data_extract_spec.Rd
+++ b/man/data_extract_spec.Rd
@@ -10,7 +10,7 @@ data_extract_spec(dataname, select = NULL, filter = NULL, reshape = FALSE)
\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})
+\item{select}{(\code{NULL} or \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.}
diff --git a/man/extract_choices_labels.Rd b/man/extract_choices_labels.Rd
index 280053de..972cf19f 100644
--- a/man/extract_choices_labels.Rd
+++ b/man/extract_choices_labels.Rd
@@ -9,7 +9,8 @@ extract_choices_labels(choices, values = NULL)
\arguments{
\item{choices}{(\code{list} or \code{vector}) select choices.}
-\item{values}{optional, choices subset for which labels should be extracted, \code{NULL} for all choices.}
+\item{values}{(optional \code{list} or \code{vector}) with subset of \code{choices} for which
+labels should be extracted, \code{NULL} for all choices.}
}
\value{
\code{character} vector with labels.
diff --git a/man/filter_spec.Rd b/man/filter_spec.Rd
index 286fac75..68842e89 100644
--- a/man/filter_spec.Rd
+++ b/man/filter_spec.Rd
@@ -15,7 +15,7 @@ filter_spec(
)
}
\arguments{
-\item{vars}{(\code{character}) or (\code{delayed_data}) object.
+\item{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 \code{\link[=variable_choices]{variable_choices()}}, \code{\link[=value_choices]{value_choices()}},
diff --git a/man/format_data_extract.Rd b/man/format_data_extract.Rd
index ceeb67e5..0aeac371 100644
--- a/man/format_data_extract.Rd
+++ b/man/format_data_extract.Rd
@@ -10,7 +10,7 @@ format_data_extract(data_extract)
\item{data_extract}{\code{list} the list output of \code{data_extract_srv}.}
}
\value{
-A string (\code{character(1)}) representation of the \code{data_extract} object.
+\code{character(1)} representation of the \code{data_extract} object.
}
\description{
Returns a human-readable string representation of an extracted \code{data_extract_spec} object.
diff --git a/man/get_extract_datanames.Rd b/man/get_extract_datanames.Rd
index e1c30538..86822194 100644
--- a/man/get_extract_datanames.Rd
+++ b/man/get_extract_datanames.Rd
@@ -7,11 +7,11 @@
get_extract_datanames(data_extracts)
}
\arguments{
-\item{data_extracts}{A single \code{data_extract_spec} object or a list (of lists)
+\item{data_extracts}{(\code{data_extract_spec(1)}) object or a list (of lists)
of \code{data_extract_spec}.}
}
\value{
-A character vector with the unique \code{dataname} set.
+\code{character} vector with the unique \code{dataname} set.
}
\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/resolve_delayed_expr.Rd b/man/resolve_delayed_expr.Rd
index d77701db..ff384c69 100644
--- a/man/resolve_delayed_expr.Rd
+++ b/man/resolve_delayed_expr.Rd
@@ -15,7 +15,7 @@ It must take only a single argument "data" and return character vector with colu
\item{is_value_choices}{(\code{logical}) Determines which check of the returned value will be applied.}
}
\value{
-Character vector - result of calling function \code{x} on dataset \code{ds}.
+\code{character} vector - result of calling function \code{x} on dataset \code{ds}.
}
\description{
Resolve expression after delayed data are loaded
diff --git a/man/select_spec.Rd b/man/select_spec.Rd
index 29e521cb..888e063f 100644
--- a/man/select_spec.Rd
+++ b/man/select_spec.Rd
@@ -43,7 +43,7 @@ These have to be columns in the dataset defined in the \code{\link[=data_extract
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}, \code{NULL}, \code{all_choices} or \code{delayed_data}).
+\item{selected}{(optional \code{character} or \code{NULL} or \code{all_choices} or \code{delayed_data}).
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.}
From 5887a0b12931ab10366f90bb5313eff0a65fbeba 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, 14 Feb 2024 01:46:56 +0100
Subject: [PATCH 50/62] adds tags and titles to functions
---
R/choices_selected.R | 8 ++++++++
R/get_dplyr_call.R | 4 ++++
R/resolve.R | 8 ++++++++
3 files changed, 20 insertions(+)
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 79f5e7cd..accfd181 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -263,6 +263,10 @@ vector_reorder <- function(vec, idx) {
vec
}
+#' Remove item(s) and their attributes from vector
+#' @keywords internal
+#' @noRd
+#'
vector_pop <- function(vec, idx) {
checkmate::assert_atomic(vec)
checkmate::assert_integer(idx, lower = 1, any.missing = FALSE)
@@ -285,6 +289,10 @@ vector_pop <- function(vec, idx) {
vec
}
+#' Remove duplicate elements or elements with the same name from a vector
+#' @keywords internal
+#' @noRd
+#'
vector_remove_dups <- function(vec) {
checkmate::assert_atomic(vec)
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index 60797d7a..749bc300 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -401,6 +401,10 @@ get_filter_call <- function(filter, dataname = NULL, datasets = NULL) {
}
}
+#' Remove duplicated columns
+#' @keywords internal
+#' @noRd
+#'
rename_duplicated_cols <- function(x, internal_id, selected_cols, all_cols) {
all_cols_dups <- all_cols[duplicated(all_cols)]
vapply(
diff --git a/R/resolve.R b/R/resolve.R
index 354c6433..e8066326 100644
--- a/R/resolve.R
+++ b/R/resolve.R
@@ -307,6 +307,10 @@ print.delayed_data_extract_spec <- function(x, indent = 0L, ...) {
invisible(NULL)
}
+#' Create indented message
+#' @keywords internal
+#' @noRd
+#'
indent_msg <- function(n, msg) {
checkmate::assert_integer(n, len = 1, lower = 0, any.missing = FALSE)
checkmate::assert_character(msg, min.len = 1, any.missing = FALSE)
@@ -315,6 +319,10 @@ indent_msg <- function(n, msg) {
paste0(indent, msg)
}
+#' Common function to print a `delayed_data` object
+#' @keywords internal
+#' @noRd
+#'
print_delayed_list <- function(obj, n = 0L) {
checkmate::assert_integer(n, len = 1, lower = 0, any.missing = FALSE)
stopifnot(is.list(obj))
From cfa88ffd59773462c0802a6841437b49067db4d1 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, 14 Feb 2024 01:48:59 +0100
Subject: [PATCH 51/62] shows title of function (described in common man page)
---
R/choices_selected.R | 5 +----
man/choices_selected.Rd | 5 +++++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/R/choices_selected.R b/R/choices_selected.R
index accfd181..abefdbcf 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -183,10 +183,7 @@ choices_selected <- function(choices,
)
}
-#' Check if an object is a choices_selected class
-#'
-#'
-#' @rdname choices_selected
+#' @describeIn choices_selected Check if an object is a choices_selected class
#'
#' @param x (`choices_selected`) object to check.
#'
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index db858901..2c2f5193 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -57,6 +57,11 @@ argument is set to false which will run the following code inside:
In case you want to keep your specific order of choices, set \code{keep_order} to \code{TRUE}.
}
+\section{Functions}{
+\itemize{
+\item \code{is.choices_selected()}: Check if an object is a choices_selected class
+
+}}
\examples{
library(shiny)
library(teal.widgets)
From 3dac5471f17a6579e4470e02a5e5180900f28f7f 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, 14 Feb 2024 09:15:54 +0100
Subject: [PATCH 52/62] Update R/utils.R
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
---
R/utils.R | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/R/utils.R b/R/utils.R
index 0c90e30a..3bb1f6e2 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -171,7 +171,7 @@ compose_and_enable_validators <- function(iv, selector_list, validator_names = N
#' @param datasets (`reactive` or `teal_data` object or `list`) of `data.frame`
#' wrapped or not in a reactive expression.
#'
-#' @return List of reactive expression that contains all the individual `datasets`.
+#' @return List of `reactive` expressions that contains all the individual `datasets`.
#'
#' @noRd
convert_teal_data <- function(datasets) {
From 0e52645847e22f3972f71afda0c28d91e078d71e 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, 14 Feb 2024 01:50:57 +0100
Subject: [PATCH 53/62] correct return
---
R/choices_selected.R | 6 +++---
man/choices_selected.Rd | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/R/choices_selected.R b/R/choices_selected.R
index abefdbcf..421e7f0b 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -34,8 +34,8 @@ no_select_keyword <- "-- no selection --"
#' be on top of the drop-down field.
#' @param fixed (optional `logical`) Whether to block user to select choices.
#'
-#' @return Object of class `choices_selected` and of type list which contains the specified
-#' `choices`, `selected`, `keep_order` and `fixed`.
+#' @return `choices_selected` returns object of class `choices_selected` and of
+#' type list which contains the specified `choices`, `selected`, `keep_order` and `fixed`.
#'
#' @examples
#' library(shiny)
@@ -187,7 +187,7 @@ choices_selected <- function(choices,
#'
#' @param x (`choices_selected`) object to check.
#'
-#' @return `TRUE` if `x` inherits from a `choices_selected` object, `FALSE` otherwise.
+#' @return `is.choices_selected` returns `TRUE` if `x` inherits from a `choices_selected` object, `FALSE` otherwise.
#'
#' @export
#'
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index 2c2f5193..2977516c 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -34,10 +34,10 @@ be on top of the drop-down field.}
\item{x}{(\code{choices_selected}) object to check.}
}
\value{
-Object of class \code{choices_selected} and of type list which contains the specified
-\code{choices}, \code{selected}, \code{keep_order} and \code{fixed}.
+\code{choices_selected} returns object of class \code{choices_selected} and of
+type list which contains the specified \code{choices}, \code{selected}, \code{keep_order} and \code{fixed}.
-\code{TRUE} if \code{x} inherits from a \code{choices_selected} object, \code{FALSE} otherwise.
+\code{is.choices_selected} returns \code{TRUE} if \code{x} inherits from a \code{choices_selected} object, \code{FALSE} otherwise.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
From ce1ab3d07687260c0b497f9283bb5eefba30eb12 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, 14 Feb 2024 09:26:35 +0100
Subject: [PATCH 54/62] Backtick teal on site descriptions
---
_pkgdown.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 5d33ca80..ca2f4399 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -41,7 +41,7 @@ reference:
- resolve
- resolve_delayed
- title: Data extract modules
- desc: teal modules to generate transform expressions
+ desc: `teal` modules to generate transform expressions
contents:
- data_extract_multiple_srv
- data_extract_ui
From 81e337503ea871e3e0fef8261b2ecf82a1221f06 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, 14 Feb 2024 09:59:29 +0100
Subject: [PATCH 55/62] docs: corrects problem with backticks starting on desc
---
_pkgdown.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/_pkgdown.yml b/_pkgdown.yml
index ca2f4399..eec4c416 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -41,7 +41,8 @@ reference:
- resolve
- resolve_delayed
- title: Data extract modules
- desc: `teal` modules to generate transform expressions
+ desc: >-
+ `teal` modules to generate transform expressions
contents:
- data_extract_multiple_srv
- data_extract_ui
From 4a1d42c04aa70cd2711a997d6c15754cdc11f887 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, 14 Feb 2024 10:08:06 +0100
Subject: [PATCH 56/62] spelling: revert to 'reactive manner' instead of
reactively
---
vignettes/data-extract-merge.Rmd | 2 +-
vignettes/data-merge.Rmd | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vignettes/data-extract-merge.Rmd b/vignettes/data-extract-merge.Rmd
index 311a4f7d..dcd466ec 100644
--- a/vignettes/data-extract-merge.Rmd
+++ b/vignettes/data-extract-merge.Rmd
@@ -101,7 +101,7 @@ merge_srv <- function(id, datasets, data_extracts, join_keys) {
merge_function = "dplyr::left_join"
)
- ANL <- reactive({
+ ANL <- reactive({ # nolint
data_list <- lapply(datasets, function(ds) ds())
eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
diff --git a/vignettes/data-merge.Rmd b/vignettes/data-merge.Rmd
index 8df6b372..b19dbb4d 100644
--- a/vignettes/data-merge.Rmd
+++ b/vignettes/data-merge.Rmd
@@ -138,7 +138,7 @@ shinyApp(
### `data_extract_multiple_srv` + `merge_expression_srv`
In the scenario above, if the user deselects the `ADTTE` variable, the merging between `ADTTE` and `ADSL` would still occur, even though `ADTTE` is not used or needed.
-Here, the developer might update the `selector_list` input reactively so that it gets updated based on conditions set by the developer.
+Here, the developer might update the `selector_list` input in a reactive manner so that it gets updated based on conditions set by the developer.
Below, we reuse the input from above and update the app server so that the `adtte_extract` is removed from the selector_list input when no `ADTTE` variable is selected.
The `reactive_selector_list` is then passed to `merge_expression_srv`:
From f2d64a40fe16b2d88afc1114fbcede588744fb99 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, 14 Feb 2024 10:26:31 +0100
Subject: [PATCH 57/62] Convert "# nolint" to specific rule exception (#178)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
# Pull Request
Part of #172
#### Changes description
- Add new regex style to object_name_linter to account for ADaM
variables.
- See `.lintr` file
- `regexes = c(ANL = "^ANL_?[0-9]*$", ADaM =
"^r?ADSL|ADTTE|ADLB|ADRS|ADAE$"))`
- Allows for variables named `ANL` with optional underscore and numbers
after.
- note: can't use groups (`(rule_within_parenthesis)`) due to
[r-lib/lintr/issues/2188](https://github.com/r-lib/lintr/issues/2188)
not being released yet.
- Convert other `# nolint` to specific `# nolint: .` for
specificity
---------
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
Co-authored-by: m7pr
---
.lintr | 3 +-
R/Queue.R | 2 +-
R/choices_labeled.R | 5 +-
R/choices_selected.R | 4 +-
R/data_extract_module.R | 22 +-
R/filter_spec.R | 2 +-
R/get_dplyr_call.R | 2 +-
R/get_merge_call.R | 2 +-
R/select_spec.R | 4 +-
R/zzz.R | 2 +-
data-raw/data.R | 10 +-
tests/testthat/test-data_extract_module.R | 11 +-
.../testthat/test-data_extract_multiple_srv.R | 6 +-
tests/testthat/test-data_extract_spec.R | 67 +++--
tests/testthat/test-data_extract_srv.R | 6 +-
tests/testthat/test-delayed_data_extract.R | 8 +-
tests/testthat/test-dplyr_call_examples.R | 259 +++++++++---------
tests/testthat/test-filter_spec.R | 10 +-
tests/testthat/test-merge_utils.R | 16 +-
tests/testthat/test-resolve.R | 10 +-
tests/testthat/test-resolve_delayed.R | 10 +-
tests/testthat/test-select_spec.R | 8 +-
tests/testthat/test-value_choices.R | 4 +-
tests/testthat/test-variable_choices.R | 4 +-
vignettes/data-extract-merge.Rmd | 7 +-
vignettes/data-extract.Rmd | 4 +-
vignettes/data-merge.Rmd | 8 +-
27 files changed, 254 insertions(+), 242 deletions(-)
diff --git a/.lintr b/.lintr
index 34473d27..fff47977 100644
--- a/.lintr
+++ b/.lintr
@@ -1,5 +1,6 @@
linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
- object_usage_linter = NULL
+ object_usage_linter = NULL,
+ object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$"))
)
diff --git a/R/Queue.R b/R/Queue.R
index c5b47292..17f56fce 100644
--- a/R/Queue.R
+++ b/R/Queue.R
@@ -17,7 +17,7 @@
#' @name Queue
#' @keywords internal
#'
-Queue <- R6::R6Class( # nolint
+Queue <- R6::R6Class( # nolint: object_name_linter.
classname = "Queue",
# public methods ----
public = list(
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 2bdea6fd..3c51424c 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -191,8 +191,7 @@ variable_choices.character <- function(data, subset = NULL, fill = FALSE, key =
#' @rdname variable_choices
#' @export
-variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key = NULL) { # nolint
-
+variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key = NULL) {
checkmate::assert(
checkmate::check_character(subset, null.ok = TRUE),
checkmate::check_function(subset, null.ok = TRUE)
@@ -316,7 +315,7 @@ value_choices.character <- function(data,
#' @rdname value_choices
#' @export
-value_choices.data.frame <- function(data, # nolint
+value_choices.data.frame <- function(data,
var_choices,
var_label = NULL,
subset = NULL,
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 421e7f0b..3b6290bc 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -191,7 +191,7 @@ choices_selected <- function(choices,
#'
#' @export
#'
-is.choices_selected <- function(x) { # nolint
+is.choices_selected <- function(x) { # nolint: object_name_linter.
inherits(x, "choices_selected")
}
@@ -231,7 +231,7 @@ add_no_selected_choices <- function(x, multiple = FALSE) {
#'
#' @export
#'
-no_selected_as_NULL <- function(x) { # nolint
+no_selected_as_NULL <- function(x) { # nolint: object_name_linter.
if (is.null(x) || identical(x, no_select_keyword) || x == "") {
NULL
} else {
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index a9ba9e44..aee0a655 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -457,10 +457,16 @@ data_extract_srv.FilteredData <- function(id, datasets, data_extract_spec, ...)
#' `select_validation_rule` but for the choose dataset part of the `data_extract_ui`
#' @export
#'
-data_extract_srv.list <- function(id, datasets, data_extract_spec, join_keys = NULL,
+data_extract_srv.list <- function(id,
+ datasets,
+ data_extract_spec,
+ join_keys = NULL,
select_validation_rule = NULL,
filter_validation_rule = NULL,
- dataset_validation_rule = if (is.null(select_validation_rule) && is.null(filter_validation_rule)) { # nolint
+ dataset_validation_rule = if (
+ is.null(select_validation_rule) &&
+ is.null(filter_validation_rule)
+ ) {
NULL
} else {
shinyvalidate::sv_required("Please select a dataset")
@@ -738,14 +744,20 @@ data_extract_multiple_srv.FilteredData <- function(data_extract, datasets, ...)
#'
#' @export
#'
-data_extract_multiple_srv.list <- function(data_extract, datasets, join_keys = NULL,
+data_extract_multiple_srv.list <- function(data_extract,
+ datasets,
+ join_keys = NULL,
select_validation_rule = NULL,
filter_validation_rule = NULL,
- dataset_validation_rule = if (is.null(select_validation_rule) && is.null(filter_validation_rule)) { # nolint
+ dataset_validation_rule = if (
+ is.null(select_validation_rule) &&
+ is.null(filter_validation_rule)
+ ) {
NULL
} else {
shinyvalidate::sv_required("Please select a dataset")
- }, ...) {
+ },
+ ...) {
checkmate::assert_list(datasets, types = c("reactive", "data.frame"), names = "named")
checkmate::assert_class(join_keys, "join_keys", null.ok = TRUE)
checkmate::assert(
diff --git a/R/filter_spec.R b/R/filter_spec.R
index f4ee14b0..3239a9fc 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -285,7 +285,7 @@ filter_spec_internal <- function(vars_choices,
#' @rdname filter_spec_internal
#' @export
-filter_spec_internal.delayed_data <- function(vars_choices, # nolint
+filter_spec_internal.delayed_data <- function(vars_choices,
vars_selected = NULL,
vars_label = NULL,
vars_fixed = FALSE,
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index 749bc300..59e70a43 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -82,7 +82,7 @@ get_dplyr_call_data <- function(selector_list, join_keys = teal.data::join_keys(
all_cols
)
- pivot_longer_unite_cols_renamed <- if (rlang::is_empty(unite_vals)) { # nolint
+ pivot_longer_unite_cols_renamed <- if (rlang::is_empty(unite_vals)) { # nolint: object_length_linter.
pivot_longer_cols_renamed
} else {
Reduce(
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index c3edeb6e..6faa7c55 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -57,7 +57,7 @@ get_merge_call <- function(selector_list,
anl_merge_call_i <- call(
"<-",
as.name(anl_name),
- { # nolint
+ {
merge_key_i <- get_merge_key_i(idx = idx, dplyr_call_data = dplyr_call_data)
is_merge_key_pair <- vapply(merge_key_i, function(x) length(names(x)) == 1, logical(1))
diff --git a/R/select_spec.R b/R/select_spec.R
index a3fb202a..02f05af5 100644
--- a/R/select_spec.R
+++ b/R/select_spec.R
@@ -109,7 +109,7 @@ select_spec <- function(choices,
#' @rdname select_spec
#' @export
#'
-select_spec.delayed_data <- function(choices, # nolint
+select_spec.delayed_data <- function(choices, # nolint: object_name_linter.
selected = NULL,
multiple = length(selected) > 1,
fixed = FALSE,
@@ -144,7 +144,7 @@ select_spec.delayed_data <- function(choices, # nolint
#' @rdname select_spec
#' @export
#'
-select_spec.default <- function(choices, # nolint
+select_spec.default <- function(choices, # nolint: object_name_linter.
selected = choices[1],
multiple = length(selected) > 1,
fixed = FALSE,
diff --git a/R/zzz.R b/R/zzz.R
index dc8a2c06..a6b7242e 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -1,4 +1,4 @@
-.onLoad <- function(libname, pkgname) { # nolint
+.onLoad <- function(libname, pkgname) {
teal.logger::register_logger("teal.transform")
invisible()
}
diff --git a/data-raw/data.R b/data-raw/data.R
index b9d0a1ec..184626f5 100644
--- a/data-raw/data.R
+++ b/data-raw/data.R
@@ -1,18 +1,18 @@
## code to prepare `data` for testing examples
library(scda)
-rADAE <- synthetic_cdisc_data("latest")$adae # nolint
+rADAE <- synthetic_cdisc_data("latest")$adae
usethis::use_data(rADAE)
-rADLB <- synthetic_cdisc_data("latest")$adlb # nolint
+rADLB <- synthetic_cdisc_data("latest")$adlb
usethis::use_data(rADLB)
-rADRS <- synthetic_cdisc_data("latest")$adrs # nolint
+rADRS <- synthetic_cdisc_data("latest")$adrs
usethis::use_data(rADRS)
-rADSL <- synthetic_cdisc_data("latest")$adsl # nolint
+rADSL <- synthetic_cdisc_data("latest")$adsl
usethis::use_data(rADSL)
-rADTTE <- synthetic_cdisc_data("latest")$adtte # nolint
+rADTTE <- synthetic_cdisc_data("latest")$adtte
usethis::use_data(rADTTE)
# Use :: prefix in examples/tests/vignettes when accessing rAD## data
diff --git a/tests/testthat/test-data_extract_module.R b/tests/testthat/test-data_extract_module.R
index 2a3bef53..a9deb39a 100644
--- a/tests/testthat/test-data_extract_module.R
+++ b/tests/testthat/test-data_extract_module.R
@@ -1,5 +1,5 @@
-ADLB <- teal.transform::rADLB # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADLB <- teal.transform::rADLB
+ADTTE <- teal.transform::rADTTE
testthat::test_that("Single filter", {
data_extract <- data_extract_spec(
@@ -23,9 +23,12 @@ testthat::test_that("Single filter", {
testthat::expect_silent(input <- data_extract_single_ui(id = NULL, data_extract))
testthat::expect_silent(filter <- input$children[[1]])
- testthat::expect_equal(filter$children[[1]]$children[[1]]$attribs, list(class = "shinyjs-hide")) # nolint
+ testthat::expect_equal(filter$children[[1]]$children[[1]]$attribs, list(class = "shinyjs-hide"))
- testthat::expect_equal(filter$children[[1]]$children[[2]]$children[[4]]$children[[1]]$children[[1]]$children[[2]]$attribs$multiple, "multiple") # nolint
+ testthat::expect_equal(
+ filter$children[[1]]$children[[2]]$children[[4]]$children[[1]]$children[[1]]$children[[2]]$attribs$multiple,
+ "multiple"
+ )
# more tests - check levels of filtered variables
# check also colummns selected
diff --git a/tests/testthat/test-data_extract_multiple_srv.R b/tests/testthat/test-data_extract_multiple_srv.R
index 6db3efc1..a4d7fe73 100644
--- a/tests/testthat/test-data_extract_multiple_srv.R
+++ b/tests/testthat/test-data_extract_multiple_srv.R
@@ -1,6 +1,6 @@
-ADSL <- teal.transform::rADSL # nolint
-ADLB <- teal.transform::rADLB # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADLB <- teal.transform::rADLB
+ADTTE <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
diff --git a/tests/testthat/test-data_extract_spec.R b/tests/testthat/test-data_extract_spec.R
index ee6c80d1..8ec25a57 100644
--- a/tests/testthat/test-data_extract_spec.R
+++ b/tests/testthat/test-data_extract_spec.R
@@ -1,3 +1,32 @@
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
+data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
+key_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
+
+vc_hard <- variable_choices("ADSL", subset = c("STUDYID", "USUBJID"))
+vc_hard_exp <- structure(
+ list(data = "ADSL", subset = c("STUDYID", "USUBJID"), key = NULL),
+ class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
+)
+
+vc_hard_short <- variable_choices("ADSL", subset = "STUDYID")
+vc_hard_short_exp <- structure(
+ list(data = "ADSL", subset = "STUDYID", key = NULL),
+ class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
+)
+
+vc_fun <- variable_choices("ADSL", subset = function(data) colnames(data)[1:2])
+vc_fun_exp <- structure(
+ list(data = "ADSL", subset = function(data) colnames(data)[1:2], key = NULL),
+ class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
+)
+
+vc_fun_short <- variable_choices("ADSL", subset = function(data) colnames(data)[1])
+vc_fun_short_exp <- structure(
+ list(data = "ADSL", subset = function(data) colnames(data)[1], key = NULL),
+ class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
+)
+
testthat::test_that("data_extract_spec throws when select is not select_spec or NULL", {
testthat::expect_error(data_extract_spec("toyDataset", select = c("A", "B")))
})
@@ -100,14 +129,14 @@ testthat::test_that("data_extract_spec works with valid input", {
testthat::test_that("delayed data_extract_spec works", {
set.seed(1)
- ADSL <- data.frame( # nolint
+ ADSL <- data.frame(
USUBJID = letters[1:10],
SEX = sample(c("F", "M", "U"), 10, replace = TRUE),
BMRKR1 = rnorm(10),
BMRKR2 = sample(c("L", "M", "H"), 10, replace = TRUE),
stringsAsFactors = FALSE
)
- attr(ADSL, "keys") <- c("STUDYID", "USUBJID") # nolint
+ attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
filter_normal <- filter_spec(
vars = variable_choices(ADSL, "SEX"),
@@ -199,35 +228,6 @@ testthat::test_that("delayed data_extract_spec works", {
testthat::expect_identical(expected_spec, mix3_res)
})
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
-data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
-key_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
-
-vc_hard <- variable_choices("ADSL", subset = c("STUDYID", "USUBJID"))
-vc_hard_exp <- structure(
- list(data = "ADSL", subset = c("STUDYID", "USUBJID"), key = NULL),
- class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
-)
-
-vc_hard_short <- variable_choices("ADSL", subset = "STUDYID")
-vc_hard_short_exp <- structure(
- list(data = "ADSL", subset = "STUDYID", key = NULL),
- class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
-)
-
-vc_fun <- variable_choices("ADSL", subset = function(data) colnames(data)[1:2])
-vc_fun_exp <- structure(
- list(data = "ADSL", subset = function(data) colnames(data)[1:2], key = NULL),
- class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
-)
-
-vc_fun_short <- variable_choices("ADSL", subset = function(data) colnames(data)[1])
-vc_fun_short_exp <- structure(
- list(data = "ADSL", subset = function(data) colnames(data)[1], key = NULL),
- class = c("delayed_variable_choices", "delayed_data", "choices_labeled")
-)
-
testthat::test_that("delayed version of data_extract_spec", {
# hard-coded subset
obj <- data_extract_spec(
@@ -328,14 +328,14 @@ testthat::test_that("data_extract_spec returns select_spec with multiple set to
# with resolve_delayed
testthat::test_that("delayed data_extract_spec works - resolve_delayed", {
set.seed(1)
- ADSL <- data.frame( # nolint
+ ADSL <- data.frame(
USUBJID = letters[1:10],
SEX = sample(c("F", "M", "U"), 10, replace = TRUE),
BMRKR1 = rnorm(10),
BMRKR2 = sample(c("L", "M", "H"), 10, replace = TRUE),
stringsAsFactors = FALSE
)
- attr(ADSL, "keys") <- c("STUDYID", "USUBJID") # nolint
+ attr(ADSL, "keys") <- c("STUDYID", "USUBJID")
filter_normal <- filter_spec(
vars = variable_choices(ADSL, "SEX"),
@@ -427,7 +427,6 @@ testthat::test_that("delayed data_extract_spec works - resolve_delayed", {
testthat::expect_identical(expected_spec, mix3_res)
})
-
testthat::test_that("delayed version of data_extract_spec - resolve_delayed", {
data_list <- list(ADSL = reactive(ADSL))
keys_list <- list(ADSL = c("STUDYID", "USUBJID"))
diff --git a/tests/testthat/test-data_extract_srv.R b/tests/testthat/test-data_extract_srv.R
index 0ef403f5..0fabba21 100644
--- a/tests/testthat/test-data_extract_srv.R
+++ b/tests/testthat/test-data_extract_srv.R
@@ -1,6 +1,6 @@
-ADSL <- teal.transform::rADSL # nolint
-ADLB <- teal.transform::rADLB # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADLB <- teal.transform::rADLB
+ADTTE <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
diff --git a/tests/testthat/test-delayed_data_extract.R b/tests/testthat/test-delayed_data_extract.R
index d698ed8b..d328dbe8 100644
--- a/tests/testthat/test-delayed_data_extract.R
+++ b/tests/testthat/test-delayed_data_extract.R
@@ -1,9 +1,9 @@
# Contains integration tests between delayed data loading objects and
# the objects responsible for loading, pulling and filtering the data
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
-ADAE <- teal.transform::rADAE # nolint
-ADRS <- teal.transform::rADRS # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
+ADAE <- teal.transform::rADAE
+ADRS <- teal.transform::rADRS
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADAE = reactive(ADAE), ADRS = reactive(ADRS))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADAE", "ADRS")]
diff --git a/tests/testthat/test-dplyr_call_examples.R b/tests/testthat/test-dplyr_call_examples.R
index 09d2233d..6239ef5d 100644
--- a/tests/testthat/test-dplyr_call_examples.R
+++ b/tests/testthat/test-dplyr_call_examples.R
@@ -1,4 +1,3 @@
-# nolint start
# Different join keys ------
testthat::test_that("Different join types", {
merged_selectors1 <- merge_selectors(
@@ -31,24 +30,24 @@ testthat::test_that("Different join types", {
testthat::expect_identical(
get_merge_call(merged_selectors1[[1]], jk1, merge_function = "dplyr::left_join"),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::left_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::left_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
testthat::expect_identical(
get_merge_call(merged_selectors1[[1]], jk1, merge_function = "dplyr::inner_join"),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::inner_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::inner_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
testthat::expect_identical(
get_merge_call(merged_selectors1[[1]], jk1, merge_function = "merge.data.frame"),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- merge.data.frame(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- merge.data.frame(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -93,7 +92,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors1, jk1),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __2. one selector - multiple select -----
@@ -123,7 +122,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors2, jk2),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __3. two selectors -------
@@ -161,7 +160,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors3, jk3),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __4. multiple selectors -------
@@ -215,7 +214,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors4, jk4),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __5. multiple selectors with empty selections ------
@@ -269,7 +268,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors5, jk5),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __6. one selector - single select - filter -----
@@ -300,7 +299,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors6, jk6),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __7. one selector - single select - filter on key -----
@@ -331,7 +330,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors7, jk7),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __8. one selector - drop keys -----
@@ -362,7 +361,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors8, jk8),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __9. one selector - key dropped but selected -----
@@ -393,7 +392,7 @@ testthat::test_that("Single wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors9, jk9),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
})
@@ -446,8 +445,8 @@ testthat::test_that("Multiple wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors1[[1]], jk1),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -497,8 +496,8 @@ testthat::test_that("Multiple wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors2, jk2),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -573,9 +572,9 @@ testthat::test_that("Multiple wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors3, jk3),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -649,9 +648,9 @@ testthat::test_that("Multiple wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors4, jk4),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -734,9 +733,9 @@ testthat::test_that("Multiple wide dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors5, jk5),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
})
@@ -771,7 +770,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors1, jk1),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __1b. single variable - drop_keys = TRUE ----
@@ -802,7 +801,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors1, jk1),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __2. multiple variables ----
@@ -836,7 +835,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors2, jk2),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __3.a two selectors same filters (one filter not complete) ----
@@ -874,15 +873,14 @@ testthat::test_that("Single long dataset", {
deparse(get_dplyr_call(merged_selectors3, join_keys = jk3), 120),
deparse(quote(
ADRS %>%
- dplyr::filter(PARAMCD == "BESRSPI" & AVISIT %in%
- c("BASELINE", "SCREENING")) %>%
+ dplyr::filter(PARAMCD == "BESRSPI" & AVISIT %in% c("BASELINE", "SCREENING")) %>%
dplyr::select(STUDYID, USUBJID, PARAMCD, AVISIT, AGE, SEX, BMRKR1)
), 120)
)
testthat::expect_identical(
get_merge_call(merged_selectors3),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __3.b two selectors same filters (one filter not complete) ----
@@ -943,8 +941,8 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors3, jk3),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "AVISIT"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "AVISIT")))
)
)
@@ -1003,8 +1001,8 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors4, jk4),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -1060,9 +1058,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors5, jk5),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
+ )
)
# __ 6. two selectors different filters -----
@@ -1120,9 +1118,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors6, jk6),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "AVISIT"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "AVISIT")))
+ )
)
# __ 7. two selectors different filters - drop PARAMCD when filtered-out on different levels -----
@@ -1181,9 +1179,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors7, jk7),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "AVISIT"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "AVISIT")))
+ )
)
@@ -1260,10 +1258,10 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors8, jk8),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID", "AVISIT"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID", "AVISIT")))
+ )
)
# __ 9. Reshape one filter -------
@@ -1302,7 +1300,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors9, jk9),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __ 10. Reshape two filters ------
@@ -1344,7 +1342,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors10, jk10),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __ 11. Reshape does not include non-key filter ------
@@ -1387,7 +1385,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors11, jk11),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __ 12. Reshape two selectors - same filters same select -------
@@ -1440,7 +1438,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors12, jk12),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __13. Reshape two selectors - different filters ------
@@ -1509,9 +1507,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors13, jk13),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
+ )
)
# __14. Reshape two datasets - different filters, one with empty select ------
@@ -1581,9 +1579,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors14, jk14),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
+ )
)
# __15. Reshape - key filter + non-key filter--------
@@ -1650,9 +1648,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors15, jk15),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
+ )
)
# __16. Reshape - multiple filters, one combined --------
@@ -1747,10 +1745,10 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors16, jk16),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
+ )
)
# __17. Reshape - multiple filters, one combined --------
@@ -1852,9 +1850,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors17, jk17),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -1894,7 +1892,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors18, jk18),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
@@ -1972,10 +1970,10 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors20, jk20),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID", "AVISIT"))) # nolint
- ) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID", "AVISIT")))
+ )
)
# __21. multiple variables (concatenated) - drop_keys = TRUE ----
@@ -2019,7 +2017,7 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors21, jk21),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
# __22. multiple selectors different filters - keys in select ------
@@ -2151,9 +2149,9 @@ testthat::test_that("Single long dataset", {
testthat::expect_identical(
get_merge_call(merged_selectors22, jk22),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
})
@@ -2207,8 +2205,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_identical(
get_merge_call(merged_selectors1, jk1),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
) # gonna be cartesian
@@ -2260,9 +2258,9 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors2, jk2),
list(
- quote(ANL <- ANL_1), # nolint
+ quote(ANL <- ANL_1),
quote(
- ANL <- dplyr::full_join(ANL, ANL_2, by = c(USUBJID = "STUDYID", STUDYID = "USUBJID")) %>% # nolint
+ ANL <- dplyr::full_join(ANL, ANL_2, by = c(USUBJID = "STUDYID", STUDYID = "USUBJID")) %>%
dplyr::mutate(USUBJID = STUDYID, STUDYID = USUBJID)
)
)
@@ -2320,8 +2318,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors3, jk3),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
) # gonna be cartesian
@@ -2377,8 +2375,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors4, jk4),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
) # gonna be cartesian
@@ -2433,8 +2431,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors5, jk5),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
) # gonna be cartesian
@@ -2499,8 +2497,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors6, jk6),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -2567,8 +2565,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors7, jk7),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -2617,13 +2615,15 @@ testthat::test_that("Multiple long datasets", {
),
list(
deparse(
- quote(ADRS %>%
- dplyr::filter(PARAMCD == "BESRSPI" & AVISIT == "SCREENING") %>%
- dplyr::select(STUDYID, USUBJID, PARAMCD, AVISIT, AVAL) %>%
- dplyr::rename(x1.AVAL = AVAL) %>%
- tidyr::pivot_longer(cols = "x1.AVAL", names_to = "MEASURE", values_to = "VALUE") %>%
- tidyr::unite(KEY, MEASURE, PARAMCD, AVISIT) %>%
- tidyr::pivot_wider(names_from = "KEY", values_from = "VALUE")),
+ quote(
+ ADRS %>%
+ dplyr::filter(PARAMCD == "BESRSPI" & AVISIT == "SCREENING") %>%
+ dplyr::select(STUDYID, USUBJID, PARAMCD, AVISIT, AVAL) %>%
+ dplyr::rename(x1.AVAL = AVAL) %>%
+ tidyr::pivot_longer(cols = "x1.AVAL", names_to = "MEASURE", values_to = "VALUE") %>%
+ tidyr::unite(KEY, MEASURE, PARAMCD, AVISIT) %>%
+ tidyr::pivot_wider(names_from = "KEY", values_from = "VALUE")
+ ),
width.cutoff = 120
),
deparse(
@@ -2665,9 +2665,9 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors8, jk8),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -2773,10 +2773,10 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors9, jk9),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_4, by = c("STUDYID", "USUBJID", "AVISIT"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_4, by = c("STUDYID", "USUBJID", "AVISIT")))
)
)
# __10. ADRS + ADTTE + ADSL + ADRS (same as first) ------
@@ -2856,9 +2856,9 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors10, jk10),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -2927,8 +2927,8 @@ testthat::test_that("Multiple long datasets", {
testthat::expect_equal(
get_merge_call(merged_selectors11, jk11),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
})
@@ -3010,8 +3010,8 @@ testthat::test_that("Multiple long - combined/concatenated filters", {
testthat::expect_equal(
get_merge_call(merged_selectors12, jk12),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "PARAMCD"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "PARAMCD")))
)
)
@@ -3084,8 +3084,8 @@ testthat::test_that("Multiple long - combined/concatenated filters", {
testthat::expect_equal(
get_merge_call(merged_selectors13, jk13),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -3162,9 +3162,9 @@ testthat::test_that("Multiple long - combined/concatenated filters", {
testthat::expect_equal(
get_merge_call(merged_selectors14, jk14),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -3247,9 +3247,9 @@ testthat::test_that("Multiple long - combined/concatenated filters", {
testthat::expect_equal(
get_merge_call(merged_selectors15, jk15),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
+ quote(ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID")))
)
)
@@ -3312,17 +3312,17 @@ testthat::test_that("Multiple long - combined/concatenated filters", {
testthat::expect_equal(
get_merge_call(merged_selectors16, jk16),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
})
# Universal example ------
testthat::test_that("Universal example", {
- X <- data.frame(A = c(1, 1:3), B = 2:5, D = 1:4, E = letters[1:4], G = letters[6:9]) # nolint
- Y <- data.frame(A = c(1, 1, 2), B = 2:4, C = c(4, 4:5), E = letters[4:6], F = letters[5:7], G = letters[1:3]) # nolint
- Z <- data.frame(C = c(4, 4:6), D = 1:4, E = letters[4:7], F = letters[6:9], G = letters[1:4]) # nolint
+ X <- data.frame(A = c(1, 1:3), B = 2:5, D = 1:4, E = letters[1:4], G = letters[6:9]) # nolint object_name_linter.
+ Y <- data.frame(A = c(1, 1, 2), B = 2:4, C = c(4, 4:5), E = letters[4:6], F = letters[5:7], G = letters[1:3]) # nolint object_name_linter.
+ Z <- data.frame(C = c(4, 4:6), D = 1:4, E = letters[4:7], F = letters[6:9], G = letters[1:4]) # nolint object_name_linter.
selector_list <- list(
list(
@@ -3382,4 +3382,3 @@ testthat::test_that("Universal example", {
)
)
})
-# nolint end
diff --git a/tests/testthat/test-filter_spec.R b/tests/testthat/test-filter_spec.R
index 9e3ce2b4..ff54caea 100644
--- a/tests/testthat/test-filter_spec.R
+++ b/tests/testthat/test-filter_spec.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE), ADLB = reactive(ADLB))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE", "ADLB")]
primary_keys_list <- lapply(join_keys, function(x) x[[1]])
@@ -153,7 +153,7 @@ testthat::test_that("Dropping keys attribute", {
testthat::test_that("delayed filter_spec", {
set.seed(1)
- ADSL <- data.frame( # nolint
+ ADSL <- data.frame(
USUBJID = letters[1:10],
SEX = sample(c("F", "M", "U"), 10, replace = TRUE),
stringsAsFactors = FALSE
@@ -218,7 +218,7 @@ testthat::test_that("filter_spec_internal", {
})
testthat::test_that("filter_spec_internal contains dataname", {
- ADSL <- teal.transform::rADSL # nolint
+ ADSL <- teal.transform::rADSL
x_filter <- filter_spec_internal(
vars_choices = variable_choices(ADSL)
@@ -236,7 +236,7 @@ testthat::test_that("filter_spec_internal contains dataname", {
testthat::test_that("delayed filter_spec works", {
set.seed(1)
- ADSL <- data.frame( # nolint
+ ADSL <- data.frame(
USUBJID = letters[1:10],
SEX = sample(c("F", "M", "U"), 10, replace = TRUE),
stringsAsFactors = FALSE
diff --git a/tests/testthat/test-merge_utils.R b/tests/testthat/test-merge_utils.R
index 1c12aa74..aa2bf99c 100644
--- a/tests/testthat/test-merge_utils.R
+++ b/tests/testthat/test-merge_utils.R
@@ -592,7 +592,7 @@ testthat::test_that("get_merge_call", {
)
testthat::expect_identical(
get_merge_call(x),
- list(quote(ANL <- ANL_1)) # nolint
+ list(quote(ANL <- ANL_1))
)
x <- list(
@@ -617,8 +617,8 @@ testthat::test_that("get_merge_call", {
testthat::expect_identical(
get_merge_call(x, jk),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))) # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID")))
)
)
@@ -644,9 +644,9 @@ testthat::test_that("get_merge_call", {
testthat::expect_identical(
get_merge_call(x, jk),
list(
- quote(ANL <- ANL_1), # nolint
+ quote(ANL <- ANL_1),
quote(
- ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT")) # nolint
+ ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
)
)
)
@@ -685,10 +685,10 @@ testthat::test_that("get_merge_call", {
testthat::expect_identical(
get_merge_call(x, jk),
list(
- quote(ANL <- ANL_1), # nolint
- quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))), # nolint
+ quote(ANL <- ANL_1),
+ quote(ANL <- dplyr::full_join(ANL, ANL_2, by = c("STUDYID", "USUBJID"))),
quote(
- ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT")) # nolint
+ ANL <- dplyr::full_join(ANL, ANL_3, by = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT"))
)
)
)
diff --git a/tests/testthat/test-resolve.R b/tests/testthat/test-resolve.R
index 296c3eb4..a68fd70f 100644
--- a/tests/testthat/test-resolve.R
+++ b/tests/testthat/test-resolve.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
arm_ref_comp <- list(
ARMCD = list(
@@ -26,17 +26,17 @@ testthat::test_that("resolve_delayed_expr works correctly", {
# function assumptions check
# 1) single argument called "data"
testthat::expect_error(
- resolve_delayed_expr(function() {}, ds = ADSL, is_value_choices = FALSE), # nolint
+ resolve_delayed_expr(function() {}, ds = ADSL, is_value_choices = FALSE),
regexp = "Assertion on 'x' failed: Must have formal arguments: data.",
fixed = TRUE
)
testthat::expect_error(
- resolve_delayed_expr(function(a) {}, ds = ADSL, is_value_choices = FALSE), # nolint
+ resolve_delayed_expr(function(a) {}, ds = ADSL, is_value_choices = FALSE),
regexp = "Assertion on 'x' failed: Must have formal arguments: data.",
fixed = TRUE
)
testthat::expect_error(
- resolve_delayed_expr(function(data, a) {}, ds = ADSL, is_value_choices = FALSE), # nolint
+ resolve_delayed_expr(function(data, a) {}, ds = ADSL, is_value_choices = FALSE),
regexp = "Assertion on 'x' failed: Must have exactly 1 formal arg",
fixed = TRUE
)
diff --git a/tests/testthat/test-resolve_delayed.R b/tests/testthat/test-resolve_delayed.R
index 3e8ff93c..ece8c286 100644
--- a/tests/testthat/test-resolve_delayed.R
+++ b/tests/testthat/test-resolve_delayed.R
@@ -1,5 +1,5 @@
-adsl <- teal.transform::rADSL # nolint
-adtte <- teal.transform::rADTTE # nolint
+adsl <- teal.transform::rADSL
+adtte <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(adsl), ADTTE = reactive(adtte))
join_keys <- teal.data::default_cdisc_join_keys[c("ADSL", "ADTTE")]
@@ -9,17 +9,17 @@ testthat::test_that("resolve_delayed_expr works correctly", {
# function assumptions check
# 1) single argument called "data"
testthat::expect_error(
- resolve_delayed_expr(function() {}, ds = adsl, is_value_choices = FALSE), # nolint
+ resolve_delayed_expr(function() {}, ds = adsl, is_value_choices = FALSE),
regexp = "Assertion on 'x' failed: Must have formal arguments: data.",
fixed = TRUE
)
testthat::expect_error(
- resolve_delayed_expr(function(a) {}, ds = adsl, is_value_choices = FALSE), # nolint
+ resolve_delayed_expr(function(a) {}, ds = adsl, is_value_choices = FALSE),
regexp = "Assertion on 'x' failed: Must have formal arguments: data.",
fixed = TRUE
)
testthat::expect_error(
- resolve_delayed_expr(function(data, a) {}, ds = adsl, is_value_choices = FALSE), # nolint
+ resolve_delayed_expr(function(data, a) {}, ds = adsl, is_value_choices = FALSE),
regexp = "Assertion on 'x' failed: Must have exactly 1 formal arg",
fixed = TRUE
)
diff --git a/tests/testthat/test-select_spec.R b/tests/testthat/test-select_spec.R
index 1fc4dc5a..41b5afa2 100644
--- a/tests/testthat/test-select_spec.R
+++ b/tests/testthat/test-select_spec.R
@@ -1,5 +1,5 @@
-adsl <- teal.transform::rADSL # nolint
-adtte <- teal.transform::rADTTE # nolint
+adsl <- teal.transform::rADSL
+adtte <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(adsl), ADTTE = reactive(adtte))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
@@ -85,7 +85,7 @@ testthat::test_that("Multiple choices", {
})
testthat::test_that("resolve select_spec works", {
- attr(adsl, "keys") <- c("STUDYID", "USUBJID") # nolint
+ attr(adsl, "keys") <- c("STUDYID", "USUBJID")
expected_spec <- select_spec(
choices = variable_choices(adsl, c("BMRKR1", "BMRKR2")),
@@ -207,7 +207,7 @@ testthat::test_that("default values", {
# With resolve_delayed
testthat::test_that("resolve_delayed select_spec works - resolve_delayed", {
- attr(adsl, "keys") <- c("STUDYID", "USUBJID") # nolint
+ attr(adsl, "keys") <- c("STUDYID", "USUBJID")
expected_spec <- select_spec(
choices = variable_choices(adsl, c("BMRKR1", "BMRKR2")),
diff --git a/tests/testthat/test-value_choices.R b/tests/testthat/test-value_choices.R
index cdf3923c..94f2246d 100644
--- a/tests/testthat/test-value_choices.R
+++ b/tests/testthat/test-value_choices.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/tests/testthat/test-variable_choices.R b/tests/testthat/test-variable_choices.R
index 3b3821f1..74ca9825 100644
--- a/tests/testthat/test-variable_choices.R
+++ b/tests/testthat/test-variable_choices.R
@@ -1,5 +1,5 @@
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
data_list <- list(ADSL = reactive(ADSL), ADTTE = reactive(ADTTE))
primary_keys_list <- list(ADSL = c("STUDYID", "USUBJID"), ADTTE = c("STUDYID", "USUBJID", "PARAMCD"))
diff --git a/vignettes/data-extract-merge.Rmd b/vignettes/data-extract-merge.Rmd
index dcd466ec..85ba37f5 100644
--- a/vignettes/data-extract-merge.Rmd
+++ b/vignettes/data-extract-merge.Rmd
@@ -100,8 +100,7 @@ merge_srv <- function(id, datasets, data_extracts, join_keys) {
join_keys = join_keys,
merge_function = "dplyr::left_join"
)
-
- ANL <- reactive({ # nolint
+ ANL <- reactive({
data_list <- lapply(datasets, function(ds) ds())
eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
@@ -125,8 +124,8 @@ along with a list of necessary join keys per `data.frame` object:
```{r}
# Define data.frame objects
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
# create a list of reactive data.frame objects
datasets <- list(
diff --git a/vignettes/data-extract.Rmd b/vignettes/data-extract.Rmd
index b109d865..416b0061 100644
--- a/vignettes/data-extract.Rmd
+++ b/vignettes/data-extract.Rmd
@@ -74,8 +74,8 @@ along with a list of necessary join keys per `data.frame` object:
```{r}
# Define data.frame objects
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
# create a list of reactive data.frame objects
datasets <- list(
diff --git a/vignettes/data-merge.Rmd b/vignettes/data-merge.Rmd
index b19dbb4d..4f2cee18 100644
--- a/vignettes/data-merge.Rmd
+++ b/vignettes/data-merge.Rmd
@@ -97,7 +97,7 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
merge_function = "dplyr::left_join"
)
- ANL <- reactive({ # nolint
+ ANL <- reactive({
data_list <- lapply(datasets, function(ds) ds())
eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
@@ -107,8 +107,8 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
}
# Define data.frame objects
-ADSL <- teal.transform::rADSL # nolint
-ADTTE <- teal.transform::rADTTE # nolint
+ADSL <- teal.transform::rADSL
+ADTTE <- teal.transform::rADTTE
# create a list of reactive data.frame objects
datasets <- list(
@@ -161,7 +161,7 @@ merge_module <- function(id, datasets, data_extracts, join_keys) {
merge_function = "dplyr::left_join"
)
- ANL <- reactive({ # nolint
+ ANL <- reactive({
data_list <- lapply(datasets, function(ds) ds())
eval(envir = list2env(data_list), expr = as.expression(merged_data()$expr))
})
From 8296b883ca1bd7e26694545c4a14a0c5a45ddbe3 Mon Sep 17 00:00:00 2001
From: kartikeya kirar
Date: Wed, 14 Feb 2024 19:36:11 +0530
Subject: [PATCH 58/62] minor changes. (#197)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
part of https://github.com/insightsengineering/teal.transform/pull/176
I have made minor updates as part of review process
- updated document
- changed tags
- added some punctuations
- removed unused variable.
---------
Signed-off-by: kartikeya kirar
Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
---
R/all_choices.R | 2 +-
R/call_utils.R | 24 +++++++++++++-----------
R/choices_labeled.R | 17 ++++++++---------
R/choices_selected.R | 11 +++++++----
R/data.R | 2 +-
R/data_extract_datanames.R | 11 +++++++----
R/data_extract_module.R | 2 +-
R/data_extract_spec.R | 8 ++++----
R/filter_spec.R | 2 +-
R/get_dplyr_call.R | 4 ++--
R/get_merge_call.R | 2 +-
R/include_css_js.R | 4 ++--
R/input_checks.R | 2 +-
R/merge_datasets.R | 2 --
R/merge_expression_module.R | 3 ++-
man/all_choices.Rd | 2 +-
man/call_check_parse_varname.Rd | 2 +-
man/call_condition_choice.Rd | 20 +++++++++++---------
man/check_no_multiple_selection.Rd | 2 +-
man/choices_labeled.Rd | 7 +++++--
man/choices_selected.Rd | 6 +++---
man/data_extract_multiple_srv.Rd | 2 +-
man/data_extract_spec.Rd | 11 ++++++-----
man/datanames_input.Rd | 2 +-
man/filter_spec.Rd | 2 +-
man/get_dplyr_call_data.Rd | 4 ++--
man/get_extract_datanames.Rd | 2 +-
man/get_merge_call.Rd | 2 +-
man/include_css_files.Rd | 4 ++--
man/is_single_dataset.Rd | 4 +++-
man/merge_expression_module.Rd | 3 +--
man/rADTTE.Rd | 4 ++--
man/value_choices.Rd | 4 +++-
man/variable_choices.Rd | 4 +++-
34 files changed, 100 insertions(+), 83 deletions(-)
diff --git a/R/all_choices.R b/R/all_choices.R
index be01f441..c6e69f38 100644
--- a/R/all_choices.R
+++ b/R/all_choices.R
@@ -4,7 +4,7 @@
#' `r lifecycle::badge("experimental")`
#'
#' An S3 structure representing the selection of all possible choices in a
-#' `filter_spec`, `select_spec` or `choices_selected` object
+#' `filter_spec`, `select_spec` or `choices_selected` object.
#'
#' @return `all_choices` object.
#'
diff --git a/R/call_utils.R b/R/call_utils.R
index 0ac6ae11..67aaf6a3 100644
--- a/R/call_utils.R
+++ b/R/call_utils.R
@@ -1,6 +1,6 @@
#' Checks `varname` argument and convert to call
#'
-#' Checks `varname` type and parse if it's a `character`
+#' Checks `varname` type and parse if it's a `character`.
#'
#' @param varname (`name` or `call` or `character(1)`)
#' name of the variable
@@ -35,22 +35,24 @@ call_check_parse_varname <- function(varname) {
#'
#' Compose choices condition call from inputs.
#'
-#' @param varname (`name` or `call` or `character(1)`)
-#' name of the variable.
-#' @param choices (`vector`)
-#' `varname` values to match using the `==` (single value) or `%in%` (vector)
-#' condition.
+#' @details
#' `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
+#' * `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`).
+#' 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 varname (`name` or `call` or `character(1)`)
+#' name of the variable.
+#' @param choices (`vector`)
+#' `varname` values to match using the `==` (single value) or `%in%` (vector)
+#' condition.
#'
#' @return `call`.
#'
diff --git a/R/choices_labeled.R b/R/choices_labeled.R
index 3c51424c..066e0347 100644
--- a/R/choices_labeled.R
+++ b/R/choices_labeled.R
@@ -120,10 +120,12 @@ choices_labeled <- function(choices, labels, subset = NULL, types = NULL) {
)
}
-#' Wrapper on [choices_labeled] to label variables basing on existing labels in data
+#' Variable label extraction and custom selection from data
#'
+#' @description
#' `r lifecycle::badge("stable")`
#'
+#' Wrapper on [choices_labeled] to label variables basing on existing labels in data.
#'
#' @rdname variable_choices
#'
@@ -240,10 +242,13 @@ variable_choices.data.frame <- function(data, subset = NULL, fill = TRUE, key =
}
}
-#' Wrapper on [choices_labeled] to label variable values basing on other variable values
+#' Value labeling and filtering based on variable relationship
#'
+#' @description
#' `r lifecycle::badge("stable")`
#'
+#' Wrapper on [choices_labeled] to label variable values basing on other variable values.
+#'
#' @rdname value_choices
#'
#' @param data (`data.frame`, `character`)
@@ -374,17 +379,11 @@ value_choices.data.frame <- function(data,
res
}
-#' Print choices_labeled object
-#'
-#' `r lifecycle::badge("stable")`
-#'
-#' @rdname choices_labeled
+#' @describeIn choices_labeled Print choices_labeled object
#'
#' @param x an object used to select a method.
#' @param ... further arguments passed to or from other methods.
#'
-#' @return `x`, invisibly.
-#'
#' @export
#'
print.choices_labeled <- function(x, ...) {
diff --git a/R/choices_selected.R b/R/choices_selected.R
index 3b6290bc..a453948a 100644
--- a/R/choices_selected.R
+++ b/R/choices_selected.R
@@ -9,7 +9,7 @@ no_select_keyword <- "-- no selection --"
#' additional settings such as to order the choices with the selected elements appearing first
#' or whether to block the user from making selections.
#'
-#' Can be used in `ui` input elements such as [teal.widgets::optionalSelectInput()].
+#' Can be used in UI input elements such as [teal.widgets::optionalSelectInput()].
#'
#' @details
#' Please note that the order of selected will always follow the order of choices. The `keep_order`
@@ -34,8 +34,8 @@ no_select_keyword <- "-- no selection --"
#' be on top of the drop-down field.
#' @param fixed (optional `logical`) Whether to block user to select choices.
#'
-#' @return `choices_selected` returns object of class `choices_selected` and of
-#' type list which contains the specified `choices`, `selected`, `keep_order` and `fixed`.
+#' @return `choices_selected` returns list of `choices_selected`, encapsulating the specified
+#' `choices`, `selected`, `keep_order` and `fixed`.
#'
#' @examples
#' library(shiny)
@@ -240,7 +240,10 @@ no_selected_as_NULL <- function(x) { # nolint: object_name_linter.
}
## Non-exported utils functions ----
-## Modify vectors and keep attributes
+#' Modify vectors and keep attributes
+#' @keywords internal
+#' @noRd
+#'
vector_reorder <- function(vec, idx) {
checkmate::assert_atomic(vec)
checkmate::assert_integer(idx, min.len = 1, lower = 1, any.missing = FALSE)
diff --git a/R/data.R b/R/data.R
index 3cbe95eb..debbb89d 100644
--- a/R/data.R
+++ b/R/data.R
@@ -46,7 +46,7 @@
#' @name rADSL
"rADSL"
-#' Random Time to Event Analysis Dataset
+#' Random time to event analysis dataset
#'
#' @docType data
#'
diff --git a/R/data_extract_datanames.R b/R/data_extract_datanames.R
index 10acb0cf..7437cb3b 100644
--- a/R/data_extract_datanames.R
+++ b/R/data_extract_datanames.R
@@ -8,7 +8,7 @@
#'
#' @param data_extracts (`list`) of data extracts for single variable.
#'
-#' @return [shiny::helpText()] object.
+#' @return `shiny.tag` defining help-text element that can be added to a UI element.
#'
#' @export
#'
@@ -26,7 +26,7 @@ datanames_input <- function(data_extracts) {
#' `r lifecycle::badge("stable")`
#'
#' Fetches `dataname` slot per `data_extract_spec` from a list of
-#' `data_extract_spec` and returns the unique `dataname` set.
+#' `data_extract_spec`.
#'
#' @param data_extracts (`data_extract_spec(1)`) object or a list (of lists)
#' of `data_extract_spec`.
@@ -64,9 +64,12 @@ get_extract_datanames <- function(data_extracts) {
unique(unlist(datanames))
}
-#' Checks if the input `data_extract_spec` objects all come from the same dataset
+#' Verify uniform dataset source across data extract specification
#'
-#' `r lifecycle::badge("stable")`
+#' @description
+#' `r lifecycle::badge("stable")`
+#'
+#' Checks if the input `data_extract_spec` objects all come from the same dataset.
#'
#' @param ... either `data_extract_spec` objects or lists of `data_extract_spec`
#' objects that do not contain `NULL`
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index aee0a655..9c91fc6f 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -590,7 +590,7 @@ data_extract_srv.list <- function(id,
#'
#' See example for details.
#'
-#' @return reactive named list containing outputs from [data_extract_srv()].
+#' @return reactive named `list` containing outputs from [data_extract_srv()].
#' Output list names are the same as `data_extract` input argument.
#'
#' @examples
diff --git a/R/data_extract_spec.R b/R/data_extract_spec.R
index 1420aee0..04d29d36 100644
--- a/R/data_extract_spec.R
+++ b/R/data_extract_spec.R
@@ -1,13 +1,13 @@
-#' 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.
+#' The Data extract input can be used to filter and select columns from a data 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.
+#' @note No checks based on columns can be done because the data is only referred to by name.
#'
#' @rdname data_extract_spec
#'
@@ -22,7 +22,7 @@
#' @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
+#' 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`)
diff --git a/R/filter_spec.R b/R/filter_spec.R
index 3239a9fc..c841ff8b 100644
--- a/R/filter_spec.R
+++ b/R/filter_spec.R
@@ -3,7 +3,7 @@
#' @description
#' `r lifecycle::badge("stable")`
#'
-#' It consists in choices and additionally the variable names for the choices
+#' It consists in choices and additionally the variable names for the choices.
#'
#' @details
#' The `filter_spec` is used inside `teal` apps to allow filtering datasets
diff --git a/R/get_dplyr_call.R b/R/get_dplyr_call.R
index 59e70a43..6d4eaf2b 100644
--- a/R/get_dplyr_call.R
+++ b/R/get_dplyr_call.R
@@ -1,7 +1,7 @@
#' Aggregates data extract selectors
#'
-#' Simplifies selector_list into aggregated list with one element per
-#' same selector - same dataset, same filter configuration and same reshape status
+#' Simplifies `selector_list` into aggregated list with one element per
+#' same selector - same dataset, same filter configuration and same reshape status.
#'
#' @inheritParams get_merge_call
#'
diff --git a/R/get_merge_call.R b/R/get_merge_call.R
index 6faa7c55..afa51e21 100644
--- a/R/get_merge_call.R
+++ b/R/get_merge_call.R
@@ -3,7 +3,7 @@
#' @description
#' `r lifecycle::badge("stable")`
#'
-#' Returns list of calls depending on selector(s) and type of the merge.
+#' Creates list of calls depending on selector(s) and type of the merge.
#' The merge order is the same as in selectors passed to the function.
#'
#' @inheritParams merge_datasets
diff --git a/R/include_css_js.R b/R/include_css_js.R
index c84bb119..29884664 100644
--- a/R/include_css_js.R
+++ b/R/include_css_js.R
@@ -2,8 +2,8 @@
#'
#' `system.file` should not be used to access files in other packages, it does
#' not work with `devtools`.
-#' Therefore, we redefine this method in each package as needed.
-#' Thus, we do not export this method
+#' As a result, this method is individually redefined as required in each package.
+#' Therefore, this function is not exported.
#'
#' @param pattern (`character`) pattern of files to be included.
#'
diff --git a/R/input_checks.R b/R/input_checks.R
index aad58333..a71641df 100644
--- a/R/input_checks.R
+++ b/R/input_checks.R
@@ -29,7 +29,7 @@ list_extract_spec <- function(x, allow_null = FALSE) {
#'
#' `r lifecycle::badge("stable")`
#'
-#' Stops if condition not met
+#' Stops if condition not met.
#'
#' @param extract_input (`list` or `NULL`) a list of `data_extract_spec`
#'
diff --git a/R/merge_datasets.R b/R/merge_datasets.R
index 44fe260c..45640999 100644
--- a/R/merge_datasets.R
+++ b/R/merge_datasets.R
@@ -129,8 +129,6 @@ merge_datasets <- function(selector_list, datasets, join_keys, merge_function =
SIMPLIFY = FALSE
)
- selector_datanames <- unique(vapply(merged_selector_list, `[[`, character(1), "dataname"))
-
dplyr_calls <- lapply(seq_along(merged_selector_list), function(idx) {
dplyr_call <- get_dplyr_call(
selector_list = merged_selector_list,
diff --git a/R/merge_expression_module.R b/R/merge_expression_module.R
index 76ca70da..eaa35e86 100644
--- a/R/merge_expression_module.R
+++ b/R/merge_expression_module.R
@@ -1,8 +1,9 @@
#' Merge expression module
#'
+#' @description
#' `r lifecycle::badge("experimental")`
#'
-#' This function is a convenient wrapper to combine `data_extract_multiple_srv()` and
+#' Convenient wrapper to combine `data_extract_multiple_srv()` and
#' `merge_expression_srv()` when no additional processing is required.
#' Compare the example below with that found in [merge_expression_srv()].
#'
diff --git a/man/all_choices.Rd b/man/all_choices.Rd
index 6110ced5..2409ad3a 100644
--- a/man/all_choices.Rd
+++ b/man/all_choices.Rd
@@ -13,7 +13,7 @@ all_choices()
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
An S3 structure representing the selection of all possible choices in a
-\code{filter_spec}, \code{select_spec} or \code{choices_selected} object
+\code{filter_spec}, \code{select_spec} or \code{choices_selected} object.
}
\examples{
# Both structures are semantically identical
diff --git a/man/call_check_parse_varname.Rd b/man/call_check_parse_varname.Rd
index 002d5015..ac3cc617 100644
--- a/man/call_check_parse_varname.Rd
+++ b/man/call_check_parse_varname.Rd
@@ -14,6 +14,6 @@ name of the variable}
the parsed \code{varname}.
}
\description{
-Checks \code{varname} type and parse if it's a \code{character}
+Checks \code{varname} type and parse if it's a \code{character}.
}
\keyword{internal}
diff --git a/man/call_condition_choice.Rd b/man/call_condition_choice.Rd
index d117e0c2..c25436b5 100644
--- a/man/call_condition_choice.Rd
+++ b/man/call_condition_choice.Rd
@@ -12,26 +12,28 @@ name of the variable.}
\item{choices}{(\code{vector})
\code{varname} values to match using the \code{==} (single value) or \code{\%in\%} (vector)
-condition.
+condition.}
+}
+\value{
+\code{call}.
+}
+\description{
+Compose choices condition call from inputs.
+}
+\details{
\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
+\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{
-\code{call}.
-}
-\description{
-Compose choices condition call from inputs.
}
\examples{
# use non-exported function from teal.transform
diff --git a/man/check_no_multiple_selection.Rd b/man/check_no_multiple_selection.Rd
index 8a52dc22..220632eb 100644
--- a/man/check_no_multiple_selection.Rd
+++ b/man/check_no_multiple_selection.Rd
@@ -17,5 +17,5 @@ Raises an error when check fails, otherwise, it returns \code{NULL}, invisibly.
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\details{
-Stops if condition not met
+Stops if condition not met.
}
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index b99b27a5..b988f961 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -37,13 +37,16 @@ Named \code{character} vector.
This is often useful for \code{\link[=choices_selected]{choices_selected()}} as it marks up the drop-down boxes
for \code{\link[shiny:selectInput]{shiny::selectInput()}}.
-
-\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
}
\details{
If either \code{choices} or \code{labels} are factors, they are coerced to character.
Duplicated elements from \code{choices} get removed.
}
+\section{Methods (by generic)}{
+\itemize{
+\item \code{print(choices_labeled)}: Print choices_labeled object
+
+}}
\examples{
library(shiny)
library(teal.data)
diff --git a/man/choices_selected.Rd b/man/choices_selected.Rd
index 2977516c..74a37e09 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -34,8 +34,8 @@ be on top of the drop-down field.}
\item{x}{(\code{choices_selected}) object to check.}
}
\value{
-\code{choices_selected} returns object of class \code{choices_selected} and of
-type list which contains the specified \code{choices}, \code{selected}, \code{keep_order} and \code{fixed}.
+\code{choices_selected} list object, encapsulating the specified
+\code{choices}, \code{selected}, \code{keep_order} and \code{fixed}.
\code{is.choices_selected} returns \code{TRUE} if \code{x} inherits from a \code{choices_selected} object, \code{FALSE} otherwise.
}
@@ -46,7 +46,7 @@ Construct a single list containing available choices, the default selected value
additional settings such as to order the choices with the selected elements appearing first
or whether to block the user from making selections.
-Can be used in \code{ui} input elements such as \code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}}.
+Can be used in UI input elements such as \code{\link[teal.widgets:optionalSelectInput]{teal.widgets::optionalSelectInput()}}.
}
\details{
Please note that the order of selected will always follow the order of choices. The \code{keep_order}
diff --git a/man/data_extract_multiple_srv.Rd b/man/data_extract_multiple_srv.Rd
index 7551751f..6aa3a9d7 100644
--- a/man/data_extract_multiple_srv.Rd
+++ b/man/data_extract_multiple_srv.Rd
@@ -65,7 +65,7 @@ See example for more details.}
\code{select_validation_rule} but for the choose dataset part of the \code{data_extract_ui}}
}
\value{
-reactive named list containing outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}.
+reactive named \code{list} containing outputs from \code{\link[=data_extract_srv]{data_extract_srv()}}.
Output list names are the same as \code{data_extract} input argument.
}
\description{
diff --git a/man/data_extract_spec.Rd b/man/data_extract_spec.Rd
index 30756a37..02cf0e90 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 \code{teal} modules}
+\title{Data extract input for \code{teal} modules}
\usage{
data_extract_spec(dataname, select = NULL, filter = NULL, reshape = FALSE)
}
@@ -17,7 +17,7 @@ The setup can be created using \link{select_spec} function.}
\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
+Please note that if both select and filter are set to \code{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}.}
@@ -32,11 +32,12 @@ keys selected in filter part.}
\description{
\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.
+The Data extract input can be used to filter and select columns from a data 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.
+}
+\note{
+No checks based on columns can be done because the data is only referred to by name.
}
\section{Module Development}{
diff --git a/man/datanames_input.Rd b/man/datanames_input.Rd
index e2842926..65753253 100644
--- a/man/datanames_input.Rd
+++ b/man/datanames_input.Rd
@@ -10,7 +10,7 @@ datanames_input(data_extracts)
\item{data_extracts}{(\code{list}) of data extracts for single variable.}
}
\value{
-\code{\link[shiny:helpText]{shiny::helpText()}} object.
+\code{shiny.tag} defining help-text element that can be added to a UI element.
}
\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/filter_spec.Rd b/man/filter_spec.Rd
index 68842e89..19402cc6 100644
--- a/man/filter_spec.Rd
+++ b/man/filter_spec.Rd
@@ -61,7 +61,7 @@ dataset keys, \code{TRUE} on default.}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
-It consists in choices and additionally the variable names for the choices
+It consists in choices and additionally the variable names for the choices.
}
\details{
The \code{filter_spec} is used inside \code{teal} apps to allow filtering datasets
diff --git a/man/get_dplyr_call_data.Rd b/man/get_dplyr_call_data.Rd
index 83b94d96..1f81b4dd 100644
--- a/man/get_dplyr_call_data.Rd
+++ b/man/get_dplyr_call_data.Rd
@@ -21,7 +21,7 @@ ids of the respective
selections, reshapes etc. All necessary data for merging.
}
\description{
-Simplifies selector_list into aggregated list with one element per
-same selector - same dataset, same filter configuration and same reshape status
+Simplifies \code{selector_list} into aggregated list with one element per
+same selector - same dataset, same filter configuration and same reshape status.
}
\keyword{internal}
diff --git a/man/get_extract_datanames.Rd b/man/get_extract_datanames.Rd
index 86822194..ae81666c 100644
--- a/man/get_extract_datanames.Rd
+++ b/man/get_extract_datanames.Rd
@@ -17,5 +17,5 @@ of \code{data_extract_spec}.}
\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.
+\code{data_extract_spec}.
}
diff --git a/man/get_merge_call.Rd b/man/get_merge_call.Rd
index 00728abf..dcc80f7b 100644
--- a/man/get_merge_call.Rd
+++ b/man/get_merge_call.Rd
@@ -37,6 +37,6 @@ List with merge \code{call} elements.
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
-Returns list of calls depending on selector(s) and type of the merge.
+Function creates list of calls depending on selector(s) and type of the merge.
The merge order is the same as in selectors passed to the function.
}
diff --git a/man/include_css_files.Rd b/man/include_css_files.Rd
index f678d4ea..812d321b 100644
--- a/man/include_css_files.Rd
+++ b/man/include_css_files.Rd
@@ -15,7 +15,7 @@ HTML code that includes \code{CSS} files.
\description{
\code{system.file} should not be used to access files in other packages, it does
not work with \code{devtools}.
-Therefore, we redefine this method in each package as needed.
-Thus, we do not export this method
+As a result, this method is individually redefined as required in each package.
+Therefore, this function is not exported.
}
\keyword{internal}
diff --git a/man/is_single_dataset.Rd b/man/is_single_dataset.Rd
index 9c545595..05ddb87d 100644
--- a/man/is_single_dataset.Rd
+++ b/man/is_single_dataset.Rd
@@ -2,7 +2,7 @@
% Please edit documentation in R/data_extract_datanames.R
\name{is_single_dataset}
\alias{is_single_dataset}
-\title{Checks if the input \code{data_extract_spec} objects all come from the same dataset}
+\title{Verify uniform dataset source across data extract specification}
\usage{
is_single_dataset(...)
}
@@ -16,4 +16,6 @@ objects that do not contain \code{NULL}}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
+
+Checks if the input \code{data_extract_spec} objects all come from the same dataset.
}
diff --git a/man/merge_expression_module.Rd b/man/merge_expression_module.Rd
index 9225c945..d6e3dc0d 100644
--- a/man/merge_expression_module.Rd
+++ b/man/merge_expression_module.Rd
@@ -60,8 +60,7 @@ Reactive expression with output from \code{\link[=merge_expression_srv]{merge_ex
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
-}
-\details{
+
This function is a convenient wrapper to combine \code{data_extract_multiple_srv()} and
\code{merge_expression_srv()} when no additional processing is required.
Compare the example below with that found in \code{\link[=merge_expression_srv]{merge_expression_srv()}}.
diff --git a/man/rADTTE.Rd b/man/rADTTE.Rd
index 56d85983..185d391d 100644
--- a/man/rADTTE.Rd
+++ b/man/rADTTE.Rd
@@ -3,7 +3,7 @@
\docType{data}
\name{rADTTE}
\alias{rADTTE}
-\title{Random Time to Event Analysis Dataset}
+\title{Random time to event analysis dataset}
\format{
An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 2000 rows and 67 columns.
}
@@ -14,7 +14,7 @@ internal
rADTTE
}
\description{
-Random Time to Event Analysis Dataset
+Random time to event analysis dataset
}
\keyword{datasets}
\keyword{internal}
diff --git a/man/value_choices.Rd b/man/value_choices.Rd
index d933ef12..a4b631f4 100644
--- a/man/value_choices.Rd
+++ b/man/value_choices.Rd
@@ -4,7 +4,7 @@
\alias{value_choices}
\alias{value_choices.character}
\alias{value_choices.data.frame}
-\title{Wrapper on \link{choices_labeled} to label variable values basing on other variable values}
+\title{Value labeling and filtering based on variable relationship}
\usage{
value_choices(data, var_choices, var_label = NULL, subset = NULL, sep = " - ")
@@ -35,6 +35,8 @@ named character vector or \code{delayed_data} object.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
+
+Wrapper on \link{choices_labeled} to label variable values basing on other variable values.
}
\examples{
ADRS <- teal.transform::rADRS
diff --git a/man/variable_choices.Rd b/man/variable_choices.Rd
index 7cba1aac..18617ad8 100644
--- a/man/variable_choices.Rd
+++ b/man/variable_choices.Rd
@@ -4,7 +4,7 @@
\alias{variable_choices}
\alias{variable_choices.character}
\alias{variable_choices.data.frame}
-\title{Wrapper on \link{choices_labeled} to label variables basing on existing labels in data}
+\title{Variable label extraction and custom selection from data}
\usage{
variable_choices(data, subset = NULL, fill = FALSE, key = NULL)
@@ -39,6 +39,8 @@ Named \code{character} vector with additional attributes or \code{delayed_data}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
+
+Wrapper on \link{choices_labeled} to label variables basing on existing labels in data.
}
\examples{
library(teal.data)
From 2d43e8ef38df35f222b778823baf5568706529db 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, 14 Feb 2024 14:09:08 +0000
Subject: [PATCH 59/62] [skip actions] Roxygen Man Pages Auto Update
---
man/choices_labeled.Rd | 2 --
man/choices_selected.Rd | 2 +-
man/get_merge_call.Rd | 2 +-
man/merge_expression_module.Rd | 2 +-
4 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/man/choices_labeled.Rd b/man/choices_labeled.Rd
index b988f961..50bfe012 100644
--- a/man/choices_labeled.Rd
+++ b/man/choices_labeled.Rd
@@ -29,8 +29,6 @@ icons to the \link{choices_selected} drop down box (e.g. "numeric").}
}
\value{
Named \code{character} vector.
-
-\code{x}, invisibly.
}
\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/choices_selected.Rd b/man/choices_selected.Rd
index 74a37e09..33682b8a 100644
--- a/man/choices_selected.Rd
+++ b/man/choices_selected.Rd
@@ -34,7 +34,7 @@ be on top of the drop-down field.}
\item{x}{(\code{choices_selected}) object to check.}
}
\value{
-\code{choices_selected} list object, encapsulating the specified
+\code{choices_selected} returns list of \code{choices_selected}, encapsulating the specified
\code{choices}, \code{selected}, \code{keep_order} and \code{fixed}.
\code{is.choices_selected} returns \code{TRUE} if \code{x} inherits from a \code{choices_selected} object, \code{FALSE} otherwise.
diff --git a/man/get_merge_call.Rd b/man/get_merge_call.Rd
index dcc80f7b..62a303ad 100644
--- a/man/get_merge_call.Rd
+++ b/man/get_merge_call.Rd
@@ -37,6 +37,6 @@ List with merge \code{call} elements.
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}
-Function creates list of calls depending on selector(s) and type of the merge.
+Creates list of calls depending on selector(s) and type of the merge.
The merge order is the same as in selectors passed to the function.
}
diff --git a/man/merge_expression_module.Rd b/man/merge_expression_module.Rd
index d6e3dc0d..f9cec939 100644
--- a/man/merge_expression_module.Rd
+++ b/man/merge_expression_module.Rd
@@ -61,7 +61,7 @@ Reactive expression with output from \code{\link[=merge_expression_srv]{merge_ex
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}
-This function is a convenient wrapper to combine \code{data_extract_multiple_srv()} and
+Convenient wrapper to combine \code{data_extract_multiple_srv()} and
\code{merge_expression_srv()} when no additional processing is required.
Compare the example below with that found in \code{\link[=merge_expression_srv]{merge_expression_srv()}}.
}
From cbb8f38e36c23811c065901e45bd4ee83bd21b0a 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, 14 Feb 2024 15:13:03 +0100
Subject: [PATCH 60/62] Apply suggestions from code review
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com>
---
R/check_selector.R | 3 ++-
R/utils.R | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/R/check_selector.R b/R/check_selector.R
index 95175e4b..0c00f88a 100644
--- a/R/check_selector.R
+++ b/R/check_selector.R
@@ -5,7 +5,8 @@
#' @return Raises an error when check fails, otherwise, it returns the `dataname`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector_dataname <- function(dataname) {
checkmate::assert_string(dataname)
}
diff --git a/R/utils.R b/R/utils.R
index 3bb1f6e2..8f91fc07 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -168,7 +168,7 @@ compose_and_enable_validators <- function(iv, selector_list, validator_names = N
#' Ensures datasets is a list of reactive expression
#'
-#' @param datasets (`reactive` or `teal_data` object or `list`) of `data.frame`
+#' @param datasets (`reactive` or `teal_data` or `list`) of `data.frame`
#' wrapped or not in a reactive expression.
#'
#' @return List of `reactive` expressions that contains all the individual `datasets`.
From ba5646024e721fd18484cb26f0f063dd6cfc78c4 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, 14 Feb 2024 14:15:58 +0000
Subject: [PATCH 61/62] [skip actions] Roxygen Man Pages Auto Update
---
man/check_selector_dataname.Rd | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 man/check_selector_dataname.Rd
diff --git a/man/check_selector_dataname.Rd b/man/check_selector_dataname.Rd
new file mode 100644
index 00000000..20cc1043
--- /dev/null
+++ b/man/check_selector_dataname.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector_dataname}
+\alias{check_selector_dataname}
+\title{Check selector \code{dataname} element}
+\usage{
+check_selector_dataname(dataname)
+}
+\arguments{
+\item{dataname}{(\code{character(1)}) selector element.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{dataname}
+parameter, invisibly and unchanged.
+}
+\description{
+Check selector \code{dataname} element
+}
+\keyword{internal}
From 0b7de5789695c46a1df6d0d6570e75f47ced75e5 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, 14 Feb 2024 15:17:31 +0100
Subject: [PATCH 62/62] Replace remainder noRd
---
R/check_selector.R | 18 ++++++++++++------
R/data_extract_module.R | 6 ++++--
R/merge_data_utils.R | 3 ++-
R/utils.R | 3 ++-
man/check_data_extract_spec.Rd | 19 +++++++++++++++++++
man/check_merge_function.Rd | 18 ++++++++++++++++++
man/check_selector.Rd | 19 +++++++++++++++++++
man/check_selector_filters.Rd | 18 ++++++++++++++++++
man/check_selector_internal_id.Rd | 19 +++++++++++++++++++
man/check_selector_keys.Rd | 19 +++++++++++++++++++
man/check_selector_reshape.Rd | 19 +++++++++++++++++++
man/check_selector_select.Rd | 19 +++++++++++++++++++
man/convert_teal_data.Rd | 19 +++++++++++++++++++
man/id_for_dataset.Rd | 18 ++++++++++++++++++
14 files changed, 207 insertions(+), 10 deletions(-)
create mode 100644 man/check_data_extract_spec.Rd
create mode 100644 man/check_merge_function.Rd
create mode 100644 man/check_selector.Rd
create mode 100644 man/check_selector_filters.Rd
create mode 100644 man/check_selector_internal_id.Rd
create mode 100644 man/check_selector_keys.Rd
create mode 100644 man/check_selector_reshape.Rd
create mode 100644 man/check_selector_select.Rd
create mode 100644 man/convert_teal_data.Rd
create mode 100644 man/id_for_dataset.Rd
diff --git a/R/check_selector.R b/R/check_selector.R
index 0c00f88a..122f5f4e 100644
--- a/R/check_selector.R
+++ b/R/check_selector.R
@@ -17,7 +17,8 @@ check_selector_dataname <- function(dataname) {
#'
#' @return Raises an error when the check fails, otherwise it returns `NULL`, invisibly.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector_filters <- function(filters) {
check_selector_filter <- function(x) {
is.list(x) &&
@@ -39,7 +40,8 @@ check_selector_filters <- function(filters) {
#' @return Raises an error when check fails, otherwise, it returns the `select`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector_select <- function(select) {
checkmate::assert_character(select)
}
@@ -51,7 +53,8 @@ check_selector_select <- function(select) {
#' @return Raises an error when check fails, otherwise, it returns the `keys`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector_keys <- function(keys) {
checkmate::assert_character(keys, min.len = 0L, any.missing = FALSE)
}
@@ -63,7 +66,8 @@ check_selector_keys <- function(keys) {
#' @return Raises an error when check fails, otherwise, it returns the `reshape`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector_reshape <- function(reshape) {
checkmate::assert_flag(reshape)
}
@@ -75,7 +79,8 @@ check_selector_reshape <- function(reshape) {
#' @return Raises an error when check fails, otherwise, it returns the `internal_id`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector_internal_id <- function(internal_id) {
checkmate::assert_string(internal_id)
}
@@ -87,7 +92,8 @@ check_selector_internal_id <- function(internal_id) {
#' @return Raises an error when check fails, otherwise, it returns the `selector`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_selector <- function(selector) {
# An error from the checks below is transformed to a shiny::validate error
# so shiny can display it in grey not in red in an application
diff --git a/R/data_extract_module.R b/R/data_extract_module.R
index 9c91fc6f..3f676532 100644
--- a/R/data_extract_module.R
+++ b/R/data_extract_module.R
@@ -5,7 +5,8 @@
#' @return Raises an error when check fails, otherwise, it returns the `data_extract_spec`
#' parameter, invisibly and unchanged.
#'
-#' @noRd
+#' @keywords internal
+#'
check_data_extract_spec <- function(data_extract_spec) {
checkmate::assert_list(data_extract_spec, types = "data_extract_spec", null.ok = TRUE)
}
@@ -16,7 +17,8 @@ check_data_extract_spec <- function(data_extract_spec) {
#'
#' @return `character(1)`.
#'
-#' @noRd
+#' @keywords internal
+#'
id_for_dataset <- function(dataname) {
paste0("dataset_", dataname, "_singleextract")
}
diff --git a/R/merge_data_utils.R b/R/merge_data_utils.R
index 9324505c..f75b1cbc 100644
--- a/R/merge_data_utils.R
+++ b/R/merge_data_utils.R
@@ -4,7 +4,8 @@
#'
#' @return Raises an error when check fails, otherwise, it returns `NULL`, invisibly.
#'
-#' @noRd
+#' @keywords internal
+#'
check_merge_function <- function(merge_function) {
checkmate::assert_string(merge_function)
stopifnot(length(intersect(methods::formalArgs(eval(rlang::parse_expr(merge_function))), c("x", "y", "by"))) == 3)
diff --git a/R/utils.R b/R/utils.R
index 8f91fc07..620bfe3e 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -173,7 +173,8 @@ compose_and_enable_validators <- function(iv, selector_list, validator_names = N
#'
#' @return List of `reactive` expressions that contains all the individual `datasets`.
#'
-#' @noRd
+#' @keywords internal
+#'
convert_teal_data <- function(datasets) {
if (is.list(datasets)) {
sapply(X = datasets, simplify = FALSE, FUN = function(x) {
diff --git a/man/check_data_extract_spec.Rd b/man/check_data_extract_spec.Rd
new file mode 100644
index 00000000..81c507ac
--- /dev/null
+++ b/man/check_data_extract_spec.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data_extract_module.R
+\name{check_data_extract_spec}
+\alias{check_data_extract_spec}
+\title{Check data extract specification}
+\usage{
+check_data_extract_spec(data_extract_spec)
+}
+\arguments{
+\item{data_extract_spec}{(\code{list}) of \code{data_extract_spec}.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{data_extract_spec}
+parameter, invisibly and unchanged.
+}
+\description{
+Check data extract specification
+}
+\keyword{internal}
diff --git a/man/check_merge_function.Rd b/man/check_merge_function.Rd
new file mode 100644
index 00000000..dbde2675
--- /dev/null
+++ b/man/check_merge_function.Rd
@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/merge_data_utils.R
+\name{check_merge_function}
+\alias{check_merge_function}
+\title{Check if the merge function is valid}
+\usage{
+check_merge_function(merge_function)
+}
+\arguments{
+\item{merge_function}{(\code{character}) merge function name.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns \code{NULL}, invisibly.
+}
+\description{
+Check if the merge function is valid
+}
+\keyword{internal}
diff --git a/man/check_selector.Rd b/man/check_selector.Rd
new file mode 100644
index 00000000..db467ab5
--- /dev/null
+++ b/man/check_selector.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector}
+\alias{check_selector}
+\title{Check selector}
+\usage{
+check_selector(selector)
+}
+\arguments{
+\item{selector}{(\code{list}) of selector elements generated by \code{data_extract_srv}.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{selector}
+parameter, invisibly and unchanged.
+}
+\description{
+Check selector
+}
+\keyword{internal}
diff --git a/man/check_selector_filters.Rd b/man/check_selector_filters.Rd
new file mode 100644
index 00000000..6de70c76
--- /dev/null
+++ b/man/check_selector_filters.Rd
@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector_filters}
+\alias{check_selector_filters}
+\title{Check selector filters element}
+\usage{
+check_selector_filters(filters)
+}
+\arguments{
+\item{filters}{(\code{list}) selector element generated by \code{data_extract_srv}.}
+}
+\value{
+Raises an error when the check fails, otherwise it returns \code{NULL}, invisibly.
+}
+\description{
+Check selector filters element
+}
+\keyword{internal}
diff --git a/man/check_selector_internal_id.Rd b/man/check_selector_internal_id.Rd
new file mode 100644
index 00000000..8c856b68
--- /dev/null
+++ b/man/check_selector_internal_id.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector_internal_id}
+\alias{check_selector_internal_id}
+\title{Check selector internal_id element}
+\usage{
+check_selector_internal_id(internal_id)
+}
+\arguments{
+\item{internal_id}{(\code{character(1)}) selector element generated by \code{data_extract_srv}.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{internal_id}
+parameter, invisibly and unchanged.
+}
+\description{
+Check selector internal_id element
+}
+\keyword{internal}
diff --git a/man/check_selector_keys.Rd b/man/check_selector_keys.Rd
new file mode 100644
index 00000000..d16e1d5d
--- /dev/null
+++ b/man/check_selector_keys.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector_keys}
+\alias{check_selector_keys}
+\title{Check selector keys element}
+\usage{
+check_selector_keys(keys)
+}
+\arguments{
+\item{keys}{(\code{character}) selector element generated by \code{data_extract_srv}.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{keys}
+parameter, invisibly and unchanged.
+}
+\description{
+Check selector keys element
+}
+\keyword{internal}
diff --git a/man/check_selector_reshape.Rd b/man/check_selector_reshape.Rd
new file mode 100644
index 00000000..691d74e2
--- /dev/null
+++ b/man/check_selector_reshape.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector_reshape}
+\alias{check_selector_reshape}
+\title{Check selector reshape element}
+\usage{
+check_selector_reshape(reshape)
+}
+\arguments{
+\item{reshape}{(\code{logical(1)}) selector element generated by \code{data_extract_srv}.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{reshape}
+parameter, invisibly and unchanged.
+}
+\description{
+Check selector reshape element
+}
+\keyword{internal}
diff --git a/man/check_selector_select.Rd b/man/check_selector_select.Rd
new file mode 100644
index 00000000..7b4121ce
--- /dev/null
+++ b/man/check_selector_select.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/check_selector.R
+\name{check_selector_select}
+\alias{check_selector_select}
+\title{Check selector select element}
+\usage{
+check_selector_select(select)
+}
+\arguments{
+\item{select}{(\code{character}) selector element generated by \code{data_extract_srv}.}
+}
+\value{
+Raises an error when check fails, otherwise, it returns the \code{select}
+parameter, invisibly and unchanged.
+}
+\description{
+Check selector select element
+}
+\keyword{internal}
diff --git a/man/convert_teal_data.Rd b/man/convert_teal_data.Rd
new file mode 100644
index 00000000..d6a695be
--- /dev/null
+++ b/man/convert_teal_data.Rd
@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/utils.R
+\name{convert_teal_data}
+\alias{convert_teal_data}
+\title{Ensures datasets is a list of reactive expression}
+\usage{
+convert_teal_data(datasets)
+}
+\arguments{
+\item{datasets}{(\code{reactive} or \code{teal_data} or \code{list}) of \code{data.frame}
+wrapped or not in a reactive expression.}
+}
+\value{
+List of \code{reactive} expressions that contains all the individual \code{datasets}.
+}
+\description{
+Ensures datasets is a list of reactive expression
+}
+\keyword{internal}
diff --git a/man/id_for_dataset.Rd b/man/id_for_dataset.Rd
new file mode 100644
index 00000000..c1e23810
--- /dev/null
+++ b/man/id_for_dataset.Rd
@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/data_extract_module.R
+\name{id_for_dataset}
+\alias{id_for_dataset}
+\title{Generate id for dataset}
+\usage{
+id_for_dataset(dataname)
+}
+\arguments{
+\item{dataname}{(\code{character(1)}) the name of the dataset.}
+}
+\value{
+\code{character(1)}.
+}
+\description{
+Generate id for dataset
+}
+\keyword{internal}