diff --git a/inst/apps/data_analysis/analyses.html b/inst/apps/data_analysis/analyses.html deleted file mode 100644 index 148e183..0000000 --- a/inst/apps/data_analysis/analyses.html +++ /dev/null @@ -1,1940 +0,0 @@ - - - - - - - - - - -webResearch analysis results - - - - - - - - - - - - - - - - - - - -
- -
- -
-
-

webResearch analysis results

-
- - - -
- - -
-
Published
-
-

November 21, 2024

-
-
- - -
- - - -
- - -
-

Introduction

-
-
-

Methods

-

Analyses were conducted in R version 4.4.1 using the web-based data analysis tool ‘webResearcher’ version 24.11.1.

-
-
-

Results

-

Below is the baseline characteristics plotted.

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CharacteristicN = 5231
Age69 (59, 77)
Female sex181 (35%)
Admission NIHSS3.0 (2.0, 5.0)
    Unknown10
Treated with IVT190 (37%)
    Unknown14
Treated with EVT37 (7.3%)
    Unknown13
Placebo trial treatment269 (51%)
Pre-stroke PASE score137 (83, 203)
6 months post-stroke PASE score136 (77, 206)
Living alone172 (33%)
    Unknown6
Body mass index26.6 (24.0, 30.4)
    Unknown165
Current smoker164 (32%)
    Unknown16
High alcohol consumption47 (9.2%)
    Unknown13
Hypertension266 (51%)
    Unknown4
Diabetes57 (11%)
    Unknown6
Previous TIA13 (2.5%)
    Unknown6
Atrial fibrillation82 (16%)
    Unknown5
Previous MI41 (7.9%)
    Unknown6
Peripheral arterial disease21 (4.1%)
    Unknown12
Pre-stroke WHO-5 score80 (64, 88)
    Unknown2
Pre-stroke mRS > 089 (17%)
1 Median (Q1, Q3); n (%)
- -
-
-
-

Here are the regression results.

-
-
-
- - - ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CharacteristicBeta95% CI1p-value
Female sex
-

-

-
    FALSE
-
    TRUE-0.30-3.0, 2.40.8
Admission NIHSS0.21-0.13, 0.550.2
Treated with IVT
-

-

-
    FALSE
-
    TRUE0.02-2.6, 2.7>0.9
Treated with EVT
-

-

-
    FALSE
-
    TRUE-7.7-13, -2.20.006
Placebo trial treatment
-

-

-
    FALSE
-
    TRUE0.72-1.7, 3.10.6
Pre-stroke PASE score-0.03-0.05, -0.02<0.001
6 months post-stroke PASE score-0.03-0.04, -0.010.001
Living alone
-

-

-
    FALSE
-
    TRUE2.5-0.31, 5.30.081
Body mass index-0.54-0.78, -0.30<0.001
Current smoker
-

-

-
    FALSE
-
    TRUE-5.2-7.9, -2.6<0.001
High alcohol consumption
-

-

-
    FALSE
-
    TRUE1.4-3.0, 5.70.5
Hypertension
-

-

-
    FALSE
-
    TRUE4.62.2, 7.1<0.001
Diabetes
-

-

-
    FALSE
-
    TRUE-1.4-5.3, 2.50.5
Previous TIA
-

-

-
    FALSE
-
    TRUE1.3-6.1, 8.70.7
Atrial fibrillation
-

-

-
    FALSE
-
    TRUE5.11.8, 8.50.002
Previous MI
-

-

-
    FALSE
-
    TRUE4.6-0.34, 9.50.068
Peripheral arterial disease
-

-

-
    FALSE
-
    TRUE5.5-1.2, 120.11
Pre-stroke WHO-5 score0.080.02, 0.140.008
Pre-stroke mRS > 0
-

-

-
    FALSE
-
    TRUE3.70.32, 7.10.032
1 CI = Confidence Interval
- -
-
-
-
-
-

Discussion

-

Good luck on your further work!

