### Running: /home/kyoshida/miniconda3/lib/R/bin/exec/R --slave --no-restore --file=01_generate_sas_data.R > > cat(" + ### + ### Prepare environment + ################################################################################\n") ### ### Prepare environment ################################################################################ > > ## Record start time > start_time <- Sys.time() > cat("### Started ", as.character(start_time), "\n") ### Started 2020-04-01 23:47:59 > > ## Load packages > library(survival) Warning message: package ‘survival’ was built under R version 3.6.2 > library(tableone) > library(tidyverse) Registered S3 methods overwritten by 'ggplot2': method from [.quosures rlang c.quosures rlang print.quosures rlang Registered S3 method overwritten by 'rvest': method from read_xml.response xml2 ── Attaching packages ─────────────────────────────────────────────────────────── tidyverse 1.2.1 ── ✔ ggplot2 3.1.1 ✔ purrr 0.3.3 ✔ tibble 2.1.1 ✔ dplyr 0.8.0.1 ✔ tidyr 0.8.3 ✔ stringr 1.4.0 ✔ readr 1.3.1 ✔ forcats 0.4.0 ── Conflicts ────────────────────────────────────────────────────────────── tidyverse_conflicts() ── ✖ dplyr::filter() masks stats::filter() ✖ dplyr::lag() masks stats::lag() > > > cat(" + ### + ### Load data + ################################################################################\n") ### ### Load data ################################################################################ > > data(pbc) > > > cat(" + ### + ### Manipulate + ################################################################################\n") ### ### Manipulate ################################################################################ > > ## For the purpose of this cross testing, complete case analysis is fine. > pbc_cc <- pbc %>% + as_tibble() %>% + ## Missing data should be warned in validate_args() + drop_na() %>% + mutate(male = if_else(sex == "m", 1L, 0L), + ## Combine transplant and death for testing purpose + status = if_else(status == 0, 0L, 1L), + ## censoring status reverse coded for SAS macro + cens = if_else(status == 1L, 0L, 1L), + ## Binary mvar + bili_bin = if_else(bili > median(bili), 1L, 0L), + alk_phos = alk.phos) %>% + select( + ## avar + trt, + ## + ## mvar (continuous) + bili, + ## mvar (binary) + bili_bin, + ## + ## yvar (continuous) + alk_phos, + ## yvar (binary) + spiders, + ## yvar (count) + platelet, + ## yvar (survival) + time, + ## eventvar (survival) + status, + ## censvar (survival) + cens, + ## + ## cvar (continuous/binary/handled continuous) + age, male, stage + ) > > > cat(" + ### + ### Show resulting data + ################################################################################\n") ### ### Show resulting data ################################################################################ > > tab1 <- CreateTableOne(data = pbc_cc, + vars = c("bili","bili_bin", + "alk_phos","spiders","platelet","time","status","cens", + "age","male","stage"), + strata = c("trt"), + test = FALSE) > print(tab1, smd = TRUE) Stratified by trt 1 2 SMD n 136 140 bili (mean (sd)) 2.96 (3.66) 3.70 (5.35) 0.162 bili_bin (mean (sd)) 0.50 (0.50) 0.48 (0.50) 0.043 alk_phos (mean (sd)) 2016.74 (2132.41) 1977.05 (2106.37) 0.019 spiders (mean (sd)) 0.29 (0.46) 0.29 (0.45) 0.018 platelet (mean (sd)) 258.06 (97.83) 265.38 (88.53) 0.078 time (mean (sd)) 1957.39 (1088.45) 2000.32 (1138.66) 0.039 status (mean (sd)) 0.49 (0.50) 0.45 (0.50) 0.071 cens (mean (sd)) 0.51 (0.50) 0.55 (0.50) 0.071 age (mean (sd)) 51.16 (11.04) 48.47 (9.85) 0.257 male (mean (sd)) 0.15 (0.36) 0.10 (0.30) 0.143 stage (mean (sd)) 2.97 (0.91) 3.11 (0.79) 0.160 > > > cat(" + ### + ### Write to a CSV file for SAS + ################################################################################\n") ### ### Write to a CSV file for SAS ################################################################################ > > write_csv(pbc_cc, + path = "./data-pbc_cc.csv") > > > ################################################################################ > cat(" + ### + ### Record package versions etc + ################################################################################\n") ### ### Record package versions etc ################################################################################ > print(sessionInfo()) R version 3.6.1 (2019-07-05) Platform: x86_64-conda_cos6-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux Server release 6.10 (Santiago) Matrix products: default BLAS/LAPACK: /home/kyoshida/miniconda3/lib/R/lib/libRblas.so locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.0.1 purrr_0.3.3 readr_1.3.1 tidyr_0.8.3 [7] tibble_2.1.1 ggplot2_3.1.1 tidyverse_1.2.1 tableone_0.9.3 survival_3.1-11 loaded via a namespace (and not attached): [1] Rcpp_1.0.1 cellranger_1.1.0 pillar_1.3.1 compiler_3.6.1 plyr_1.8.4 [6] class_7.3-15 tools_3.6.1 lubridate_1.7.4 jsonlite_1.6 nlme_3.1-139 [11] gtable_0.3.0 lattice_0.20-40 pkgconfig_2.0.2 rlang_0.4.5 Matrix_1.2-18 [16] cli_1.1.0 rstudioapi_0.10 DBI_1.0.0 haven_2.1.0 e1071_1.7-1 [21] withr_2.1.2 xml2_1.2.0 httr_1.4.0 generics_0.0.2 mitools_2.4 [26] hms_0.4.2 grid_3.6.1 tidyselect_0.2.5 glue_1.3.1 R6_2.4.0 [31] readxl_1.3.1 modelr_0.1.4 magrittr_1.5 backports_1.1.4 scales_1.0.0 [36] splines_3.6.1 labelled_2.2.1 rvest_0.3.3 assertthat_0.2.1 colorspace_1.4-1 [41] stringi_1.4.3 survey_3.36 lazyeval_0.2.2 munsell_0.5.0 broom_0.5.2 [46] crayon_1.3.4 > ## Record execution time and multicore use > end_time <- Sys.time() > diff_time <- difftime(end_time, start_time, units = "auto") >