-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from RConsortium/golem_app
Golem version and pkglite bundle
- Loading branch information
Showing
57 changed files
with
300,892 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
pilot1wrappers.Rcheck/ | ||
pilot1wrappers*.tar.gz | ||
pilot1wrappers*.tgz | ||
docs | ||
inst/doc | ||
inst/doc | ||
tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,51 @@ | ||
Package: pilot2wrappers | ||
Type: Package | ||
Title: R Consortium R Submission Pilot 2 | ||
Version: 0.0.0.9000 | ||
Version: 0.2.0 | ||
Authors@R: c( | ||
person("xxx", email = "[email protected]", role = c("aut", "cre")), | ||
person("Eric", "Nantz", email = "[email protected]", role = c("aut", "cre")), | ||
person("Yilong", "Zhang", role = c("aut")), | ||
person("Heng", "Wang", role = c("aut")), | ||
person("Gregory", "Chen", role = c("aut")), | ||
person("Eli", "Miller", role = c("aut")), | ||
person("Ning", "Leng", role = c("aut")), | ||
person("copyright", role = c("cph")) | ||
) | ||
Description: Insert Package Description. | ||
Depends: R (>= 3.6.0) | ||
License: file LICENSE | ||
License: GPL (>= 3) | ||
Imports: | ||
config (>= 0.3.1), | ||
golem (>= 0.3.1), | ||
teal, | ||
teal.data, | ||
shiny (>= 1.7.1), | ||
rtables, | ||
haven, | ||
dplyr, | ||
Tplyr, | ||
tidyr, | ||
glue, | ||
stringr, | ||
huxtable, | ||
ggplot2, | ||
cowplot, | ||
visR, | ||
emmeans, | ||
reactable, | ||
magrittr, | ||
tibble, | ||
utils, | ||
htmltools, | ||
pkgload, | ||
tippy, | ||
markdown | ||
Suggests: | ||
devtools, | ||
testthat, | ||
knitr, | ||
rmarkdown, | ||
covr, | ||
dplyr | ||
covr | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Roxygen: list(markdown = TRUE) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#' Access files in the current app | ||
#' | ||
#' NOTE: If you manually change your package name in the DESCRIPTION, | ||
#' don't forget to change it here too, and in the config file. | ||
#' For a safer name change mechanism, use the `golem::set_golem_name()` function. | ||
#' | ||
#' @param ... character vectors, specifying subdirectory and file(s) | ||
#' within your package. The default, none, returns the root of the app. | ||
#' | ||
#' @noRd | ||
app_sys <- function(...){ | ||
system.file(..., package = "pilot2wrappers") | ||
} | ||
|
||
|
||
#' Read App Config | ||
#' | ||
#' @param value Value to retrieve from the config file. | ||
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE. | ||
#' If unset, "default". | ||
#' @param use_parent Logical, scan the parent directory for config file. | ||
#' | ||
#' @noRd | ||
get_golem_config <- function( | ||
value, | ||
config = Sys.getenv( | ||
"GOLEM_CONFIG_ACTIVE", | ||
Sys.getenv( | ||
"R_CONFIG_ACTIVE", | ||
"default" | ||
) | ||
), | ||
use_parent = TRUE | ||
){ | ||
config::get( | ||
value = value, | ||
config = config, | ||
# Modify this if your config file is somewhere else: | ||
file = app_sys("golem-config.yml"), | ||
use_parent = use_parent | ||
) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#' @importFrom teal init modules module | ||
#' @importFrom shiny tags | ||
create_teal <- function() { | ||
adsl <- haven::read_xpt(app_sys("adam", "adsl.xpt")) | ||
adsl <- adsl %>% | ||
dplyr::mutate( | ||
TRT01P = factor(TRT01P, levels = c("Placebo", "Xanomeline Low Dose", "Xanomeline High Dose")), | ||
AGEGR1 = factor(AGEGR1, levels = c("<65", "65-80", ">80")), | ||
RACE = factor(RACE, levels = c("WHITE", "BLACK OR AFRICAN AMERICAN", "AMERICAN INDIAN OR ALASKA NATIVE")) | ||
) | ||
adas <- haven::read_xpt(app_sys("adam", "adadas.xpt")) %>% | ||
dplyr::filter( | ||
EFFFL == "Y", | ||
ITTFL == 'Y', | ||
PARAMCD == 'ACTOT', | ||
ANL01FL == 'Y' | ||
) | ||
adtte <- haven::read_xpt(app_sys("adam", "adtte.xpt")) %>% | ||
dplyr::filter(PARAMCD == "TTDE") | ||
adlb <- haven::read_xpt(app_sys("adam", "adlbc.xpt")) %>% | ||
subset(TRTPN %in% c(0, 81) & PARAMCD == "GLUC" & !is.na(AVISITN)) %>% | ||
dplyr::mutate(TRTPN = ifelse(TRTPN == 0, 99, TRTPN)) # change treatment order for pairwise comparison | ||
|
||
app <- teal::init( | ||
data = teal.data::cdisc_data( | ||
teal.data::cdisc_dataset("ADSL", adsl), | ||
teal.data::cdisc_dataset("ADAS", adas, keys = c("STUDYID", "USUBJID", "PARAMCD", "AVISIT", "QSSEQ")), | ||
teal.data::cdisc_dataset("ADTTE", adtte), | ||
teal.data::cdisc_dataset("ADLB", adlb) | ||
), | ||
modules = modules( | ||
module( | ||
label = "App Information", | ||
server = function(input, output, session, datasets){}, | ||
ui = function(id, ...) { | ||
shiny::includeMarkdown(app_sys("app", "docs", "about.md")) | ||
}, | ||
filters = NULL | ||
), | ||
module( | ||
label = "Demographic Table", | ||
ui = ui_t_demographic, | ||
server = srv_t_demographic, | ||
filters = "ADSL" | ||
), | ||
module( | ||
label = "KM plot for TTDE", | ||
ui = ui_g_kmplot, | ||
server = srv_g_kmplot, | ||
filters = c("ADSL", "ADTTE") | ||
), | ||
module( | ||
label = "Primary Table", | ||
ui = ui_t_primary, | ||
server = srv_t_primary, | ||
filters = c("ADSL", "ADAS") | ||
), | ||
module( | ||
label = "Efficacy Table", | ||
ui = ui_t_efficacy, | ||
server = srv_t_efficacy, | ||
filters = c("ADSL", "ADLB") | ||
) | ||
|
||
), | ||
header = "Pilot2 app (draft)", | ||
footer = tags$p(class="text-muted", "Source: R Consortium") | ||
) | ||
|
||
return(app) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
utils::globalVariables( | ||
c( | ||
"TRT01P", "AGEGR1", "RACE", "EFFFL", "ITTFL", "PARAMCD", "ANL01FL", "TRTPN", | ||
"AVISITN", "p.value", "contrast", "p", "diff_se", | ||
"ci", "value", "ord", "row_label", "54", "81", "row_label1", "ord_layer_index", "row_label2", "ord_layer_1", | ||
"ord_layer_2", "TRTP", "USUBJID", | ||
"sd", "median", "AVAL", "CHG", ".", "TRTP", "BASE", | ||
"SE", "df", "N", "mean_bl", | ||
"sd_bl", "sd", "mean_chg", "sd_chg", | ||
"emmean", "lower.CL", "upper.CL", "Trt", | ||
"CI", "estimate", "lower", "upper", "p.value", | ||
"comp", "SAFFL", "STUDYID", "USUBJID", "TRT01A", | ||
"AVAL", "CNSR", "PARAM", "PARAMCD", "anl" | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#' Run the Shiny Application | ||
#' | ||
#' @param ... arguments to pass to golem_opts. | ||
#' See `?golem::get_golem_options` for more details. | ||
#' @inheritParams shiny::shinyApp | ||
#' | ||
#' @export | ||
#' @importFrom shiny shinyApp | ||
#' @importFrom golem with_golem_options | ||
run_app <- function( | ||
onStart = NULL, | ||
options = list(), | ||
enableBookmarking = NULL, | ||
uiPattern = "/", | ||
... | ||
) { | ||
app <- create_teal() | ||
with_golem_options( | ||
app = shinyApp( | ||
ui = app$ui, | ||
server = app$server, | ||
onStart = onStart, | ||
options = options, | ||
enableBookmarking = enableBookmarking, | ||
uiPattern = uiPattern | ||
), | ||
golem_opts = list(...) | ||
) | ||
} |
Oops, something went wrong.