-
- -
- - -
- - - - - \ No newline at end of file diff --git a/inst/apps/data_analysis/functions.R b/inst/apps/data_analysis/functions.R deleted file mode 100644 index 6ca1d18..0000000 --- a/inst/apps/data_analysis/functions.R +++ /dev/null @@ -1,332 +0,0 @@ - - -######## -#### Current file: /Users/au301842/webResearch/R//app.R -######## - - - - - - - - - - - - - - -shiny_webResearch <- function(data=NULL,...){ - appDir <- system.file("apps", "data_analysis", package = "webResearch") - if (appDir == "") { - stop("Could not find example directory. Try re-installing `webResearch`.", call. = FALSE) - } - - G <- .GlobalEnv - assign("webResearch_data", data, envir=G) - a=shiny::runApp(appDir = appDir, ...) - return(invisible(a)) -} - - - - - - - - - -page_panels <- function(data){ -bslib::navset_card_underline( - title="Data and results", - data[[1]], - data[[2]], - data[[3]] -) -} - - -######## -#### Current file: /Users/au301842/webResearch/R//baseline_table.R -######## - - - - - - - - - - - - - - -baseline_table <- function(data, fun.args = NULL, fun = gtsummary::tbl_summary, vars = NULL) { - if (!is.null(vars)) { - data <- data |> dplyr::select(dplyr::all_of(vars)) - } - - out <- do.call(fun, c(list(data = data), fun.args)) - return(out) -} - - - -######## -#### Current file: /Users/au301842/webResearch/R//helpers.R -######## - - - - - - - - - - - - -getfun <- function(x) { - if("character" %in% class(x)){ - if (length(grep("::", x)) > 0) { - parts <- strsplit(x, "::")[[1]] - requireNamespace(parts[1]) - getExportedValue(parts[1], parts[2]) - } - }else { - x - } -} - - - - - - - - - - - - -write_quarto <- function(data,fileformat,qmd.file=here::here("analyses.qmd"),file=NULL,...){ - if (is.null(file)){ - file <- paste0("analyses.",fileformat) - } - temp <- tempfile(fileext = ".Rds") - # write_rds(mtcars, temp) - # read_rds(temp) - web_data <- data - saveRDS(web_data,file=temp) - - quarto::quarto_render(qmd.file, - output_file = file, - execute_params = list(data.file=temp) - ) -} - - - - - - - - - - - -read_input <- function(file, consider.na = c("NA", '""', "")) { - ext <- tools::file_ext(file) - - if (ext == "csv") { - df <- readr::read_csv(file = file, na = consider.na) - } else if (ext %in% c("xls", "xlsx")) { - df <- openxlsx2::read_xlsx(file = file, na.strings = consider.na) - } else if (ext == "dta") { - df <- haven::read_dta(file = file) - } else if (ext == "ods") { - df <- readODS::read_ods(path = file) - } else { - stop("Input file format has to be on of: - '.csv', '.xls', '.xlsx', '.dta' or '.ods'") - } - - df -} - - - - - - - - - - - -argsstring2list <- function(string){ - eval(parse(text = paste0("list(", string, ")"))) -} - - -######## -#### Current file: /Users/au301842/webResearch/R//regression_model.R -######## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -regression_model <- function(data, - outcome.str, - auto.mode = TRUE, - formula.str = NULL, - args.list = NULL, - fun = NULL, - vars = NULL) { - if (!is.null(formula.str)) { - if (formula.str == "") { - formula.str <- NULL - } - } - - if (!is.null(formula.str)) { - formula.str <- glue::glue(formula.str) - } else { - assertthat::assert_that(outcome.str %in% names(data), - msg = "Outcome variable is not present in the provided dataset" - ) - formula.str <- glue::glue("{outcome.str}~.") - - if (!is.null(vars)) { - if (outcome.str %in% vars) { - vars <- vars[vars %in% outcome.str] - } - data <- data |> dplyr::select(dplyr::all_of(c(vars, outcome.str))) - } - } - - # Formatting character variables as factor - # Improvement should add a missing vector to format as NA - data <- data |> dplyr::mutate(dplyr::across(dplyr::where(is.character), as.factor)) - - # browser() - if (auto.mode) { - if (is.numeric(data[[outcome.str]])) { - fun <- "stats::lm" - } else if (is.factor(data[[outcome.str]])) { - if (length(levels(data[[outcome.str]])) == 2) { - fun <- "stats::glm" - args.list <- list(family = stats::binomial(link = "logit")) - } else if (length(levels(data[[outcome.str]])) > 2) { - fun <- "MASS::polr" - args.list <- list( - Hess = TRUE, - method = "logistic" - ) - } else { - stop("The provided output variable only has one level") - } - } else { - stop("Output variable should be either numeric or factor for auto.mode") - } - } - - assertthat::assert_that("character" %in% class(fun), - msg = "Please provide the function as a character vector." - ) - - out <- do.call( - getfun(fun), - c( - list(data = data), - list(formula = as.formula(formula.str)), - args.list - ) - ) - - # Recreating the call - # out$call <- match.call(definition=eval(parse(text=fun)), call(fun, data = 'data',formula = as.formula(formula.str),args.list)) - - return(out) -} - - -######## -#### Current file: /Users/au301842/webResearch/R//regression_table.R -######## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -regression_table <- function(data, args.list = NULL, fun = "gtsummary::tbl_regression") { - - if (any(c(length(class(data))!=1, class(data)!="lm"))){ - if (!"exponentiate" %in% names(args.list)){ - args.list <- c(args.list,list(exponentiate=TRUE)) - } - } - - out <- do.call(getfun(fun), c(list(x = data), args.list)) - return(out) -}