Skip to content

Commit

Permalink
fix code reproducibility using within
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr committed Nov 8, 2023
1 parent 671f8be commit 98f00c7
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 78 deletions.
17 changes: 8 additions & 9 deletions R/adtteSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,15 @@ adtteSpecInput <- function(inputId, # nolint
#' }
#'
#' my_app <- function() {
#' adtte <- teal.modules.hermes::rADTTE %>%
#' data <- teal_data()
#' data <- within(data, {
#' ADTTE = teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = .data$CNSR == 0)
#'
#' data <- teal_data(
#' ADTTE = adtte,
#' MAE = hermes::multi_assay_experiment,
#' code =
#' "adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = .data$CNSR == 0)"
#' )
#' MAE = hermes::multi_assay_experiment
#' })
#' datanames <- c("ADTTE", "MAE")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' app <- init(
#' data = data,
Expand Down
38 changes: 18 additions & 20 deletions R/forestplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
#' @export
#'
#' @examples
#' adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = (.data$CNSR == 0))
#' data <- teal_data()
#' data <- within(data, {
#' ADTTE = teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = .data$CNSR == 0)
#' MAE = hermes::multi_assay_experiment
#' })
#' datanames <- c("ADTTE", "MAE")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' data <- teal_data(
#' ADTTE = adtte,
#' MAE = hermes::multi_assay_experiment,
#' code =
#' "adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = (.data$CNSR == 0))"
#' )
#' app <- init(
#' data = data,
#' modules = modules(
Expand Down Expand Up @@ -283,17 +283,15 @@ srv_g_forest_tte <- function(id,
#' sample_tm_g_forest_tte()
#' }
sample_tm_g_forest_tte <- function() { # nolint

adtte <- teal.modules.hermes::rADTTE %>%
dplyr::mutate(is_event = (.data$CNSR == 0))

data <- teal_data(
ADTTE = adtte,
MAE = hermes::multi_assay_experiment,
code =
"adtte <- teal.modules.hermes::rADTTE %>%
dplyr::mutate(is_event = (.data$CNSR == 0))"
)
data <- teal_data()
data <- within(data, {
ADTTE = teal.modules.hermes::rADTTE %>%

Check warning on line 288 in R/forestplot.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/forestplot.R,line=288,col=5,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 288 in R/forestplot.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/forestplot.R,line=288,col=11,[assignment_linter] Use <-, not =, for assignment.
dplyr::mutate(is_event = .data$CNSR == 0)
MAE = hermes::multi_assay_experiment

Check warning on line 290 in R/forestplot.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/forestplot.R,line=290,col=5,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 290 in R/forestplot.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/forestplot.R,line=290,col=9,[assignment_linter] Use <-, not =, for assignment.
})
datanames <- c("ADTTE", "MAE")
datanames(data) <- datanames
data@join_keys <- cdisc_join_keys(!!!datanames)

app <- teal::init(
data = data,
Expand Down
38 changes: 18 additions & 20 deletions R/km.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
#' @export
#'
#' @examples
#' adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = (.data$CNSR == 0))
#' data <- teal_data()
#' data <- within(data, {
#' ADTTE = teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = .data$CNSR == 0)
#' MAE = hermes::multi_assay_experiment
#' })
#' datanames <- c("ADTTE", "MAE")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#'
#' data <- teal_data(
#' ADTTE = adtte,
#' MAE = hermes::multi_assay_experiment,
#' code =
#' "adtte <- teal.modules.hermes::rADTTE %>%
#' dplyr::mutate(is_event = (.data$CNSR == 0))"
#' )
#'
#' modules <- modules(
#' tm_g_km(
Expand Down Expand Up @@ -275,17 +275,15 @@ srv_g_km <- function(id,
#' sample_tm_g_km()
#' }
sample_tm_g_km <- function() { # nolint

adtte <- teal.modules.hermes::rADTTE %>%
dplyr::mutate(is_event = (.data$CNSR == 0))

data <- teal_data(
ADTTE = adtte,
MAE = hermes::multi_assay_experiment,
code =
"adtte <- teal.modules.hermes::rADTTE %>%
dplyr::mutate(is_event = (.data$CNSR == 0))"
)
data <- teal_data()
data <- within(data, {
ADTTE = teal.modules.hermes::rADTTE %>%

Check warning on line 280 in R/km.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/km.R,line=280,col=5,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 280 in R/km.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/km.R,line=280,col=11,[assignment_linter] Use <-, not =, for assignment.
dplyr::mutate(is_event = .data$CNSR == 0)
MAE = hermes::multi_assay_experiment

Check warning on line 282 in R/km.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/km.R,line=282,col=5,[object_name_linter] Variable and function name style should match snake_case or symbols.

Check warning on line 282 in R/km.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/km.R,line=282,col=9,[assignment_linter] Use <-, not =, for assignment.
})
datanames <- c("ADTTE", "MAE")
datanames(data) <- datanames
data@join_keys <- cdisc_join_keys(!!!datanames)

modules <- teal::modules(
tm_g_km(
Expand Down
17 changes: 8 additions & 9 deletions man/adtteSpecServer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions man/tm_g_forest_tte.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions man/tm_g_km.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 98f00c7

Please sign in to comment.