Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs to use the new teal_data instead of TealData #592

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,23 @@
#'
#' # ADSL example
#'
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset(
#' "ADSL", ADSL,
#' code = "ADSL <- teal.modules.general::rADSL"
#' ),
#' check = TRUE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_a_pca(
#' "PCA",
#' dat = teal.transform::data_extract_spec(
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' choices = teal.transform::variable_choices(data = ADSL, c("BMRKR1", "AGE", "EOSDY")),
#' choices = teal.transform::variable_choices(data = data@env$ADSL, c("BMRKR1", "AGE", "EOSDY")),
vedhav marked this conversation as resolved.
Show resolved Hide resolved
#' selected = c("BMRKR1", "AGE"),
#' multiple = TRUE
#' ),
Expand Down
16 changes: 10 additions & 6 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@
#' # Regression graphs from selected response variable (BMRKR1) and
#' # selected regressors (AGE)
#'
#' ADSL <- teal.modules.general::rADSL
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the point now of waiting for change of the join_keys. Let's continue, maybe we will be able to merge them in the same time.

#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL, code = "ADSL <- teal.modules.general::rADSL"),
#' check = TRUE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_a_regression(
#' label = "Regression",
Expand All @@ -58,7 +62,7 @@
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variables:",
#' choices = teal.transform::variable_choices(ADSL, c("AGE", "SEX", "RACE")),
#' choices = teal.transform::variable_choices(data@env$ADSL, c("AGE", "SEX", "RACE")),
#' selected = "AGE",
#' multiple = TRUE,
#' fixed = FALSE
Expand Down
14 changes: 9 additions & 5 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
#' @export
#' @examples
#'
#' ADSL <- teal.modules.general::rADSL
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL, code = "ADSL <- teal.modules.general::rADSL"),
#' check = TRUE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_data_table(
#' variables_selected = list(ADSL = c("STUDYID", "USUBJID", "SUBJID", "SITEID", "AGE", "SEX")),
Expand Down
11 changes: 7 additions & 4 deletions R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
#' @export
#'
#' @examples
#' data <- data.frame(1)
#' data <- teal_data()
#' data <- within(data, {
#' data <- data.frame(1)
#' })
#' datanames(data) <- c("data")
#'
#' app <- teal::init(
#' data = teal_data(
#' dataset("data", data)
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_file_viewer(
#' input_path = list(
Expand Down
18 changes: 10 additions & 8 deletions R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
#' @export
#' @examples
#'
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' table_1 <- data.frame(Info = c("A", "B"), Text = c("A", "B"))
#' table_2 <- data.frame(`Column 1` = c("C", "D"), `Column 2` = c(5.5, 6.6), `Column 3` = c("A", "B"))
#' table_3 <- data.frame(Info = c("E", "F"), Text = c("G", "H"))
Expand All @@ -27,15 +36,8 @@
#' "Table 3" = table_3
#' )
#'
#' ADSL <- teal.modules.general::rADSL
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL,
#' code = "ADSL <- teal.modules.general::rADSL",
#' metadata = list("Author" = "NEST team", "data_source" = "synthetic data")
#' ),
#' check = TRUE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_front_page(
#' header_text = c(
Expand Down
19 changes: 11 additions & 8 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,25 @@
#' @examples
#' # Association plot of selected reference variable (SEX)
#' # against other selected variables (BMRKR1)
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL, code = "ADSL <- teal.modules.general::rADSL"),
#' check = TRUE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_g_association(
#' ref = teal.transform::data_extract_spec(
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(
#' ADSL,
#' data@env$ADSL,
#' c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
#' ),
#' selected = "RACE",
Expand All @@ -52,7 +55,7 @@
#' select = teal.transform::select_spec(
#' label = "Select variables:",
#' choices = teal.transform::variable_choices(
#' ADSL,
#' data@env$ADSL,
#' c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
#' ),
#' selected = "BMRKR2",
Expand Down
22 changes: 13 additions & 9 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,24 @@
#'
#' @examples
#' # Bivariate plot of selected variable (AGE) against selected (SEX)
#' ADSL <- teal.modules.general::rADSL
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL, code = "ADSL <- teal.modules.general::rADSL"),
#' check = TRUE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_g_bivariate(
#' x = teal.transform::data_extract_spec(
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(ADSL),
#' choices = teal.transform::variable_choices(data@env$ADSL),
#' selected = "AGE",
#' fixed = FALSE
#' )
Expand All @@ -67,7 +71,7 @@
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(ADSL),
#' choices = teal.transform::variable_choices(data@env$ADSL),
#' selected = "SEX",
#' multiple = FALSE,
#' fixed = FALSE
Expand All @@ -77,7 +81,7 @@
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(ADSL),
#' choices = teal.transform::variable_choices(data@env$ADSL),
#' selected = "ARM",
#' fixed = FALSE
#' )
Expand All @@ -86,7 +90,7 @@
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(ADSL),
#' choices = teal.transform::variable_choices(data@env$ADSL),
#' selected = "COUNTRY",
#' fixed = FALSE
#' )
Expand Down
27 changes: 18 additions & 9 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@
#'
#' @examples
#' # Example with non-clinical data
#'
#' data <- teal_data()
#' data <- within(data, {
#' iris <- iris
#' })
#' datanames(data) <- c("iris")
#'
#' app <- teal::init(
#' data = teal_data(dataset("iris", iris)),
#' data = data,
#' modules = list(
#' teal.modules.general::tm_g_distribution(
#' dist_var = teal.transform::data_extract_spec(
Expand All @@ -48,22 +55,24 @@
#' }
#'
#' # Example with clinical data
#' ADSL <- teal.modules.general::rADSL
#' data <- teal_data()
#' data <- within(data, {
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' vars1 <- choices_selected(variable_choices(ADSL, c("ARM", "COUNTRY", "SEX")), selected = NULL)
#' vars1 <- choices_selected(variable_choices(data@env$ADSL, c("ARM", "COUNTRY", "SEX")), selected = NULL)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL),
#' code = "ADSL <- teal.modules.general::rADSL",
#' check = FALSE
#' ),
#' data = data,
#' modules = teal::modules(
#' teal.modules.general::tm_g_distribution(
#' dist_var = teal.transform::data_extract_spec(
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' choices = teal.transform::variable_choices(ADSL, c("AGE", "BMRKR1")),
#' choices = teal.transform::variable_choices(data@env$ADSL, c("AGE", "BMRKR1")),
#' selected = "BMRKR1",
#' multiple = FALSE,
#' fixed = FALSE
Expand Down
16 changes: 11 additions & 5 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@
#' @export
#' @examples
#' # Response plot with selected response (BMRKR1) and selected x variable (RACE)
#' library(nestcolor)
#'
#' ADSL <- teal.modules.general::rADSL
#' data <- teal_data()
#' data <- within(data, {
#' library(nestcolor)
#' ADSL <- teal.modules.general::rADSL
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
#' teal.data::cdisc_dataset("ADSL", ADSL, code = "ADSL <- teal.modules.general::rADSL"),
#' teal.data::cdisc_dataset("ADSL", data@env$ADSL, code = "ADSL <- teal.modules.general::rADSL"),
#' check = TRUE
#' ),
#' modules = teal::modules(
Expand All @@ -42,7 +48,7 @@
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(ADSL, c("BMRKR2", "COUNTRY")),
#' choices = teal.transform::variable_choices(data@env$ADSL, c("BMRKR2", "COUNTRY")),
#' selected = "BMRKR2",
#' multiple = FALSE,
#' fixed = FALSE
Expand All @@ -52,7 +58,7 @@
#' dataname = "ADSL",
#' select = teal.transform::select_spec(
#' label = "Select variable:",
#' choices = teal.transform::variable_choices(ADSL, c("SEX", "RACE")),
#' choices = teal.transform::variable_choices(data@env$ADSL, c("SEX", "RACE")),
#' selected = "RACE",
#' multiple = FALSE,
#' fixed = FALSE
Expand Down
Loading
Loading