Skip to content

Commit

Permalink
removing internal functions' examples (#198)
Browse files Browse the repository at this point in the history
fixes: #181

Note: 

- `resolve` methods are exported but generic is internal so here example
of resolve is removed (resolve is used internally)
- Earlier this was done to pre-release which has been reverted
  • Loading branch information
kartikeyakirar committed Feb 15, 2024
1 parent 4ed6190 commit 11e7555
Show file tree
Hide file tree
Showing 34 changed files with 0 additions and 960 deletions.
134 changes: 0 additions & 134 deletions R/call_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,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) {
Expand Down Expand Up @@ -106,17 +96,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) {
Expand All @@ -142,12 +121,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) {
Expand Down Expand Up @@ -179,17 +152,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()) {
Expand Down Expand Up @@ -222,14 +184,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) {
Expand All @@ -256,21 +210,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) {
Expand Down Expand Up @@ -319,20 +258,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) {
Expand Down Expand Up @@ -374,15 +299,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) {
Expand Down Expand Up @@ -418,41 +334,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()) {
Expand All @@ -474,21 +355,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) {
Expand Down
17 changes: 0 additions & 17 deletions R/data_extract_filter_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 0 additions & 9 deletions R/data_extract_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,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) {
Expand Down
8 changes: 0 additions & 8 deletions R/data_extract_select_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
5 changes: 0 additions & 5 deletions R/data_extract_single_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 0 additions & 22 deletions R/filter_spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 <- teal.transform::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,
Expand Down
Loading

0 comments on commit 11e7555

Please sign in to comment.