From c16577954f86c882ff93a7812ead9d4be2c96323 Mon Sep 17 00:00:00 2001 From: yilong zhang Date: Fri, 27 Oct 2023 04:14:20 +0000 Subject: [PATCH] update example file extension --- .Rhistory | 512 ------------------ .../examples/{for-loop.Rmd => for-loop.txt} | 0 vignettes/metalite-table1.Rmd | 2 +- 3 files changed, 1 insertion(+), 513 deletions(-) delete mode 100644 .Rhistory rename vignettes/examples/{for-loop.Rmd => for-loop.txt} (100%) diff --git a/.Rhistory b/.Rhistory deleted file mode 100644 index ab17b7e..0000000 --- a/.Rhistory +++ /dev/null @@ -1,512 +0,0 @@ -label = "All observations") -for(i in seq(var)){ -meta <- metalite::define_parameter(meta, -name = var[i], -var = var[i], -label = var_label[i], -subset = NULL) -} -meta <- metalite::define_analysis(meta, name = "interactive_table1", label = "Interactive Table 1") -metalite::collect_n_subject(meta, population = "all", parameter = "AGE") -var_label <- vapply(data, function(x) attr(x, "label"), FUN.VALUE = character(1)) -var_label -var_label <- vapply(data, function(x) attr(x, "label"), FUN.VALUE = character(1))[var] -var_label -meta <- metalite::meta_build(meta) -meta -var_label[i] -var_label -names(var_label) <- NULL -var_label <- vapply(data, function(x) attr(x, "label"), FUN.VALUE = character(1))[var] -names(var_label) <- NULL -plan <- metalite::plan(analysis = "interactive_table1", -population = "all", -observation = "inf", -parameter = var) -meta <- metalite::meta_adam(observation = data) -meta <- metalite::define_plan(meta, plan = plan) -meta <- metalite::define_population(meta, -id = id, -name = "all", -group = group, -subset = NULL, -label = "All Subjects", -var = var) -meta <- metalite::define_observation(meta, -id = id, -name = "inf", -subset = NULL, -label = "All observations") -for(i in seq(var)){ -meta <- metalite::define_parameter(meta, -name = var[i], -var = var[i], -label = var_label[i], -subset = NULL) -} -meta <- metalite::define_analysis(meta, name = "interactive_table1", label = "Interactive Table 1") -meta <- metalite::meta_build(meta) -meta -metalite::collect_n_subject(meta, population = "all", parameter = "AGE") -group -formula <- ~ AGE + SEX | TRT01P -if(formula[[2]][[1]] == "|"){ -var = all.vars(formula[[2]][[2]]) -group = all.vars(formula[[2]][[3]]) -}else{ -var = all.vars(formula[[2]]) -group = NULL -} -var_label <- vapply(data, function(x) attr(x, "label"), FUN.VALUE = character(1))[var] -names(var_label) <- NULL -plan <- metalite::plan(analysis = "interactive_table1", -population = "all", -observation = "inf", -parameter = var) -meta <- metalite::meta_adam(observation = data) -meta <- metalite::define_plan(meta, plan = plan) -meta <- metalite::define_population(meta, -id = id, -name = "all", -group = group, -subset = NULL, -label = "All Subjects", -var = var) -meta <- metalite::define_observation(meta, -id = id, -name = "inf", -subset = NULL, -label = "All observations") -for(i in seq(var)){ -meta <- metalite::define_parameter(meta, -name = var[i], -var = var[i], -label = var_label[i], -subset = NULL) -} -meta <- metalite::define_analysis(meta, name = "interactive_table1", label = "Interactive Table 1") -meta <- metalite::meta_build(meta) -metalite::collect_n_subject(meta, population = "all", parameter = "AGE") -tbl <- metalite::collect_n_subject(meta, -population = population, -parameter = parameter, -listing = TRUE, -histogram = TRUE, -...) -population -population <- "all" -parameter <- "inf" -tbl <- metalite::collect_n_subject(meta, -population = population, -parameter = parameter, -listing = TRUE, -histogram = TRUE) -meta -parameter -parameter = "AGE" -tbl <- metalite::collect_n_subject(meta, -population = population, -parameter = parameter, -listing = TRUE, -histogram = TRUE) -install.packages("ggplot2") -tbl <- metalite::collect_n_subject(meta, -population = population, -parameter = parameter, -listing = TRUE, -histogram = TRUE) -tbl -par <- metalite::collect_adam_mapping(meta, parameter)$var -par -install.packages("reactable") -devtools::load_all() -interactive_table1(meta, "all", "AGE") -devtools::load_all() -interactive_table1(meta, "all", "AGE") -devtools::load_all() -interactive_table1(meta, "all", "AGE") -library(reactable) -devtools::load_all() -interactive_table1(meta, "all", "AGE") -devtools::load_all() -devtools::load_all() -interactive_table1(meta, "all", "AGE") -metalite_table1(formula, data, "USUBJID") -devtools::load_all() -metalite_table1(formula, data, "USUBJID") -metalite_table1(formula, data = r2rtf::r2rtf_adsl, "USUBJID") -debug(metalite_table1) -metalite_table1(formula, data, "USUBJID") -metalite_table1(formula, data, "USUBJID") -data -attributes(data[[1]]) -head(data) -vapply(data, function(x) attr(x, "label"), FUN.VALUE = character(1)) -lapply(data, function(x) attr(x, "label")) -data <- r2rtf::r2rtf_adsl -devtools::load_all() -data <- r2rtf::r2rtf_adsl -metalite_table1(formula, data, "USUBJID") -devtools::load_all() -devtools::load_all() -devtools::load_all() -data <- r2rtf::r2rtf_adsl -metalite_table1(formula, data, "USUBJID") -metalite_table1(formula, data, "USUBJID") %>% -interactive_table1("all", "AGE") -library(dplyr) -metalite_table1(formula, data, "USUBJID") %>% -interactive_table1("all", "AGE") -formula <- ~ AGE + SEX -metalite_table1(formula, data, "USUBJID") %>% -interactive_table1("all", "AGE") -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_build() -formula <- ~ AGE + SEX | TRT01P -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -metalite::collect_n_subject -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -?reactable::reactable -library(dplyr) -devtools::load_all() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -?htmltools::browsable -?htmltools::browsable -htmltools::browsable( -htmltools::tagList(x) -) -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -usethis::use_package("reactable") -usethis::use_package("metalite") -usethis::use_gpl3_license() -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -devtools::load_all() -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -devtools::load_all() -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -arg$defaultColDef -devtools::load_all() -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -devtools::load_all() -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -htmltools::browsable( -htmltools::tagList(x) -) -devtools::load_all() -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -col_def -is.null(arg$defaultColDef) -tbl <- reactable::reactable( -data = data, -resizable = resizable, -filterable = filterable, -searchable = searchable, -defaultPageSize = defaultPageSize, -showPageSizeOptions = showPageSizeOptions, -defaultColDef = col_def, -borderless = borderless, -striped = striped, -highlight = highlight, -fullWidth = fullWidth, -width = width, -theme = theme, -wrap = wrap, -elementId = element_id, -... -) -arg -match.arg() -match.call() -as.list(match.call()) -as.list(match.call()) -expr <- as.list(match.call()) -expr[[1]] <- reactable::reactable -expr$defaultColDef <- col_def -expr$elementId = element_id -as.expression(expr) -expr <- as.list(match.call()) -# Display variable label as hover text -if(label & is.null(expr$defaultColDef)){ -label <- get_label(data) -col_header <- function(value, name){ -htmltools::div(title = as.character(label[value]), value) -} -col_def <- reactable::colDef(header = col_header) -} -element_id <- basename(tempfile()) -expr[[1]] <- reactable::reactable -expr$defaultColDef <- col_def -expr$elementId = element_id -# Display variable label as hover text -if(label & is.null(expr$defaultColDef)){ -label <- get_label(data) -col_header <- function(value, name){ -htmltools::div(title = as.character(label[value]), value) -} -expr$defaultColDef <- reactable::colDef(header = col_header) -} -element_id <- basename(tempfile()) -expr[[1]] <- reactable::reactable -expr$elementId = element_id -as.expression(expr) -expr[[1]] <- "reactable::reactable" -expr$elementId = element_id -as.expression(expr) -expr <- as.list(match.call()) -expr[[1]] -class(expr[[1]]) -as.name("reactable::reactable") -expr[[1]] <- as.name("reactable::reactable") -expr$elementId = element_id -as.expression(expr) -eval(as.expression(expr)) -as.call(expr) -eval(as.call(expr)) -expr[[1]] <- "reactable::reactable" -expr$elementId = element_id -eval(as.call(expr)) -as.call(expr) -expr[[1]] <- `reactable` -expr$elementId = element_id -eval(as.call(expr)) -expr[[1]] <- `reactable::reactable` -expr$elementId = element_id -eval(as.call(expr)) -expr[[1]] <- `reactable` -expr$elementId = element_id -eval(as.call(expr)) -setdiff(expr, c("label")) -expr[[1]] <- `reactable` -expr$elementId = element_id -setdiff(expr, c("label")) -expr[[1]] <- reactable::reactable -expr$elementId = element_id -setdiff(expr, c("label")) -eval(as.call(expr)) -expr <- setdiff(expr, c("label")) -eval(as.call(expr)) -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -?eval -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -interactive_table1("all", "AGE") -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -# metalite::meta_run() -interactive_table1("all", "AGE") -htmltools::browsable( -htmltools::tagList(x) -) -x <- metalite_table1(formula, data, "USUBJID") %>% -# metalite::meta_run() -interactive_table1("all", "AGE") -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -# metalite::meta_run() -interactive_table1("all", "AGE") -htmltools::browsable( -htmltools::tagList(x) -) -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -# metalite::meta_run() -interactive_table1("all", "AGE") -htmltools::browsable( -htmltools::tagList(x) -) -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -htmltools::browsable( -htmltools::tagList(x) -) -usethis::use_package_doc() -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -htmltools::browsable( -htmltools::tagList(x) -) -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -htmltools::browsable( -htmltools::tagList(x) -) -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") %>% -metalite::meta_run() -htmltools::browsable( -htmltools::tagList(x) -) -library(dplyr) -devtools::load_all() -data <- r2rtf::r2rtf_adsl -formula <- ~ AGE + SEX | TRT01P -# formula <- ~ AGE + SEX -x <- metalite_table1(formula, data, "USUBJID") -x -class(x) -x[[1]] -x[[1]][[1]] -names(x[[1]]) -x[[1]][[1]] -x[[1]][[1]][[1]] -usethis::use_github_action_check_standard() -usethis::use_github_action("pkgdown") -usethis::use_package_doc() -usethis::use_vignette("metalite.table1") -usethis::use_vignette("metalite-table1") -library(metalite.table1) -devtools::load_all() -devtools::load_all() -head(r2rtf_adsl) -head(r2rtf::r2rtf_adsl) -metalite_table1(~ AGE + SEX + RACE + BMIBLGR1 | ARM, # formula for analysis variables and group -data = r2rtf::r2rtf_adsl, # source data -id = "USUBJID") # unique subject id -unique(df$ARM) -unique(df$ARM) -df <- r2rtf::r2rtf_adsl -unique(df$ARM) -dput(unique(df$ARM)) -# Prepare analysis ready data -df <- r2rtf::r2rtf_adsl -df$AGE[1:3] <- NA # Create missing value for illustration purpose. -df$ARM <- factor(df$ARM, -c("Placebo", "Xanomeline Low Dose", "Xanomeline High Dose"), -c("Placebo", "Low Dose", "High Dose")) -# Create interactive table1 -metalite_table1(~ AGE + SEX + RACE + BMIBLGR1 | ARM, # formula for analysis variables and group -data = df, # source data -id = "USUBJID") # unique subject id -# Create interactive table1 -metalite_table1(~ AGE + SEX + RACE + BMIBLGR1 | ARM, # formula for analysis variables and group -data = df, # source data -id = "USUBJID") # unique subject id -library(r2rtf) -library(table1) -devtools::load_all() -# Prepare analysis ready data -df <- r2rtf_adsl -df$AGE[1:3] <- NA # Create missing value for illustration purpose. -df$ARM <- factor(df$ARM, -c("Placebo", "Xanomeline Low Dose", "Xanomeline High Dose"), -c("Placebo", "Low Dose", "High Dose")) -# Create interactive table1 -metalite_table1(~ AGE + SEX + RACE + BMIBLGR1 | ARM, # formula for analysis variables and group -data = df, # source data -id = "USUBJID") # unique subject id -table1(~ AGE + SEX + RACE + BMIBLGR1 | ARM, data = df) -metalite_table1(~ AGE + SEX + RACE + BMIBLGR1 | ARM, # formula for analysis variables and group -data = df, # source data -id = "USUBJID") diff --git a/vignettes/examples/for-loop.Rmd b/vignettes/examples/for-loop.txt similarity index 100% rename from vignettes/examples/for-loop.Rmd rename to vignettes/examples/for-loop.txt diff --git a/vignettes/metalite-table1.Rmd b/vignettes/metalite-table1.Rmd index e3d9226..263bc5d 100644 --- a/vignettes/metalite-table1.Rmd +++ b/vignettes/metalite-table1.Rmd @@ -167,7 +167,7 @@ by using `resutls="asis"` (e.g., `{r, results="asis"}`) in the Rmarkdown code ch Create a dummy `reactable` object outside of for loop is necessary to include all required javascript library. A full Rmarkdown example is as below. -`r import_example("for-loop.Rmd")` +`r import_example("for-loop.txt")` ```{r, results="asis", echo = FALSE} type <- c("Subjects", "Records")