├── .travis.yml ├── DESCRIPTION ├── LICENCE ├── NAMESPACE ├── NEWS.md ├── R ├── boot_compare.R ├── boot_predict.R ├── check_recode.R ├── coefficient_plot.R ├── coxphmixed.R ├── coxphmulti.R ├── coxphuni.R ├── crrmulti.R ├── crruni.R ├── ff_column_totals.R ├── ff_glimpse.R ├── ff_interaction.R ├── ff_label.R ├── ff_merge.R ├── ff_metrics.R ├── ff_newdata.R ├── ff_permute.R ├── ff_plot.R ├── ff_remove_ref.R ├── finalfit.R ├── finalfit_internal_functions.R ├── finalfit_package.R ├── fit2df.R ├── glmmixed.R ├── glmmulti.R ├── glmmultiboot.R ├── glmuni.R ├── hr_plot.R ├── lmmixed.R ├── lmmulti.R ├── lmuni.R ├── metrics_hoslem.R ├── missing_compare.R ├── missing_glimpse.R ├── missing_pattern.R ├── missing_plot.R ├── or_plot.R ├── summaryfactorlist.R ├── surv_plot.R └── svyglm.R ├── README.md ├── _config.yml ├── _pkgdown.yml ├── appveyor.yml ├── codecov.yml ├── data-raw ├── colon.R ├── random_hopsital.rda ├── wcgs.R └── wcgs.rda ├── data ├── colon_s.rda └── wcgs.rda ├── docs ├── 404.html ├── CNAME ├── LICENSE-text.html ├── apple-touch-icon-120x120.png ├── apple-touch-icon-60x60.png ├── apple-touch-icon-76x76.png ├── apple-touch-icon.png ├── articles │ ├── all_plot_examples.html │ ├── all_plot_examples_files │ │ └── figure-html │ │ │ ├── unnamed-chunk-10-1.png │ │ │ ├── unnamed-chunk-11-1.png │ │ │ ├── unnamed-chunk-12-1.png │ │ │ ├── unnamed-chunk-13-1.png │ │ │ ├── unnamed-chunk-14-1.png │ │ │ ├── unnamed-chunk-15-1.png │ │ │ ├── unnamed-chunk-16-1.png │ │ │ ├── unnamed-chunk-17-1.png │ │ │ ├── unnamed-chunk-19-1.png │ │ │ ├── unnamed-chunk-2-1.png │ │ │ ├── unnamed-chunk-21-1.png │ │ │ ├── unnamed-chunk-22-1.png │ │ │ ├── unnamed-chunk-23-1.png │ │ │ ├── unnamed-chunk-24-1.png │ │ │ ├── unnamed-chunk-4-1.png │ │ │ ├── unnamed-chunk-5-1.png │ │ │ ├── unnamed-chunk-6-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ ├── unnamed-chunk-8-1.png │ │ │ └── unnamed-chunk-9-1.png │ ├── all_plots_examples.html │ ├── all_plots_examples_files │ │ └── figure-html │ │ │ ├── unnamed-chunk-10-1.png │ │ │ ├── unnamed-chunk-11-1.png │ │ │ ├── unnamed-chunk-12-1.png │ │ │ ├── unnamed-chunk-13-1.png │ │ │ ├── unnamed-chunk-14-1.png │ │ │ ├── unnamed-chunk-15-1.png │ │ │ ├── unnamed-chunk-16-1.png │ │ │ ├── unnamed-chunk-17-1.png │ │ │ ├── unnamed-chunk-18-1.png │ │ │ ├── unnamed-chunk-19-1.png │ │ │ ├── unnamed-chunk-2-1.png │ │ │ ├── unnamed-chunk-20-1.png │ │ │ ├── unnamed-chunk-21-1.png │ │ │ ├── unnamed-chunk-22-1.png │ │ │ ├── unnamed-chunk-23-1.png │ │ │ ├── unnamed-chunk-24-1.png │ │ │ ├── unnamed-chunk-25-1.png │ │ │ ├── unnamed-chunk-4-1.png │ │ │ ├── unnamed-chunk-5-1.png │ │ │ ├── unnamed-chunk-6-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ ├── unnamed-chunk-7-2.png │ │ │ ├── unnamed-chunk-7-3.png │ │ │ ├── unnamed-chunk-8-1.png │ │ │ └── unnamed-chunk-9-1.png │ ├── all_tables_examples.html │ ├── all_tables_examples_files │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── bootstrap.html │ ├── bootstrap_files │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── data_prep.html │ ├── data_prep_files │ │ └── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ ├── export.html │ ├── export_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── figure-html │ │ │ └── unnamed-chunk-8-1.png │ ├── finalfit.html │ ├── finalfit_basics.html │ ├── finalfit_basics_files │ │ └── figure-html │ │ │ └── unnamed-chunk-15-1.png │ ├── finalfit_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── figure-html │ │ │ └── unnamed-chunk-15-1.png │ ├── index.html │ ├── missing.html │ ├── missing_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── figure-html │ │ │ ├── unnamed-chunk-14-1.png │ │ │ └── unnamed-chunk-6-1.png │ ├── survival.html │ ├── survival_files │ │ ├── accessible-code-block-0.0.1 │ │ │ └── empty-anchor.js │ │ └── figure-html │ │ │ ├── unnamed-chunk-10-1.png │ │ │ ├── unnamed-chunk-12-1.png │ │ │ ├── unnamed-chunk-14-1.png │ │ │ ├── unnamed-chunk-17-1.png │ │ │ ├── unnamed-chunk-7-1.png │ │ │ └── unnamed-chunk-8-1.png │ └── tables_gallery.html ├── authors.html ├── bootstrap-toc.css ├── bootstrap-toc.js ├── docsearch.css ├── docsearch.js ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── google78a4df6d1f82019f.html ├── index.html ├── link.svg ├── logo.png ├── make_ref_list ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml ├── reference │ ├── Rplot001.png │ ├── Rplot002.png │ ├── Rplot003.png │ ├── boot_compare.html │ ├── boot_predict-1.png │ ├── boot_predict.html │ ├── catTestfisher.html │ ├── check_recode.html │ ├── coefficient_plot-1.png │ ├── coefficient_plot-2.png │ ├── coefficient_plot.html │ ├── colname2label.html │ ├── colon_s.html │ ├── compoundpipe.html │ ├── condense_fit.html │ ├── coxphmulti.html │ ├── coxphuni.html │ ├── crrmulti.html │ ├── crruni.html │ ├── dependent_label.html │ ├── error_colon_fct_levels.html │ ├── expositionpipe.html │ ├── extract_fit.html │ ├── extract_labels.html │ ├── extract_variable_label.html │ ├── ff_column_totals.html │ ├── ff_describe.html │ ├── ff_eval.html │ ├── ff_expand.html │ ├── ff_formula.html │ ├── ff_glimpse.html │ ├── ff_interaction.html │ ├── ff_label.html │ ├── ff_merge.html │ ├── ff_metrics.html │ ├── ff_mode.html │ ├── ff_newdata.html │ ├── ff_parse_formula.html │ ├── ff_percent_only.html │ ├── ff_permute.html │ ├── ff_plot-1.png │ ├── ff_plot-2.png │ ├── ff_plot-3.png │ ├── ff_plot.html │ ├── ff_relabel.html │ ├── ff_relabel_df.html │ ├── ff_remove_p.html │ ├── ff_remove_ref-1.png │ ├── ff_remove_ref.html │ ├── ff_row_totals.html │ ├── ff_stratify_helper.html │ ├── figures │ │ ├── finalfit_130_150.png │ │ ├── finalfit_hex.png │ │ └── logo.png │ ├── finalfit-package.html │ ├── finalfit.html │ ├── fit2df.html │ ├── format_n_percent.html │ ├── glmmixed.html │ ├── glmmulti.html │ ├── glmmulti_boot.html │ ├── glmuni.html │ ├── hr_plot-1.png │ ├── hr_plot-2.png │ ├── hr_plot.html │ ├── index.html │ ├── interp.median.html │ ├── interp.quantiles.html │ ├── is.survival.html │ ├── kurtosi.html │ ├── labels_to_column.html │ ├── labels_to_level.html │ ├── lmmixed.html │ ├── lmmulti.html │ ├── lmuni.html │ ├── metrics_hoslem.html │ ├── missing_compare-1.png │ ├── missing_compare.html │ ├── missing_df.html │ ├── missing_glimpse.html │ ├── missing_pairs.html │ ├── missing_pattern-1.png │ ├── missing_pattern.html │ ├── missing_plot-1.png │ ├── missing_plot.html │ ├── missing_predictorMatrix.html │ ├── or_plot-1.png │ ├── or_plot-2.png │ ├── or_plot.html │ ├── p_tidy.html │ ├── pipe.html │ ├── plot_title.html │ ├── print.html │ ├── remove_intercept.html │ ├── remove_labels.html │ ├── rm_duplicate_labels.html │ ├── rm_duplicates.html │ ├── rm_empty_block.html │ ├── round_tidy.html │ ├── skew.html │ ├── summarise_categorical.html │ ├── summarise_continuous.html │ ├── summary_df.html │ ├── summary_factorlist.html │ ├── summary_factorlist0.html │ ├── summary_factorlist1.html │ ├── summary_factorlist2.html │ ├── summary_factorlist3.html │ ├── summary_factorlist4.html │ ├── summary_factorlist5.html │ ├── summary_factorlist_groups.html │ ├── summary_factorlist_stratified.html │ ├── summary_formula.html │ ├── summary_mipo.html │ ├── surv_plot-1.png │ ├── surv_plot.html │ ├── svyglmmulti.html │ ├── svyglmuni.html │ ├── variable_type.html │ └── wcgs.html └── sitemap.xml ├── man ├── boot_compare.Rd ├── boot_predict.Rd ├── catTestfisher.Rd ├── check_recode.Rd ├── coefficient_plot.Rd ├── colon_s.Rd ├── compoundpipe.Rd ├── condense_fit.Rd ├── coxphmulti.Rd ├── coxphuni.Rd ├── crrmulti.Rd ├── crruni.Rd ├── dependent_label.Rd ├── error_colon_fct_levels.Rd ├── expositionpipe.Rd ├── extract_fit.Rd ├── extract_labels.Rd ├── extract_variable_label.Rd ├── ff_column_totals.Rd ├── ff_eval.Rd ├── ff_expand.Rd ├── ff_formula.Rd ├── ff_glimpse.Rd ├── ff_interaction.Rd ├── ff_label.Rd ├── ff_merge.Rd ├── ff_metrics.Rd ├── ff_mode.Rd ├── ff_newdata.Rd ├── ff_parse_formula.Rd ├── ff_percent_only.Rd ├── ff_permute.Rd ├── ff_plot.Rd ├── ff_relabel.Rd ├── ff_relabel_df.Rd ├── ff_remove_p.Rd ├── ff_remove_ref.Rd ├── ff_row_totals.Rd ├── ff_stratify_helper.Rd ├── figures │ ├── finalfit_130_150.png │ ├── finalfit_hex.png │ └── logo.png ├── finalfit-package.Rd ├── finalfit.Rd ├── fit2df.Rd ├── format_n_percent.Rd ├── glmmixed.Rd ├── glmmulti.Rd ├── glmmulti_boot.Rd ├── glmuni.Rd ├── hr_plot.Rd ├── is.survival.Rd ├── labels_to_column.Rd ├── labels_to_level.Rd ├── lmmixed.Rd ├── lmmulti.Rd ├── lmuni.Rd ├── metrics_hoslem.Rd ├── missing_compare.Rd ├── missing_df.Rd ├── missing_glimpse.Rd ├── missing_pairs.Rd ├── missing_pattern.Rd ├── missing_plot.Rd ├── missing_predictorMatrix.Rd ├── or_plot.Rd ├── p_tidy.Rd ├── pipe.Rd ├── plot_title.Rd ├── print.Rd ├── remove_intercept.Rd ├── remove_labels.Rd ├── rm_duplicate_labels.Rd ├── rm_duplicates.Rd ├── rm_empty_block.Rd ├── round_tidy.Rd ├── summary_df.Rd ├── summary_factorlist.Rd ├── summary_factorlist_stratified.Rd ├── summary_mipo.Rd ├── surv_plot.Rd ├── svyglmmulti.Rd ├── svyglmuni.Rd ├── variable_type.Rd └── wcgs.Rd ├── pkgdown └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── renv └── activate.R ├── tests ├── testthat.R └── testthat │ ├── Rplots.pdf │ ├── test_all_in_one.R │ ├── test_boot.R │ ├── test_check_recode.R │ ├── test_ff_metrics.R │ ├── test_ffs.R │ ├── test_interactions.R │ ├── test_internals.R │ ├── test_missing.R │ ├── test_modelwrappers.R │ ├── test_plots.R │ ├── test_tests.R │ └── testthat-problems.rds └── vignettes ├── all_plots_examples.Rmd ├── all_tables_examples.Rmd ├── bootstrap.R ├── bootstrap.Rmd ├── bootstrap.html ├── data_prep.Rmd ├── export.R ├── export.Rmd ├── export.html ├── finalfit.R ├── finalfit.Rmd ├── finalfit.html ├── missing.R ├── missing.Rmd ├── missing.html └── survival.Rmd /.travis.yml: -------------------------------------------------------------------------------- 1 | language: r 2 | r: 3 | - 4.1.1 4 | 5 | r_packages: 6 | - covr 7 | 8 | warnings_are_errors: false 9 | 10 | addons: 11 | apt: 12 | sources: 13 | - ubuntu-toolchain-r-test 14 | packages: 15 | - g++-7 16 | - libv8-dev 17 | - libnlopt-dev 18 | 19 | env: 20 | - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" 21 | 22 | before_install: 23 | - mkdir -p ~/.R/ 24 | - echo "CXX14 = g++-7 -fPIC -flto=2" >> ~/.R/Makevars 25 | - echo "CXX14FLAGS = -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -Wno-attributes -O3" >> ~/.R/Makevars 26 | 27 | after_success: 28 | - Rscript -e 'library(covr); codecov()' 29 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: finalfit 2 | Type: Package 3 | Title: Quickly Create Elegant Regression Results Tables and Plots when Modelling 4 | Version: 1.0.9 5 | Authors@R: c( 6 | person(given = "Ewen", family = "Harrison", role = c("aut", "cre"), email = "ewen.harrison@ed.ac.uk"), 7 | person(given = "Tom", family = "Drake", role = c("aut")), 8 | person(given = "Riinu", family = "Pius", role = c("aut"))) 9 | Maintainer: Ewen Harrison 10 | Description: Generate regression results tables and plots in final 11 | format for publication. Explore models and export directly to PDF 12 | and 'Word' using 'RMarkdown'. 13 | License: MIT + file LICENCE 14 | Encoding: UTF-8 15 | LazyData: true 16 | BugReports: https://github.com/ewenharrison/finalfit/issues 17 | URL: https://github.com/ewenharrison/finalfit 18 | Imports: 19 | bdsmatrix, 20 | boot, 21 | broom, 22 | dplyr, 23 | forcats, 24 | GGally, 25 | ggplot2, 26 | grid, 27 | gridExtra, 28 | lme4, 29 | magrittr, 30 | mice (>= 3.17.0), 31 | pillar, 32 | pROC, 33 | purrr, 34 | scales, 35 | stats, 36 | stringr, 37 | survival, 38 | tidyr (>= 1.0.0), 39 | RoxygenNote: 7.2.3 40 | Suggests: 41 | cmprsk, 42 | coxme, 43 | Hmisc, 44 | knitr, 45 | lmtest, 46 | readr, 47 | rlang, 48 | rmarkdown, 49 | rstan, 50 | sandwich, 51 | survey, 52 | survminer, 53 | testthat, 54 | tibble 55 | VignetteBuilder: knitr 56 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Ewen M Harrison 3 | -------------------------------------------------------------------------------- /R/coxphmixed.R: -------------------------------------------------------------------------------- 1 | #' Cox proprotional hazards mixed effects models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces multivariable Cox Proportional 4 | #' Hazard regression mixed effects models for a set of explanatory variables and 5 | #' random effects structure against a survival object. 6 | #' 7 | #' Uses \code{\link[coxme]{coxme}} with \code{finalfit} modelling conventions. 8 | #' Output can be passed to \code{\link{fit2df}}. This function is in development 9 | #' given the coxme package is new/ 10 | #' 11 | #' @param .data Data frame. 12 | #' @param dependent Character vector of length 1: name of survival object in 13 | #' form \code{Surv(time, status)}. 14 | #' @param explanatory Character vector of any length: name(s) of explanatory 15 | #' variables. 16 | #' @param random_effect Character vector of length 1, either, (1) name of random 17 | #' intercept variable, e.g. "var1", (automatically convered to "(1 | var1)"); 18 | #' or, (2) the full \code{lme4} specification, e.g. "(var1 | var2)". Note 19 | #' parenthesis MUST be included in (2) but NOT included in (1). 20 | #' @return A multivariable \code{\link[coxme]{coxme}} fitted model. Output is of 21 | #' class \code{coxme}. 22 | #' 23 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 24 | #' @family finalfit model wrappers 25 | #' @export 26 | #' 27 | #' @examples 28 | #' # Cox Proportional Hazards mixed effects analysis. 29 | #' library(finalfit) 30 | #' library(dplyr) 31 | #' 32 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 33 | #' dependent = "Surv(time, status)" 34 | #' random_effect = "hospital" 35 | #' colon_s %>% 36 | #' coxphmixed(dependent, explanatory, random_effect) 37 | #' 38 | coxphmixed <- function(.data, dependent, explanatory, random_effect){ 39 | requireNamespace("survival") 40 | 41 | # If single term random effect, default to random intercept model 42 | if(!grepl("\\|", random_effect)) random_effect = paste0("(1 | ", random_effect, ")") 43 | 44 | coxme::coxme(as.formula(ff_formula(dependent, explanatory, random_effect)), data=.data) 45 | } 46 | -------------------------------------------------------------------------------- /R/coxphmulti.R: -------------------------------------------------------------------------------- 1 | #' Cox proprotional hazards multivariable models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces multivariable Cox 4 | #' Proportional Hazard regression models for a set of explanatory variables 5 | #' against a survival object. 6 | #' 7 | #' Uses \code{\link[survival]{coxph}} with \code{finalfit} modelling 8 | #' conventions. Output can be passed to \code{\link{fit2df}}. 9 | #' 10 | #' @param .data Data frame. 11 | #' @param dependent Character vector of length 1: name of survival object in 12 | #' form \code{Surv(time, status)}. 13 | #' @param explanatory Character vector of any length: name(s) of explanatory 14 | #' variables. 15 | #' @param ... Other arguments to pass to \code{\link[survival]{coxph}}. 16 | #' @return A multivariable \code{\link[survival]{coxph}} fitted model 17 | #' output. Output is of class \code{coxph}. 18 | #' 19 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 20 | #' @family finalfit model wrappers 21 | #' @export 22 | #' 23 | #' @examples 24 | #' # Cox Proportional Hazards multivariable analysis. 25 | #' library(finalfit) 26 | #' library(dplyr) 27 | #' 28 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 29 | #' dependent = "Surv(time, status)" 30 | #' colon_s %>% 31 | #' coxphmulti(dependent, explanatory) %>% 32 | #' fit2df() 33 | 34 | coxphmulti <- function(.data, dependent, explanatory, ...){ 35 | requireNamespace("survival") 36 | result = ff_eval( 37 | coxph(as.formula(paste0(dependent, "~", 38 | paste(explanatory, collapse="+"))), data=.data, ...) 39 | ) 40 | result$call$formula = formula(result) 41 | return(result) 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /R/coxphuni.R: -------------------------------------------------------------------------------- 1 | #' Cox proprotional hazards univariable models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces multiple univariable Cox Proportional Hazard 4 | #' regression models for a set of explanatory variables against a survival object. 5 | #' 6 | #' Uses \code{\link[survival]{coxph}} with \code{finalfit} modelling conventions. Output can be 7 | #' passed to \code{\link{fit2df}}. 8 | #' 9 | #' @param .data Data frame. 10 | #' @param dependent Character vector of length 1: name of survival object in form \code{Surv(time, status)}. 11 | #' @param explanatory Character vector of any length: name(s) of explanatory variables. 12 | #' @return A list of univariable \code{\link[survival]{coxph}} fitted model outputs. 13 | #' Output is of class \code{coxphlist}. 14 | #' 15 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 16 | #' @family finalfit model wrappers 17 | #' @export 18 | #' @import survival 19 | #' 20 | #' @examples 21 | #' # Cox Proportional Hazards univariable analysis. 22 | #' library(finalfit) 23 | #' library(dplyr) 24 | #' 25 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 26 | #' dependent = "Surv(time, status)" 27 | #' colon_s %>% 28 | #' coxphuni(dependent, explanatory) %>% 29 | #' fit2df() 30 | 31 | coxphuni <- function(.data, dependent, explanatory){ 32 | requireNamespace("survival") 33 | 34 | # Remove cluster and strata terms 35 | drop = grepl("cluster[(].*[)]", explanatory) | 36 | grepl("strata[(].*[)]", explanatory) | 37 | grepl("frailty[(].*[)]", explanatory) 38 | explanatory = explanatory[!drop] 39 | 40 | result <- list() 41 | for (i in 1:length(explanatory)){ 42 | result[[i]] <- coxph(as.formula(paste0(dependent, "~", explanatory[i])), data=.data) 43 | result[[i]]$call$formula <- formula(result[[i]]) 44 | } 45 | class(result) = "coxphlist" 46 | return(result) 47 | } 48 | -------------------------------------------------------------------------------- /R/crrmulti.R: -------------------------------------------------------------------------------- 1 | #' Competing risks multivariable regression: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces multivariable Competing Risks 4 | #' Regression models for a set of explanatory variables. 5 | #' 6 | #' Uses \code{\link[cmprsk]{crr}} with \code{finalfit} modelling conventions. 7 | #' Output can be passed to \code{\link{fit2df}}. 8 | #' 9 | #' @param .data Data frame or tibble. 10 | #' @param dependent Character vector of length 1: name of survival object in 11 | #' form \code{Surv(time, status)}. \code{Status} default values should be 0 12 | #' censored (e.g. alive), 1 event of interest (e.g. died of disease of 13 | #' interest), 2 competing event (e.g. died of other cause). 14 | #' @param explanatory Character vector of any length: name(s) of explanatory 15 | #' variables. 16 | #' @param ... Other arguments to \code{\link[cmprsk]{crr}} 17 | #' @return A multivariable \code{\link[cmprsk]{crr}} fitted model 18 | #' class \code{crr}. 19 | #' 20 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 21 | #' @family finalfit model wrappers 22 | #' @export 23 | #' 24 | #' @examples 25 | #' library(dplyr) 26 | #' melanoma = boot::melanoma 27 | #' melanoma = melanoma %>% 28 | #' mutate( 29 | #' # Cox PH to determine cause-specific hazards 30 | #' status_coxph = ifelse(status == 2, 0, # "still alive" 31 | #' ifelse(status == 1, 1, # "died of melanoma" 32 | #' 0)), # "died of other causes is censored" 33 | #' 34 | #' # Fine and Gray to determine subdistribution hazards 35 | #' status_crr = ifelse(status == 2, 0, # "still alive" 36 | #' ifelse(status == 1, 1, # "died of melanoma" 37 | #' 2)), # "died of other causes" 38 | #' sex = factor(sex), 39 | #' ulcer = factor(ulcer) 40 | #' ) 41 | #' 42 | #' dependent_coxph = c("Surv(time, status_coxph)") 43 | #' dependent_crr = c("Surv(time, status_crr)") 44 | #' explanatory = c("sex", "age", "ulcer") 45 | #' 46 | #' # Create single well-formatted table 47 | #' melanoma %>% 48 | #' summary_factorlist(dependent_crr, explanatory, column = TRUE, fit_id = TRUE) %>% 49 | #' ff_merge( 50 | #' melanoma %>% 51 | #' coxphmulti(dependent_coxph, explanatory) %>% 52 | #' fit2df(estimate_suffix = " (Cox PH multivariable)") 53 | #' ) %>% 54 | #' ff_merge( 55 | #' melanoma %>% 56 | #' crrmulti(dependent_crr, explanatory) %>% 57 | #' fit2df(estimate_suffix = " (competing risks multivariable)") 58 | #' ) %>% 59 | #' select(-fit_id, -index) %>% 60 | #' dependent_label(melanoma, dependent_crr) 61 | 62 | crrmulti <- function(.data, dependent, explanatory, ...){ 63 | result = list() 64 | 65 | # Keep survival object grammar, split into terms 66 | dependent = dependent %>% 67 | gsub("Surv\\(", "", .) %>% 68 | gsub("\\)", "", .) %>% 69 | strsplit(",") %>% 70 | unlist() %>% 71 | trimws() 72 | 73 | ftime = .data %>% 74 | dplyr::pull(dependent[1]) 75 | fstatus = .data %>% 76 | dplyr::pull(dependent[2]) 77 | 78 | cov1 = model.matrix(as.formula(paste0("~", paste0(explanatory, collapse = "+"))), .data)[,-1] 79 | 80 | result = cmprsk::crr(ftime, fstatus, cov1, ...) 81 | 82 | class(result) = "crr" 83 | return(result) 84 | } 85 | -------------------------------------------------------------------------------- /R/crruni.R: -------------------------------------------------------------------------------- 1 | #' Competing risks univariable regression: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces univariable Competing Risks 4 | #' Regression models for a set of explanatory variables. 5 | #' 6 | #' Uses \code{\link[cmprsk]{crr}} with \code{finalfit} modelling conventions. 7 | #' Output can be passed to \code{\link{fit2df}}. 8 | #' 9 | #' @param .data Data frame or tibble. 10 | #' @param dependent Character vector of length 1: name of survival object in 11 | #' form \code{Surv(time, status)}. \code{Status} default values should be 0 12 | #' censored (e.g. alive), 1 event of interest (e.g. died of disease of 13 | #' interest), 2 competing event (e.g. died of other cause). 14 | #' @param explanatory Character vector of any length: name(s) of explanatory 15 | #' variables. 16 | #' @param ... Other arguments to \code{\link[cmprsk]{crr}} 17 | #' @return A list of univariable \code{\link[cmprsk]{crr}} fitted models class 18 | #' \code{crrlist}. 19 | #' 20 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 21 | #' @family finalfit model wrappers 22 | #' @export 23 | #' 24 | #' @examples 25 | #' library(dplyr) 26 | #' melanoma = boot::melanoma 27 | #' melanoma = melanoma %>% 28 | #' mutate( 29 | #' # Cox PH to determine cause-specific hazards 30 | #' status_coxph = ifelse(status == 2, 0, # "still alive" 31 | #' ifelse(status == 1, 1, # "died of melanoma" 32 | #' 0)), # "died of other causes is censored" 33 | #' 34 | #' # Fine and Gray to determine subdistribution hazards 35 | #' status_crr = ifelse(status == 2, 0, # "still alive" 36 | #' ifelse(status == 1, 1, # "died of melanoma" 37 | #' 2)), # "died of other causes" 38 | #' sex = factor(sex), 39 | #' ulcer = factor(ulcer) 40 | #' ) 41 | #' 42 | #' dependent_coxph = c("Surv(time, status_coxph)") 43 | #' dependent_crr = c("Surv(time, status_crr)") 44 | #' explanatory = c("sex", "age", "ulcer") 45 | #' 46 | #' # Create single well-formatted table 47 | #' melanoma %>% 48 | #' summary_factorlist(dependent_crr, explanatory, column = TRUE, fit_id = TRUE) %>% 49 | #' ff_merge( 50 | #' melanoma %>% 51 | #' coxphmulti(dependent_coxph, explanatory) %>% 52 | #' fit2df(estimate_suffix = " (Cox PH multivariable)") 53 | #' ) %>% 54 | #' ff_merge( 55 | #' melanoma %>% 56 | #' crrmulti(dependent_crr, explanatory) %>% 57 | #' fit2df(estimate_suffix = " (competing risks multivariable)") 58 | #' ) %>% 59 | #' select(-fit_id, -index) %>% 60 | #' dependent_label(melanoma, dependent_crr) 61 | 62 | crruni <- function(.data, dependent, explanatory, ...){ 63 | result = list() 64 | 65 | # Keep survival object grammar, split into terms 66 | dependent = dependent %>% 67 | gsub("Surv\\(", "", .) %>% 68 | gsub("\\)", "", .) %>% 69 | strsplit(",") %>% 70 | unlist() %>% 71 | trimws() 72 | 73 | ftime = .data %>% 74 | dplyr::pull(dependent[1]) 75 | fstatus = .data %>% 76 | dplyr::pull(dependent[2]) 77 | 78 | for (i in 1:length(explanatory)){ 79 | cov1 = model.matrix(as.formula(paste0("~", explanatory[i])), .data)[,-1, drop = FALSE] 80 | result[[i]] = cmprsk::crr(ftime, fstatus, cov1, ...) 81 | } 82 | 83 | class(result) = "crrlist" 84 | return(result) 85 | } 86 | -------------------------------------------------------------------------------- /R/ff_interaction.R: -------------------------------------------------------------------------------- 1 | #' Make an interaction variable and add to dataframe 2 | #' 3 | #' Combine two factor variables to make an interaction variable. Factor level 4 | #' order is determined by the order in the variables themselves. Note, names of 5 | #' the factor variables should not be quoted. The name of the variable is 6 | #' created from the names of the two factors. The variable is also 7 | #' labelled with a name derived from any pre-existing labels. 8 | #' 9 | #' @param .data Data frame. 10 | #' @param ... The unquoted names of two factors. 11 | #' @param levels_sep Quoted character: how levels are separated in new variable. 12 | #' @param var_sep Quoted character: how variable name is separated. 13 | #' @param label_sep Quoted character: how variable label is separated 14 | #' 15 | #' @return Original data frame with new variable added via `dplyr::mutate`. 16 | #' @export 17 | #' 18 | #' @examples 19 | #' 20 | #' colon_s %>% 21 | #' ff_interaction(sex.factor, perfor.factor) %>% 22 | #' summary_factorlist("mort_5yr", "sex.factor_perfor.factor") 23 | 24 | ff_interaction = function(.data, ..., levels_sep = "_", var_sep = "_", label_sep=":"){ 25 | .f <- rlang::quos(...) 26 | .f_len <- length(.f) 27 | if(.f_len>2) stop("Currently only supports two factors.") 28 | .n <- purrr::map(.f, rlang::quo_name) %>% 29 | paste(collapse = var_sep) 30 | .l <- .data %>% dplyr::select(!!! .f) %>% 31 | purrr::map(levels) 32 | .l_length <- purrr::map(.l, length) 33 | .l <- paste0(rep(.l[[1]], each=.l_length[[2]]), levels_sep, rep(.l[[2]], .l_length[[1]])) 34 | .label <- .data %>% dplyr::select(!!! .f) %>% 35 | extract_variable_label() %>% paste(collapse=label_sep) 36 | df.out <- dplyr::mutate(.data, 37 | !! .n := paste(!!! .f, sep = levels_sep) %>% factor(levels=.l) %>% 38 | ff_label(variable_label=.label) 39 | ) 40 | return(df.out) 41 | } 42 | 43 | #' @rdname ff_interaction 44 | #' @export 45 | finalfit_interaction <- ff_interaction -------------------------------------------------------------------------------- /R/ff_plot.R: -------------------------------------------------------------------------------- 1 | #' Produce a table and plot 2 | #' 3 | #' Wraps \code{\link{or_plot}}, \code{\link{hr_plot}}, and 4 | #' \code{\link{coefficient_plot}} and sends to the appropriate method depending 5 | #' on the dependent variable type. 6 | #' @param .data Data frame. 7 | #' @param dependent Character vector of length 1. 8 | #' @param explanatory Character vector of any length: name(s) of explanatory 9 | #' variables. 10 | #' @param ... Pass arguments \code{\link{or_plot}}, \code{\link{hr_plot}}, or 11 | #' \code{\link{coefficient_plot}} 12 | #' 13 | #' @return A table and a plot using \code{ggplot2}. 14 | #' @export 15 | #' @family finalfit plot functions 16 | #' @examples 17 | #' # Coefficient plot 18 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 19 | #' dependent = "nodes" 20 | #' colon_s %>% 21 | #' ff_plot(dependent, explanatory) 22 | #' 23 | #' # Odds ratio plot 24 | #' dependent = "mort_5yr" 25 | #' colon_s %>% 26 | #' ff_plot(dependent, explanatory) 27 | #' 28 | #' # Hazard ratio plot 29 | #' dependent = "Surv(time, status)" 30 | #' colon_s %>% 31 | #' ff_plot(dependent, explanatory, dependent_label = "Survival") 32 | ff_plot <- function(.data, dependent, explanatory, ...){ 33 | if(is.data.frame(.data)==FALSE) stop(".data is not dataframe") 34 | if(is.null(explanatory)) stop("No explanatory variable(s) provided") 35 | if(is.null(dependent)) stop("No dependent variable provided") 36 | 37 | # Args 38 | args = list(.data, dependent, explanatory, ...) 39 | 40 | # What is dependent variable 41 | d_variable = .data[,names(.data) %in% dependent] 42 | if(is.survival(dependent)){ 43 | d_type = "survival" 44 | }else{ 45 | d_type = variable_type(d_variable) 46 | } 47 | # Send to method 48 | if (d_type == "survival"){ 49 | do.call(hr_plot, args) 50 | } else if (d_type == "factor" || d_type == "character" || d_type == "logical"){ 51 | do.call(or_plot, args) 52 | } else if (d_type == "numeric"){ 53 | do.call(coefficient_plot, args) 54 | } else { 55 | stop("Plotting not support for this dependent variable type") 56 | } 57 | } 58 | 59 | #' @rdname ff_plot 60 | #' @export 61 | finalfit_plot = ff_plot 62 | -------------------------------------------------------------------------------- /R/glmmixed.R: -------------------------------------------------------------------------------- 1 | #' Mixed effects binomial logistic regression models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces mixed effects binomial logistic 4 | #' regression models for a set of explanatory variables against a binary dependent. 5 | #' 6 | #' Uses \code{lme4::\link[lme4]{glmer}} with \code{finalfit} modelling conventions. Output can be 7 | #' passed to \code{\link{fit2df}}. This is only currently set-up to take a single random effect 8 | #' as a random intercept. Can be updated in future to allow multiple random intercepts, 9 | #' random gradients and interactions on random effects if there is a need 10 | #' 11 | #' @param .data Dataframe. 12 | #' @param dependent Character vector of length 1, name of depdendent variable (must have 2 levels). 13 | #' @param explanatory Character vector of any length: name(s) of explanatory variables. 14 | #' @param random_effect Character vector of length 1, either, (1) name of random 15 | #' intercept variable, e.g. "var1", (automatically convered to "(1 | var1)"); 16 | #' or, (2) the full \code{lme4} specification, e.g. "(var1 | var2)". Note 17 | #' parenthesis MUST be included in (2) but NOT included in (1). 18 | #' @param ... Other arguments to pass to \code{lme4::\link[lme4]{glmer}}. 19 | #' @return A list of multivariable \code{lme4::\link[lme4]{glmer}} fitted model outputs. 20 | #' Output is of class \code{glmerMod}. 21 | #' 22 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 23 | #' @family finalfit model wrappers 24 | #' @export 25 | #' 26 | #' @examples 27 | #' library(finalfit) 28 | #' library(dplyr) 29 | #' 30 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 31 | #' random_effect = "hospital" 32 | #' dependent = "mort_5yr" 33 | #' 34 | #' colon_s %>% 35 | #' glmmixed(dependent, explanatory, random_effect) %>% 36 | #' fit2df(estimate_suffix=" (multilevel)") 37 | 38 | glmmixed <- function(.data, dependent, explanatory, random_effect, ...){ 39 | # If single term random effect, default to random intercept model 40 | if(!grepl("\\|", random_effect)) random_effect = paste0("(1 | ", random_effect, ")") 41 | lme4::glmer(paste0(dependent, "~", paste(explanatory, collapse="+"), " + ", random_effect), 42 | data=.data, family="binomial", control=lme4::glmerControl(optimizer="bobyqa", 43 | optCtrl=list(maxfun=200000)), ...) 44 | } 45 | -------------------------------------------------------------------------------- /R/glmmulti.R: -------------------------------------------------------------------------------- 1 | #' Binomial logistic regression multivariable models: \code{finalfit} model 2 | #' wrapper 3 | #' 4 | #' Using \code{finalfit} conventions, produces a multivariable binomial 5 | #' logistic regression model for a set of explanatory variables against a 6 | #' binary dependent. 7 | #' 8 | #' Uses \code{\link[stats]{glm}} with \code{finalfit} modelling conventions. 9 | #' Output can be passed to \code{\link{fit2df}}. 10 | #' 11 | #' @param .data Data frame. 12 | #' @param dependent Character vector of length 1: name of dependent variable 13 | #' (must have 2 levels). 14 | #' @param explanatory Character vector of any length: name(s) of explanatory 15 | #' variables. 16 | #' @param family Character vector quoted or unquoted of the error distribution 17 | #' and link function to be used in the model, see \code{\link[stats]{glm}}. 18 | #' @param weights Character vector of length 1: name of variabe for weighting. 19 | #' 'Prior weights' to be used in the fitting process. 20 | #' @param ... Other arguments to pass to \code{\link[stats]{glm}}. 21 | #' @return A multivariable \code{\link[stats]{glm}} fitted model. 22 | #' 23 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 24 | #' @family finalfit model wrappers 25 | #' @export 26 | #' 27 | #' @examples 28 | #' library(finalfit) 29 | #' library(dplyr) 30 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 31 | #' dependent = "mort_5yr" 32 | #' 33 | #' colon_s %>% 34 | #' glmmulti(dependent, explanatory) %>% 35 | #' fit2df(estimate_suffix=" (multivariable)") 36 | #' 37 | glmmulti <- function(.data, dependent, explanatory, family = "binomial", weights = "", ...){ 38 | result = ff_eval( 39 | glm(ff_formula(dependent, explanatory), 40 | data = .data, family = family, weights = !!sym(weights), ...) 41 | ) 42 | result$call$formula = formula(result) 43 | return(result) 44 | } 45 | -------------------------------------------------------------------------------- /R/glmmultiboot.R: -------------------------------------------------------------------------------- 1 | #' Binomial logistic regression multivariable models with bootstrapped 2 | #' confidence intervals: \code{finalfit} model wrapper 3 | #' 4 | #' Using \code{finalfit} conventions, produces a multivariable binomial logistic 5 | #' regression models for a set of explanatory variables against a binary 6 | #' dependent. 7 | #' 8 | #' Uses \code{\link[stats]{glm}} with \code{finalfit} modelling conventions. 9 | #' \code{boot::\link[boot]{boot}} is used to draw bootstrapped confidence 10 | #' intervals on fixed effect model coefficients. Output can be passed to 11 | #' \code{\link{fit2df}}. 12 | #' 13 | #' @param .data Dataframe. 14 | #' @param dependent Character vector length 1: name of depdendent variable 15 | #' (must have 2 levels). 16 | #' @param explanatory Character vector of any length: name(s) of explanatory 17 | #' variables. 18 | #' @param R Number of draws. 19 | #' @return A multivariable \code{\link[stats]{glm}} fitted model with 20 | #' bootstrapped confidence intervals. Output is of class \code{glmboot}. 21 | #' 22 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 23 | #' @family finalfit model wrappers 24 | #' @export 25 | #' 26 | #' @examples 27 | #' library(finalfit) 28 | #' library(dplyr) 29 | #' ## Note number of draws set to 100 just for speed in this example 30 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 31 | #' dependent = "mort_5yr" 32 | #' 33 | #' colon_s %>% 34 | #' glmmulti_boot(dependent, explanatory, R=100) %>% 35 | #' fit2df(estimate_suffix="(multivariable (BS CIs))") 36 | #' 37 | 38 | glmmulti_boot <- function(.data, dependent, explanatory, R=1000){ 39 | formula <- paste(dependent, "~", paste(explanatory, collapse="+")) 40 | # function to get coefficients 41 | ci <- function(formula, data, indices) { 42 | d <- data[indices,] 43 | fit <- glm(formula, family="binomial", data=d) 44 | return(fit$coefficients) 45 | } 46 | bs.out <- boot::boot(data=.data, statistic=ci, 47 | R=R, formula=formula) 48 | class(bs.out) = "glmboot" 49 | return(bs.out) 50 | } 51 | -------------------------------------------------------------------------------- /R/glmuni.R: -------------------------------------------------------------------------------- 1 | #' Binomial logistic regression univariable models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces multiple univariable binomial logistic 4 | #' regression models for a set of explanatory variables against a binary dependent. 5 | #' 6 | #' Uses \code{\link[stats]{glm}} with \code{finalfit} modelling conventions. Output can be 7 | #' passed to \code{\link{fit2df}}. 8 | #' 9 | #' @param .data Data frame. 10 | #' @param dependent Character vector of length 1: name of depdendent variable (must have 2 levels). 11 | #' @param explanatory Character vector of any length: name(s) of explanatory variables. 12 | #' @param family Character vector quoted or unquoted of the error distribution 13 | #' and link function to be used in the model, see \code{\link[stats]{glm}}. 14 | #' @param weights Character vector of length 1: name of variabe for weighting. 15 | #' 'Prior weights' to be used in the fitting process. 16 | #' @param ... Other arguments to pass to \code{\link[stats]{glm}}. 17 | #' @return A list of univariable \code{\link[stats]{glm}} fitted model outputs. 18 | #' Output is of class \code{glmlist}. 19 | #' 20 | #' @seealso \code{\link{fit2df}, \link{finalfit_merge}} 21 | #' @family finalfit model wrappers 22 | #' @export 23 | #' 24 | #' @examples 25 | #' library(finalfit) 26 | #' library(dplyr) 27 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 28 | #' dependent = "mort_5yr" 29 | #' 30 | #' colon_s %>% 31 | #' glmuni(dependent, explanatory) %>% 32 | #' fit2df(estimate_suffix=" (univariable)") 33 | #' 34 | #' 35 | glmuni <- function(.data, dependent, explanatory, family = "binomial", weights = "", ...){ 36 | result <- list() 37 | for (i in 1:length(explanatory)){ 38 | result[[i]] <- ff_eval( 39 | glm(ff_formula(dependent, explanatory[i]), data = .data, family = family, 40 | weights = !!sym(weights), ...) 41 | ) 42 | result[[i]]$call$formula <- formula(result[[i]]) 43 | } 44 | class(result) = "glmlist" 45 | return(result) 46 | } 47 | -------------------------------------------------------------------------------- /R/lmmixed.R: -------------------------------------------------------------------------------- 1 | #' Mixed effects linear regression models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces mixed effects linear regression 4 | #' models for a set of explanatory variables against a continuous dependent. 5 | #' 6 | #' Uses \code{lme4::\link[lme4]{lmer}} with \code{finalfit} modelling 7 | #' conventions. Output can be passed to \code{\link{fit2df}}. This is only 8 | #' currently set-up to take a single random effect as a random intercept. Can be 9 | #' updated in future to allow multiple random intercepts, random gradients and 10 | #' interactions on random effects if there is a need. 11 | #' 12 | #' @param .data Dataframe. 13 | #' @param dependent Character vector of length 1, name of depdendent variable 14 | #' (must be continuous vector). 15 | #' @param explanatory Character vector of any length: name(s) of explanatory 16 | #' variables. 17 | #' @param random_effect Character vector of length 1, either, (1) name of random 18 | #' intercept variable, e.g. "var1", (automatically convered to "(1 | var1)"); 19 | #' or, (2) the full \code{lme4} specification, e.g. "(var1 | var2)". Note 20 | #' parenthesis MUST be included in (2)2 but NOT included in (1). 21 | #' @param ... Other arguments to pass to \code{lme4::\link[lme4]{lmer}}. 22 | #' @return A list of multivariable \code{lme4::\link[lme4]{lmer}} fitted model 23 | #' outputs. Output is of class \code{lmerMod}. 24 | #' 25 | #' @seealso \code{\link{fit2df}} 26 | #' @family finalfit model wrappers 27 | #' @export 28 | #' 29 | #' @examples 30 | #' library(finalfit) 31 | #' library(dplyr) 32 | #' 33 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 34 | #' random_effect = "hospital" 35 | #' dependent = "nodes" 36 | #' 37 | #' colon_s %>% 38 | #' lmmixed(dependent, explanatory, random_effect) %>% 39 | #' fit2df(estimate_suffix=" (multilevel") 40 | 41 | lmmixed <- function(.data, dependent, explanatory, random_effect, ...){ 42 | # If single term random effect, default to random intercept model 43 | if(!grepl("\\|", random_effect)) random_effect = paste0("(1 | ", random_effect, ")") 44 | lme4::lmer(paste0(dependent, "~", paste(explanatory, collapse="+"), " + ", random_effect), 45 | data = .data, ...) 46 | } 47 | -------------------------------------------------------------------------------- /R/lmmulti.R: -------------------------------------------------------------------------------- 1 | #' Linear regression multivariable models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces a multivariable linear regression 4 | #' model for a set of explanatory variables against a continuous dependent. 5 | #' 6 | #' Uses \code{\link[stats]{lm}} with \code{finalfit} modelling conventions. 7 | #' Output can be passed to \code{\link{fit2df}}. 8 | #' 9 | #' @param .data Dataframe. 10 | #' @param dependent Character vector of length 1: name of depdendent variable 11 | #' (must a continuous vector). 12 | #' @param explanatory Character vector of any length: name(s) of explanatory 13 | #' variables. 14 | #' @param weights Character vector of length 1: name of variabe for weighting. 15 | #' 'Prior weights' to be used in the fitting process. 16 | #' @param ... Other arguments to pass to \code{\link[stats]{lm}}. 17 | #' @return A multivariable \code{\link[stats]{lm}} fitted model. 18 | #' 19 | #' @seealso \code{\link{fit2df}} 20 | #' @family finalfit model wrappers 21 | #' @export 22 | #' 23 | #' @examples 24 | #' library(finalfit) 25 | #' library(dplyr) 26 | #' 27 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 28 | #' dependent = "nodes" 29 | #' 30 | #' colon_s %>% 31 | #' lmmulti(dependent, explanatory) %>% 32 | #' fit2df() 33 | #' 34 | lmmulti <- function(.data, dependent, explanatory, weights = "", ...){ 35 | result = ff_eval( 36 | lm(ff_formula(dependent, explanatory), data = .data, weights = !!sym(weights), ...) 37 | ) 38 | result$call$formula = formula(result) 39 | return(result) 40 | } 41 | -------------------------------------------------------------------------------- /R/lmuni.R: -------------------------------------------------------------------------------- 1 | #' Linear regression univariable models: \code{finalfit} model wrapper 2 | #' 3 | #' Using \code{finalfit} conventions, produces multiple univariable linear 4 | #' regression models for a set of explanatory variables against a continuous dependent. 5 | #' 6 | #' Uses \code{\link[stats]{lm}} with \code{finalfit} modelling conventions. Output can be 7 | #' passed to \code{\link{fit2df}}. 8 | #' 9 | #' @param .data Dataframe. 10 | #' @param dependent Character vector of length 1, name of depdendent variable (must be continuous vector). 11 | #' @param explanatory Character vector of any length: name(s) of explanatory variables. 12 | #' @param weights Character vector of length 1: name of variabe for weighting. 13 | #' 'Prior weights' to be used in the fitting process. 14 | #' @param ... Other arguments to pass to \code{\link[stats]{lm}}. 15 | #' @return A list of multivariable \code{\link[stats]{lm}} fitted model outputs. 16 | #' Output is of class \code{lmlist}. 17 | #' 18 | #' @seealso \code{\link{fit2df}} 19 | #' @family finalfit model wrappers 20 | #' @export 21 | #' 22 | #' @examples 23 | #' library(finalfit) 24 | #' library(dplyr) 25 | #' 26 | #' explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 27 | #' dependent = "nodes" 28 | #' 29 | #' colon_s %>% 30 | #' lmuni(dependent, explanatory) %>% 31 | #' fit2df() 32 | #' 33 | lmuni <- function(.data, dependent, explanatory, weights = "", ...){ 34 | result <- list() 35 | for (i in 1:length(explanatory)){ 36 | result[[i]] <- ff_eval( 37 | lm(ff_formula(dependent, explanatory[i]), weights = !!sym(weights), data = .data, ...) 38 | ) 39 | result[[i]]$call$formula <- formula(result[[i]]) 40 | } 41 | class(result) = "lmlist" 42 | return(result) 43 | } 44 | -------------------------------------------------------------------------------- /R/metrics_hoslem.R: -------------------------------------------------------------------------------- 1 | #' Hosmer-Lemeshow goodness of fit test 2 | #' 3 | #' Internal, not usually called directly 4 | #' 5 | #' @param y Observed y, usually of the form \code{fit$y}. 6 | #' @param yhat Predicted y_hat, usually for the form \code{fit$fitted} 7 | #' @param g Number of bins to calculate quantiles. 8 | #' @param digits Number of decimal places of form \code{c(2,3)}, where \code{digits[1]} is 9 | #' for chi-sq estimate and \code{digits[2]} is for p-value. 10 | #' 11 | #' @return Character string of chi-sq result, df, and p-value. Significant 12 | #' p-value suggests poor fit. 13 | #' @export 14 | #' @importFrom stats pchisq xtabs 15 | #' 16 | #' @author Adapted from Peter Solymos. 17 | #' @source https://github.com/psolymos/ResourceSelection/blob/master/R/hoslem.test.R 18 | #' 19 | #' @examples 20 | #' fit = glm(mort_5yr~age.factor+extent.factor, data=colon_s, family="binomial") 21 | #' metrics_hoslem(fit$y, fit$fitted) 22 | metrics_hoslem <- function(y, yhat, g=10, digits = c(2,3)) { 23 | qq <- unique(quantile(yhat, probs=seq(0, 1, 1/g))) 24 | yhat_cut <- cut(yhat, breaks = qq, include.lowest = TRUE) 25 | observed <- xtabs(cbind("y0" = 1-y, "y1" = y) ~ yhat_cut) 26 | expected <- xtabs(cbind("yhat0" = 1-yhat, "yhat1" = yhat) ~ yhat_cut) 27 | chisq <- sum((observed - expected)^2 / expected) 28 | p = 1 - pchisq(chisq, g-2) 29 | par <- g-2 30 | out = paste0("Chi-sq(", par, ") ", round_tidy(chisq, digits = digits[1]), " (p", p_tidy(p, digits = digits[2]), ")") 31 | return(out) 32 | } 33 | -------------------------------------------------------------------------------- /R/missing_compare.R: -------------------------------------------------------------------------------- 1 | #' Compare missing data 2 | #' 3 | #' @param .data Dataframe. 4 | #' @param dependent Variable to test missingness against other variables with. 5 | #' @param explanatory Variables to have missingness tested against. 6 | #' @param p Logical: Include null hypothesis statistical test. 7 | #' @param na_include Include missing data in explanatory variables as a factor 8 | #' level. 9 | #' @param ... Other arguments to \code{\link{summary_factorlist}()}. 10 | #' 11 | #' @return A dataframe comparing missing data in the dependent variable across 12 | #' explanatory variables. Continuous data are compared with an Analysis of Variance F-test by default. 13 | #' Discrete data are compared with a chi-squared test. 14 | #' @export 15 | #' 16 | #' @examples 17 | #' library(finalfit) 18 | #' 19 | #' explanatory = c("age", "age.factor", "extent.factor", "perfor.factor") 20 | #' dependent = "mort_5yr" 21 | #' 22 | #' colon_s %>% 23 | #' ff_glimpse(dependent, explanatory) 24 | #' 25 | #' colon_s %>% 26 | #' missing_pattern(dependent, explanatory) 27 | #' 28 | #' colon_s %>% 29 | #' missing_compare(dependent, explanatory) 30 | 31 | missing_compare <- function(.data, dependent, explanatory, p = TRUE, na_include = FALSE, ...){ 32 | if(length(dependent) != 1){ 33 | stop("One and only one dependent variable must be provided") 34 | } 35 | 36 | df.out = .data %>% 37 | dplyr::mutate( 38 | !! rlang::sym(dependent) := dplyr::case_when( 39 | !is.na(!! rlang::sym(dependent)) ~ "Not missing", 40 | is.na(!! rlang::sym(dependent)) ~ "Missing" 41 | ) %>% 42 | factor(levels = c("Not missing", "Missing")) 43 | ) %>% 44 | ff_relabel_df(.data) 45 | 46 | args = list(.data=df.out, dependent=dependent, explanatory=explanatory, p = TRUE, 47 | na_include = na_include, ...) 48 | if(is.null(args$column)) args$column = FALSE 49 | if(is.null(args$add_dependent_label)) args$add_dependent_label = TRUE 50 | if(is.null(args$dependent_label_prefix)) args$dependent_label_prefix = "Missing data analysis: " 51 | 52 | do.call(summary_factorlist, args) 53 | } 54 | -------------------------------------------------------------------------------- /R/missing_glimpse.R: -------------------------------------------------------------------------------- 1 | #' Summary of missing values 2 | #' 3 | #' @param .data Data frame. 4 | #' @param dependent Optional character vector: name(s) of depdendent 5 | #' variable(s). 6 | #' @param explanatory Optional character vector: name(s) of explanatory 7 | #' variable(s). 8 | #' @param digits Number of decmial places to show for percentage missing. 9 | #' 10 | #' @return Data frame. 11 | #' @export 12 | #' 13 | #' @importFrom pillar new_pillar_type 14 | #' 15 | #' @examples 16 | #' colon_s %>% 17 | #' missing_glimpse() 18 | missing_glimpse <- function(.data, dependent=NULL, explanatory=NULL, digits = 1){ 19 | if(is.null(dependent) && is.null(explanatory)){ 20 | df.in = .data 21 | }else{ 22 | keep = names(.data) %in% c(dependent, explanatory) 23 | df.in = .data[keep] 24 | } 25 | 26 | df.in %>% 27 | purrr::map_df(function(x){ 28 | var_type = pillar::new_pillar_type(x) %>% paste0("<", ., ">") 29 | obs = length(x) 30 | missing_n = sum(is.na(x)) 31 | n = obs-missing_n 32 | missing_percent = round_tidy(100*missing_n/obs, digits=digits) 33 | tibble::tibble(var_type, n, missing_n, missing_percent) 34 | }) -> df.out1 35 | 36 | df.in %>% 37 | extract_variable_label() %>% 38 | data.frame(label=.) -> df.out2 39 | 40 | df.out = data.frame(df.out2, df.out1) 41 | return(df.out) 42 | } 43 | -------------------------------------------------------------------------------- /R/surv_plot.R: -------------------------------------------------------------------------------- 1 | #' Plot survival curves with number-at-risk table 2 | #' 3 | #' Produce a survival curve plot and number-at-risk table using \code{survminer::ggsurvplot} 4 | #' and \code{finalfit} conventions. 5 | #' 6 | #' @param .data Dataframe. 7 | #' @param dependent Character vector of length 1: Survival object of the form \code{Surv(time, status)}. 8 | #' @param explanatory Character vector of max length 2: quoted name(s) of explanatory variables. 9 | #' @param ... Arguments passed to \code{\link[survminer]{ggsurvplot}}. 10 | #' @return Returns a table and plot produced in \code{ggplot2}. 11 | #' 12 | #' @family finalfit plot functions 13 | #' @export 14 | #' @import ggplot2 15 | #' 16 | #' @examples 17 | #' library(finalfit) 18 | #' library(dplyr) 19 | #' 20 | #' # Survival plot 21 | #' data(colon_s) 22 | #' explanatory = c("perfor.factor") 23 | #' dependent = "Surv(time, status)" 24 | #' colon_s %>% 25 | #' surv_plot(dependent, explanatory, xlab="Time (days)", pval=TRUE, legend="none") 26 | #' 27 | surv_plot = function(.data, dependent, explanatory, ...){ 28 | if(length(explanatory)>2){ 29 | stop("Explanatory must have a maximum of two variables") 30 | } 31 | 32 | args = list(...) 33 | .formula = as.formula(paste0(dependent, "~", paste(explanatory, collapse="+"))) 34 | args$fit = substitute(survival::survfit(.formula, data=.data), list(.formula=.formula)) 35 | args$data=.data 36 | 37 | # Defaults which can be modified via ... 38 | if (is.null(args$xlab)) args$xlab="Time" 39 | if (is.null(args$ylab)) args$ylab="Probability" 40 | if (is.null(args$censor)) args$censor=FALSE 41 | if (is.null(args$conf.int)) args$conf.int=FALSE 42 | if (is.null(args$risk.table)) args$risk.table=TRUE 43 | if (is.null(args$linetype)) args$linetype="strata" 44 | if (is.null(args$palette)) args$palette="lancet" 45 | if (is.null(args$legend.title)) args$legend.title="" 46 | if (is.null(args$font.x)) args$font.x=14 47 | if (is.null(args$font.y)) args$font.y=14 48 | if (is.null(args$font.tickslab)) args$font.tickslab=12 49 | if (is.null(args$ggtheme)) args$ggtheme=theme_classic() 50 | 51 | ggsurv = do.call( 52 | survminer::ggsurvplot, args 53 | ) 54 | ggsurv$table = ggsurv$table + survminer::theme_cleantable() 55 | return(ggsurv) 56 | } 57 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /_pkgdown.yml: -------------------------------------------------------------------------------- 1 | reference: 2 | - title: "All-in-one functions" 3 | desc: "Single functions to generate final output tables" 4 | contents: 5 | - '`finalfit`' 6 | - '`finalfit_permute`' 7 | - '`summary_factorlist`' 8 | - '`summary_factorlist_stratified`' 9 | - title: "Model wrappers" 10 | desc: "Wrappers for common statistical models" 11 | contents: 12 | - '`lmuni`' 13 | - '`lmmulti`' 14 | - '`lmmixed`' 15 | - '`glmuni`' 16 | - '`glmmulti`' 17 | - '`glmmulti_boot`' 18 | - '`glmmixed`' 19 | - '`coxphuni`' 20 | - '`coxphmulti`' 21 | - '`crruni`' 22 | - '`crrmulti`' 23 | - '`svyglmuni`' 24 | - '`svyglmmulti`' 25 | - title: "Bootstrap functions" 26 | desc: "Bootstrap simulation for model prediction" 27 | contents: 28 | - '`boot_predict`' 29 | - '`boot_compare`' 30 | - '`ff_newdata`' 31 | - '`ff_expand`' 32 | - title: "Helper functions" 33 | desc: ~ 34 | contents: 35 | - '`fit2df`' 36 | - '`ff_column_totals`' 37 | - '`ff_row_totals`' 38 | - '`ff_formula`' 39 | - '`ff_glimpse`' 40 | - '`ff_interaction`' 41 | - '`ff_mode`' 42 | - '`ff_label`' 43 | - '`ff_merge`' 44 | - '`ff_metrics`' 45 | - '`ff_percent_only`' 46 | - '`ff_parse_formula`' 47 | - '`ff_relabel`' 48 | - '`ff_relabel_df`' 49 | - '`ff_remove_ref`' 50 | - '`ff_remove_p`' 51 | - '`ff_stratify_helper`' 52 | - '`check_recode`' 53 | - '`dependent_label`' 54 | - '`extract_variable_label`' 55 | - '`format_n_percent`' 56 | - '`labels_to_column`' 57 | - '`labels_to_level`' 58 | - '`p_tidy`' 59 | - '`rm_duplicates`' 60 | - '`rm_empty_block`' 61 | - '`round_tidy`' 62 | - '`summary_df`' 63 | - title: "Plotting" 64 | desc: ~ 65 | contents: 66 | - '`or_plot`' 67 | - '`hr_plot`' 68 | - '`coefficient_plot`' 69 | - '`ff_plot`' 70 | - '`surv_plot`' 71 | - '`missing_plot`' 72 | - '`missing_pairs`' 73 | - title: "Missing data functions" 74 | desc: ~ 75 | contents: 76 | - '`missing_glimpse`' 77 | - '`missing_pattern`' 78 | - '`missing_compare`' 79 | - '`missing_pairs`' 80 | - '`missing_plot`' 81 | - '`missing_predictorMatrix`' 82 | - title: "Metrics" 83 | desc: ~ 84 | contents: 85 | - '`metrics_hoslem`' 86 | - title: "Data" 87 | desc: "Sample data for examples and testing" 88 | contents: 89 | - '`colon_s`' 90 | - '`wcgs`' 91 | - title: "Misc" 92 | desc: ~ 93 | contents: 94 | - '`finalfit-package`' 95 | 96 | figures: 97 | dev: ragg::agg_png 98 | dpi: 300 99 | dev.args: [] 100 | fig.ext: png 101 | fig.width: 7.2916667 102 | fig.height: ~ 103 | fig.retina: 2 104 | fig.asp: 1.618 105 | bg: NA 106 | other.parameters: [] 107 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # DO NOT CHANGE the "init" and "install" sections below 2 | 3 | # Download script file from GitHub 4 | init: 5 | ps: | 6 | $ErrorActionPreference = "Stop" 7 | Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" 8 | Import-Module '..\appveyor-tool.ps1' 9 | 10 | install: 11 | ps: Bootstrap 12 | 13 | # Adapt as necessary starting from here 14 | 15 | environment: 16 | global: 17 | USE_RTOOLS: true 18 | 19 | build_script: 20 | - travis-tool.sh install_deps 21 | 22 | test_script: 23 | - travis-tool.sh run_tests 24 | 25 | on_failure: 26 | - 7z a failure.zip *.Rcheck\* 27 | - appveyor PushArtifact failure.zip 28 | 29 | artifacts: 30 | - path: '*.Rcheck\**\*.log' 31 | name: Logs 32 | 33 | - path: '*.Rcheck\**\*.out' 34 | name: Logs 35 | 36 | - path: '*.Rcheck\**\*.fail' 37 | name: Logs 38 | 39 | - path: '*.Rcheck\**\*.Rout' 40 | name: Logs 41 | 42 | - path: '\*_*.tar.gz' 43 | name: Bits 44 | 45 | - path: '\*_*.zip' 46 | name: Bits 47 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | patch: 10 | default: 11 | target: auto 12 | threshold: 1% 13 | -------------------------------------------------------------------------------- /data-raw/random_hopsital.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/data-raw/random_hopsital.rda -------------------------------------------------------------------------------- /data-raw/wcgs.R: -------------------------------------------------------------------------------- 1 | library(epitools) 2 | library(dplyr) 3 | library(forcats) 4 | 5 | data(wcgs) 6 | save(wcgs, file = "data-raw/wcgs.rda", compress = TRUE) 7 | 8 | library(finalfit) 9 | wcgs = wcgs %>% 10 | rename( 11 | age = age0, 12 | height = height0, 13 | weight = weight0, 14 | sbp = sbp0, 15 | dbp = dbp0, 16 | chol = chol0, 17 | personality = behpat0, 18 | personality_2L = dibpat0, 19 | ncigs = ncigs0, 20 | chd = chd69, 21 | timechd = time169, 22 | arcus = arcus0 23 | ) %>% 24 | mutate( 25 | smoking = if_else(ncigs == 0, "Non-smoker", "Smoker") %>% 26 | factor(), 27 | personality = factor(personality) %>% 28 | fct_recode( 29 | "A1" = "1", 30 | "A2" = "2", 31 | "B3" = "3", 32 | "B4" = "4"), 33 | personality_2L = factor(personality_2L) %>% 34 | fct_recode( 35 | "A" = "1", 36 | "B" = "0" 37 | ), 38 | chd = factor(chd) %>% 39 | fct_recode( 40 | "No" = "0", 41 | "Yes" = "1"), 42 | typechd = factor(typechd) %>% 43 | fct_recode( 44 | "No" = "0", 45 | "MI_SD" = "1", 46 | "Silent_MI" = "2", 47 | "Angina" = "3" 48 | ), 49 | arcus = factor(arcus) %>% 50 | fct_recode( 51 | "No" = "0", 52 | "Yes" = "1"), 53 | ) %>% 54 | # Labels 55 | mutate( 56 | id = ff_label(id, "Subject ID"), 57 | age = ff_label(age, "Age (years)"), 58 | height = ff_label(height, "Height (inches)"), 59 | weight = ff_label(weight, "Weight (pounds)"), 60 | sbp = ff_label(sbp, "Systolic BP (mmHg)"), 61 | dbp = ff_label(dbp, "Diastolic BP (mmHg)"), 62 | chol = ff_label(chol, "Cholesterol (mg/100 ml)"), 63 | personality = ff_label(personality, "Personality type"), 64 | personality_2L = ff_label(personality_2L, "Personality type"), 65 | ncigs = ff_label(ncigs, "Cigarettes/day"), 66 | smoking = ff_label(smoking, "Smoking"), 67 | arcus = ff_label(arcus, "Corneal arcus"), 68 | chd = ff_label(chd, "CHD event"), 69 | typechd = ff_label(typechd, "Type CHD"), 70 | timechd = ff_label(timechd, "Time to CHD event") 71 | ) %>% 72 | select( 73 | id, age, 74 | height, weight, 75 | sbp, dbp, 76 | chol, 77 | personality, personality_2L, 78 | ncigs, smoking, 79 | arcus, 80 | chd, typechd, timechd) 81 | 82 | save(wcgs, file = "data/wcgs.rda", compress = TRUE) 83 | -------------------------------------------------------------------------------- /data-raw/wcgs.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/data-raw/wcgs.rda -------------------------------------------------------------------------------- /data/colon_s.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/data/colon_s.rda -------------------------------------------------------------------------------- /data/wcgs.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/data/wcgs.rda -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | finalfit.org 2 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-16-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-16-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-17-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-17-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plot_examples_files/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-11-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-11-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-13-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-13-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-16-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-16-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-17-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-17-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-18-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-18-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-19-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-19-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-20-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-20-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-21-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-21-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-22-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-22-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-23-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-23-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-24-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-24-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-25-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-25-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-4-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-4-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-5-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-5-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-7-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-7-2.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-7-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-7-3.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-9-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/all_plots_examples_files/figure-html/unnamed-chunk-9-1.png -------------------------------------------------------------------------------- /docs/articles/all_tables_examples_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/bootstrap_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/data_prep_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/export_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/export_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/export_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/articles/finalfit_basics_files/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/finalfit_basics_files/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /docs/articles/finalfit_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/finalfit_files/figure-html/unnamed-chunk-15-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/finalfit_files/figure-html/unnamed-chunk-15-1.png -------------------------------------------------------------------------------- /docs/articles/missing_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/missing_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/missing_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/missing_files/figure-html/unnamed-chunk-6-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/missing_files/figure-html/unnamed-chunk-6-1.png -------------------------------------------------------------------------------- /docs/articles/survival_files/accessible-code-block-0.0.1/empty-anchor.js: -------------------------------------------------------------------------------- 1 | // Hide empty tag within highlighted CodeBlock for screen reader accessibility (see https://github.com/jgm/pandoc/issues/6352#issuecomment-626106786) --> 2 | // v0.0.1 3 | // Written by JooYoung Seo (jooyoung@psu.edu) and Atsushi Yasumoto on June 1st, 2020. 4 | 5 | document.addEventListener('DOMContentLoaded', function() { 6 | const codeList = document.getElementsByClassName("sourceCode"); 7 | for (var i = 0; i < codeList.length; i++) { 8 | var linkList = codeList[i].getElementsByTagName('a'); 9 | for (var j = 0; j < linkList.length; j++) { 10 | if (linkList[j].innerHTML === "") { 11 | linkList[j].setAttribute('aria-hidden', 'true'); 12 | } 13 | } 14 | } 15 | }); 16 | -------------------------------------------------------------------------------- /docs/articles/survival_files/figure-html/unnamed-chunk-10-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/survival_files/figure-html/unnamed-chunk-10-1.png -------------------------------------------------------------------------------- /docs/articles/survival_files/figure-html/unnamed-chunk-12-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/survival_files/figure-html/unnamed-chunk-12-1.png -------------------------------------------------------------------------------- /docs/articles/survival_files/figure-html/unnamed-chunk-14-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/survival_files/figure-html/unnamed-chunk-14-1.png -------------------------------------------------------------------------------- /docs/articles/survival_files/figure-html/unnamed-chunk-17-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/survival_files/figure-html/unnamed-chunk-17-1.png -------------------------------------------------------------------------------- /docs/articles/survival_files/figure-html/unnamed-chunk-7-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/survival_files/figure-html/unnamed-chunk-7-1.png -------------------------------------------------------------------------------- /docs/articles/survival_files/figure-html/unnamed-chunk-8-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/articles/survival_files/figure-html/unnamed-chunk-8-1.png -------------------------------------------------------------------------------- /docs/bootstrap-toc.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/) 3 | * Copyright 2015 Aidan Feldman 4 | * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */ 5 | 6 | /* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */ 7 | 8 | /* All levels of nav */ 9 | nav[data-toggle='toc'] .nav > li > a { 10 | display: block; 11 | padding: 4px 20px; 12 | font-size: 13px; 13 | font-weight: 500; 14 | color: #767676; 15 | } 16 | nav[data-toggle='toc'] .nav > li > a:hover, 17 | nav[data-toggle='toc'] .nav > li > a:focus { 18 | padding-left: 19px; 19 | color: #563d7c; 20 | text-decoration: none; 21 | background-color: transparent; 22 | border-left: 1px solid #563d7c; 23 | } 24 | nav[data-toggle='toc'] .nav > .active > a, 25 | nav[data-toggle='toc'] .nav > .active:hover > a, 26 | nav[data-toggle='toc'] .nav > .active:focus > a { 27 | padding-left: 18px; 28 | font-weight: bold; 29 | color: #563d7c; 30 | background-color: transparent; 31 | border-left: 2px solid #563d7c; 32 | } 33 | 34 | /* Nav: second level (shown on .active) */ 35 | nav[data-toggle='toc'] .nav .nav { 36 | display: none; /* Hide by default, but at >768px, show it */ 37 | padding-bottom: 10px; 38 | } 39 | nav[data-toggle='toc'] .nav .nav > li > a { 40 | padding-top: 1px; 41 | padding-bottom: 1px; 42 | padding-left: 30px; 43 | font-size: 12px; 44 | font-weight: normal; 45 | } 46 | nav[data-toggle='toc'] .nav .nav > li > a:hover, 47 | nav[data-toggle='toc'] .nav .nav > li > a:focus { 48 | padding-left: 29px; 49 | } 50 | nav[data-toggle='toc'] .nav .nav > .active > a, 51 | nav[data-toggle='toc'] .nav .nav > .active:hover > a, 52 | nav[data-toggle='toc'] .nav .nav > .active:focus > a { 53 | padding-left: 28px; 54 | font-weight: 500; 55 | } 56 | 57 | /* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */ 58 | nav[data-toggle='toc'] .nav > .active > ul { 59 | display: block; 60 | } 61 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/favicon.ico -------------------------------------------------------------------------------- /docs/google78a4df6d1f82019f.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google78a4df6d1f82019f.html 2 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/logo.png -------------------------------------------------------------------------------- /docs/make_ref_list: -------------------------------------------------------------------------------- 1 | # use 2 | pkgdown::templte_reference() 3 | 4 | reference: 5 | - title: "Connecting to Spark" 6 | desc: > 7 | 8 | reference: 9 | - title: "All-in-one functions" 10 | desc: "Single functions to generate final output tables" 11 | contents: 12 | - '`finalfit`' 13 | - '`summary_factorlist`' 14 | - title: "Model wrappers" 15 | desc: "Wrappers for common statistical models" 16 | contents: 17 | - '`lmuni`' 18 | - '`lmmulti`' 19 | - '`lmmixed`' 20 | - '`glmuni`' 21 | - '`glmmulti`' 22 | - '`glmmulti_boot`' 23 | - '`glmmixed`' 24 | - '`coxphuni`' 25 | - '`coxphmulti`' 26 | - title: "Bootstrap functions"" 27 | desc: "Bootstrap simulation for model prediction" 28 | contents: 29 | - '`boot_predict`' 30 | - '`boot_compare`' 31 | - title: "Helper functions" 32 | desc: ~ 33 | contents: 34 | - '`fit2df`' 35 | - '`ff_glimpse`' 36 | - '`ff_merge`' 37 | - '`ff_newdata`' 38 | - '`dependent_label`' 39 | - title: "Plotting" 40 | desc: ~ 41 | contents: 42 | - '`or_plot`' 43 | - '`hr_plot`' 44 | - '`surv_plot`' 45 | - '`missing_plot`' 46 | - title: "Missing data functions" 47 | desc: ~ 48 | contents: 49 | - '`missing_pattern`' 50 | - '`missing_compare`' 51 | - '`missing_pairs`' 52 | - '`missing_df`' 53 | - '`missing_plot`' 54 | - '`missing_predictorMatrix`' 55 | - title: "Metrics" 56 | desc: ~ 57 | contents: 58 | - '`metrics_hoslem`' 59 | - title: "Data" 60 | desc: "Sample data for examples and testing" 61 | contents: 62 | - '`colon_s`' 63 | - title: "Misc" 64 | desc: ~ 65 | contents: 66 | - '`finalfit-package`' 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.19.2 2 | pkgdown: 2.0.6 3 | pkgdown_sha: ~ 4 | articles: 5 | all_plots_examples: all_plots_examples.html 6 | all_tables_examples: all_tables_examples.html 7 | bootstrap: bootstrap.html 8 | data_prep: data_prep.html 9 | export: export.html 10 | finalfit: finalfit.html 11 | missing: missing.html 12 | survival: survival.html 13 | last_built: 2025-03-21T22:26Z 14 | 15 | -------------------------------------------------------------------------------- /docs/reference/Rplot001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/Rplot001.png -------------------------------------------------------------------------------- /docs/reference/Rplot002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/Rplot002.png -------------------------------------------------------------------------------- /docs/reference/Rplot003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/Rplot003.png -------------------------------------------------------------------------------- /docs/reference/boot_predict-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/boot_predict-1.png -------------------------------------------------------------------------------- /docs/reference/coefficient_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/coefficient_plot-1.png -------------------------------------------------------------------------------- /docs/reference/coefficient_plot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/coefficient_plot-2.png -------------------------------------------------------------------------------- /docs/reference/ff_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/ff_plot-1.png -------------------------------------------------------------------------------- /docs/reference/ff_plot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/ff_plot-2.png -------------------------------------------------------------------------------- /docs/reference/ff_plot-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/ff_plot-3.png -------------------------------------------------------------------------------- /docs/reference/ff_remove_ref-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/ff_remove_ref-1.png -------------------------------------------------------------------------------- /docs/reference/figures/finalfit_130_150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/figures/finalfit_130_150.png -------------------------------------------------------------------------------- /docs/reference/figures/finalfit_hex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/figures/finalfit_hex.png -------------------------------------------------------------------------------- /docs/reference/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/figures/logo.png -------------------------------------------------------------------------------- /docs/reference/hr_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/hr_plot-1.png -------------------------------------------------------------------------------- /docs/reference/hr_plot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/hr_plot-2.png -------------------------------------------------------------------------------- /docs/reference/missing_compare-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/missing_compare-1.png -------------------------------------------------------------------------------- /docs/reference/missing_pattern-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/missing_pattern-1.png -------------------------------------------------------------------------------- /docs/reference/missing_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/missing_plot-1.png -------------------------------------------------------------------------------- /docs/reference/or_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/or_plot-1.png -------------------------------------------------------------------------------- /docs/reference/or_plot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/or_plot-2.png -------------------------------------------------------------------------------- /docs/reference/surv_plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/docs/reference/surv_plot-1.png -------------------------------------------------------------------------------- /man/boot_compare.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/boot_compare.R 3 | \name{boot_compare} 4 | \alias{boot_compare} 5 | \title{Compare bootstrapped distributions} 6 | \usage{ 7 | boot_compare( 8 | bs.out, 9 | confint_level = 0.95, 10 | confint_sep = " to ", 11 | comparison = "difference", 12 | condense = TRUE, 13 | compare_name = NULL, 14 | digits = c(2, 3), 15 | ref_symbol = 1 16 | ) 17 | } 18 | \arguments{ 19 | \item{bs.out}{Output from \code{boot::boot},} 20 | 21 | \item{confint_level}{The confidence level to use for the confidence interval. 22 | Must be strictly greater than 0 and less than 1. Defaults to 0.95, 23 | which corresponds to a 95 percent confidence interval.} 24 | 25 | \item{confint_sep}{String separating lower and upper confidence interval} 26 | 27 | \item{comparison}{Either "difference" or "ratio".} 28 | 29 | \item{condense}{Logical. FALSE gives numeric values, usually for plotting. 30 | TRUE gives table for final output.} 31 | 32 | \item{compare_name}{Name to be given to comparison metric.} 33 | 34 | \item{digits}{Rounding for estimate values and p-values, default c(2,3).} 35 | 36 | \item{ref_symbol}{Reference level symbol} 37 | } 38 | \value{ 39 | A dataframe of first differences or ratios for boostrapped distributions of a metric of interest. 40 | 41 | \code{finalfit} predict functions 42 | } 43 | \description{ 44 | Not usually called directly. Included in \code{\link{boot_predict}}. Usually used in combination with A function that takes the output from \code{\link{summary_factorlist}(..., 45 | fit_id=TRUE)} and merges with any number of model dataframes, usually 46 | produced with a model wrapper followed by the \code{\link{fit2df}()} function 47 | (see examples). 48 | } 49 | \examples{ 50 | # See boot_predict. 51 | } 52 | \seealso{ 53 | \code{\link{boot_predict}} \code{\link{finalfit_newdata}} 54 | } 55 | -------------------------------------------------------------------------------- /man/catTestfisher.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{catTestfisher} 4 | \alias{catTestfisher} 5 | \title{Deprecated catTest from Hmisc for reverse dependencies} 6 | \usage{ 7 | catTestfisher(.) 8 | } 9 | \arguments{ 10 | \item{.}{Null} 11 | } 12 | \description{ 13 | Deprecated catTest from Hmisc for reverse dependencies 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man/check_recode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/check_recode.R 3 | \name{check_recode} 4 | \alias{check_recode} 5 | \title{Check accurate recoding of variables} 6 | \usage{ 7 | check_recode( 8 | .data, 9 | dependent = NULL, 10 | explanatory = NULL, 11 | include_numerics = TRUE, 12 | ... 13 | ) 14 | } 15 | \arguments{ 16 | \item{.data}{Data frame or tibble.} 17 | 18 | \item{dependent}{Optional character vector: name(s) of depdendent 19 | variable(s).} 20 | 21 | \item{explanatory}{Optional character vector: name(s) of explanatory 22 | variable(s).} 23 | 24 | \item{include_numerics}{Logical. Include numeric variables in function.} 25 | 26 | \item{...}{Pass other arguments to \code{\link{agrep}}.} 27 | } 28 | \value{ 29 | List of length two. The first is an index of variable combiations. 30 | The second is a nested list of crosstables as tibbles. 31 | } 32 | \description{ 33 | This was written a few days after the retraction of a paper in JAMA due to an 34 | error in recoding the treatment variable 35 | (\url{https://jamanetwork.com/journals/jama/fullarticle/2752474}). This 36 | takes a data frame or tibble, fuzzy matches variable names, and produces 37 | crosstables of all matched variables. A visual inspection should reveal any 38 | miscoding. 39 | } 40 | \examples{ 41 | library(dplyr) 42 | data(colon_s) 43 | colon_s_small = colon_s \%>\% 44 | select(-id, -rx, -rx.factor) \%>\% 45 | mutate( 46 | age.factor2 = forcats::fct_collapse(age.factor, 47 | "<60 years" = c("<40 years", "40-59 years")), 48 | sex.factor2 = forcats::fct_recode(sex.factor, 49 | # Intentional miscode 50 | "F" = "Male", 51 | "M" = "Female") 52 | ) 53 | 54 | # Check 55 | colon_s_small \%>\% 56 | check_recode(include_numerics = FALSE) 57 | 58 | out = colon_s_small \%>\% 59 | select(-extent, -extent.factor,-time, -time.years) \%>\% 60 | check_recode() 61 | out 62 | 63 | # Select a tibble and expand 64 | out$counts[[9]] 65 | # Note this variable (node4) appears miscoded in original dataset survival::colon. 66 | 67 | # Choose to only include variables that you actually use. 68 | # This uses standard Finalfit grammar. 69 | dependent = "mort_5yr" 70 | explanatory = c("age.factor2", "sex.factor2") 71 | colon_s_small \%>\% 72 | check_recode(dependent, explanatory) 73 | } 74 | -------------------------------------------------------------------------------- /man/colon_s.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_package.R 3 | \docType{data} 4 | \name{colon_s} 5 | \alias{colon_s} 6 | \title{Chemotherapy for Stage B/C colon cancer} 7 | \format{ 8 | A data frame with 929 rows and 33 variables 9 | } 10 | \source{ 11 | \code{\link[survival]{colon}} 12 | } 13 | \usage{ 14 | data(colon_s) 15 | } 16 | \description{ 17 | This is a modified version of \code{survival::\link[survival]{colon}}.These 18 | are data from one of the first successful trials of adjuvant chemotherapy for 19 | colon cancer. Levamisole is a low-toxicity compound previously used to treat 20 | worm infestations in animals; 5-FU is a moderately toxic (as these things go) 21 | chemotherapy agent. There are two records per person, one for recurrence and 22 | one for death 23 | } 24 | \keyword{data} 25 | -------------------------------------------------------------------------------- /man/compoundpipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_package.R 3 | \name{\%<>\%} 4 | \alias{\%<>\%} 5 | \title{magrittr compound assignment pipe-operator} 6 | \usage{ 7 | lhs \%<>\% rhs 8 | } 9 | \description{ 10 | magrittr compound assignment pipe-operator 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/condense_fit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{condense_fit} 4 | \alias{condense_fit} 5 | \title{Condense model output dataframe for final tables} 6 | \usage{ 7 | condense_fit( 8 | .data, 9 | explanatory_name = "explanatory", 10 | estimate_name = NA, 11 | estimate_suffix = "", 12 | p_name = "p", 13 | digits = c(2, 2, 3), 14 | confint_sep = "-" 15 | ) 16 | } 17 | \arguments{ 18 | \item{.data}{Dataframe of four or five columns, must be this order, (1) explanatory 19 | variable names, (2) estimate, (3) confidence interval lower limit, (4) 20 | confidence interval upper limit, (5) p-value (optional).} 21 | 22 | \item{explanatory_name}{Name for this column in output} 23 | 24 | \item{estimate_name}{Name for this column in output} 25 | 26 | \item{estimate_suffix}{Appeneded to estimate name} 27 | 28 | \item{p_name}{Name given to p-value estimate} 29 | 30 | \item{digits}{Number of digits to round to (1) estimate, (2) confidence 31 | interval limits, (3) p-value.} 32 | 33 | \item{confint_sep}{String to separate confidence intervals, typically "-" or 34 | " to ".} 35 | } 36 | \description{ 37 | Internal function, not called directly. Can only be used in conjunction with 38 | extract_fit 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/coxphmulti.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/coxphmulti.R 3 | \name{coxphmulti} 4 | \alias{coxphmulti} 5 | \title{Cox proprotional hazards multivariable models: \code{finalfit} model wrapper} 6 | \usage{ 7 | coxphmulti(.data, dependent, explanatory, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | 12 | \item{dependent}{Character vector of length 1: name of survival object in 13 | form \code{Surv(time, status)}.} 14 | 15 | \item{explanatory}{Character vector of any length: name(s) of explanatory 16 | variables.} 17 | 18 | \item{...}{Other arguments to pass to \code{\link[survival]{coxph}}.} 19 | } 20 | \value{ 21 | A multivariable \code{\link[survival]{coxph}} fitted model 22 | output. Output is of class \code{coxph}. 23 | } 24 | \description{ 25 | Using \code{finalfit} conventions, produces multivariable Cox 26 | Proportional Hazard regression models for a set of explanatory variables 27 | against a survival object. 28 | } 29 | \details{ 30 | Uses \code{\link[survival]{coxph}} with \code{finalfit} modelling 31 | conventions. Output can be passed to \code{\link{fit2df}}. 32 | } 33 | \examples{ 34 | # Cox Proportional Hazards multivariable analysis. 35 | library(finalfit) 36 | library(dplyr) 37 | 38 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 39 | dependent = "Surv(time, status)" 40 | colon_s \%>\% 41 | coxphmulti(dependent, explanatory) \%>\% 42 | fit2df() 43 | } 44 | \seealso{ 45 | \code{\link{fit2df}, \link{finalfit_merge}} 46 | 47 | Other finalfit model wrappers: 48 | \code{\link{coxphuni}()}, 49 | \code{\link{crrmulti}()}, 50 | \code{\link{crruni}()}, 51 | \code{\link{glmmixed}()}, 52 | \code{\link{glmmulti_boot}()}, 53 | \code{\link{glmmulti}()}, 54 | \code{\link{glmuni}()}, 55 | \code{\link{lmmixed}()}, 56 | \code{\link{lmmulti}()}, 57 | \code{\link{lmuni}()}, 58 | \code{\link{svyglmmulti}()}, 59 | \code{\link{svyglmuni}()} 60 | } 61 | \concept{finalfit model wrappers} 62 | -------------------------------------------------------------------------------- /man/coxphuni.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/coxphuni.R 3 | \name{coxphuni} 4 | \alias{coxphuni} 5 | \title{Cox proprotional hazards univariable models: \code{finalfit} model wrapper} 6 | \usage{ 7 | coxphuni(.data, dependent, explanatory) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | 12 | \item{dependent}{Character vector of length 1: name of survival object in form \code{Surv(time, status)}.} 13 | 14 | \item{explanatory}{Character vector of any length: name(s) of explanatory variables.} 15 | } 16 | \value{ 17 | A list of univariable \code{\link[survival]{coxph}} fitted model outputs. 18 | Output is of class \code{coxphlist}. 19 | } 20 | \description{ 21 | Using \code{finalfit} conventions, produces multiple univariable Cox Proportional Hazard 22 | regression models for a set of explanatory variables against a survival object. 23 | } 24 | \details{ 25 | Uses \code{\link[survival]{coxph}} with \code{finalfit} modelling conventions. Output can be 26 | passed to \code{\link{fit2df}}. 27 | } 28 | \examples{ 29 | # Cox Proportional Hazards univariable analysis. 30 | library(finalfit) 31 | library(dplyr) 32 | 33 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 34 | dependent = "Surv(time, status)" 35 | colon_s \%>\% 36 | coxphuni(dependent, explanatory) \%>\% 37 | fit2df() 38 | } 39 | \seealso{ 40 | \code{\link{fit2df}, \link{finalfit_merge}} 41 | 42 | Other finalfit model wrappers: 43 | \code{\link{coxphmulti}()}, 44 | \code{\link{crrmulti}()}, 45 | \code{\link{crruni}()}, 46 | \code{\link{glmmixed}()}, 47 | \code{\link{glmmulti_boot}()}, 48 | \code{\link{glmmulti}()}, 49 | \code{\link{glmuni}()}, 50 | \code{\link{lmmixed}()}, 51 | \code{\link{lmmulti}()}, 52 | \code{\link{lmuni}()}, 53 | \code{\link{svyglmmulti}()}, 54 | \code{\link{svyglmuni}()} 55 | } 56 | \concept{finalfit model wrappers} 57 | -------------------------------------------------------------------------------- /man/crrmulti.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crrmulti.R 3 | \name{crrmulti} 4 | \alias{crrmulti} 5 | \title{Competing risks multivariable regression: \code{finalfit} model wrapper} 6 | \usage{ 7 | crrmulti(.data, dependent, explanatory, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame or tibble.} 11 | 12 | \item{dependent}{Character vector of length 1: name of survival object in 13 | form \code{Surv(time, status)}. \code{Status} default values should be 0 14 | censored (e.g. alive), 1 event of interest (e.g. died of disease of 15 | interest), 2 competing event (e.g. died of other cause).} 16 | 17 | \item{explanatory}{Character vector of any length: name(s) of explanatory 18 | variables.} 19 | 20 | \item{...}{Other arguments to \code{\link[cmprsk]{crr}}} 21 | } 22 | \value{ 23 | A multivariable \code{\link[cmprsk]{crr}} fitted model 24 | class \code{crr}. 25 | } 26 | \description{ 27 | Using \code{finalfit} conventions, produces multivariable Competing Risks 28 | Regression models for a set of explanatory variables. 29 | } 30 | \details{ 31 | Uses \code{\link[cmprsk]{crr}} with \code{finalfit} modelling conventions. 32 | Output can be passed to \code{\link{fit2df}}. 33 | } 34 | \examples{ 35 | library(dplyr) 36 | melanoma = boot::melanoma 37 | melanoma = melanoma \%>\% 38 | mutate( 39 | # Cox PH to determine cause-specific hazards 40 | status_coxph = ifelse(status == 2, 0, # "still alive" 41 | ifelse(status == 1, 1, # "died of melanoma" 42 | 0)), # "died of other causes is censored" 43 | 44 | # Fine and Gray to determine subdistribution hazards 45 | status_crr = ifelse(status == 2, 0, # "still alive" 46 | ifelse(status == 1, 1, # "died of melanoma" 47 | 2)), # "died of other causes" 48 | sex = factor(sex), 49 | ulcer = factor(ulcer) 50 | ) 51 | 52 | dependent_coxph = c("Surv(time, status_coxph)") 53 | dependent_crr = c("Surv(time, status_crr)") 54 | explanatory = c("sex", "age", "ulcer") 55 | 56 | # Create single well-formatted table 57 | melanoma \%>\% 58 | summary_factorlist(dependent_crr, explanatory, column = TRUE, fit_id = TRUE) \%>\% 59 | ff_merge( 60 | melanoma \%>\% 61 | coxphmulti(dependent_coxph, explanatory) \%>\% 62 | fit2df(estimate_suffix = " (Cox PH multivariable)") 63 | ) \%>\% 64 | ff_merge( 65 | melanoma \%>\% 66 | crrmulti(dependent_crr, explanatory) \%>\% 67 | fit2df(estimate_suffix = " (competing risks multivariable)") 68 | ) \%>\% 69 | select(-fit_id, -index) \%>\% 70 | dependent_label(melanoma, dependent_crr) 71 | } 72 | \seealso{ 73 | \code{\link{fit2df}, \link{finalfit_merge}} 74 | 75 | Other finalfit model wrappers: 76 | \code{\link{coxphmulti}()}, 77 | \code{\link{coxphuni}()}, 78 | \code{\link{crruni}()}, 79 | \code{\link{glmmixed}()}, 80 | \code{\link{glmmulti_boot}()}, 81 | \code{\link{glmmulti}()}, 82 | \code{\link{glmuni}()}, 83 | \code{\link{lmmixed}()}, 84 | \code{\link{lmmulti}()}, 85 | \code{\link{lmuni}()}, 86 | \code{\link{svyglmmulti}()}, 87 | \code{\link{svyglmuni}()} 88 | } 89 | \concept{finalfit model wrappers} 90 | -------------------------------------------------------------------------------- /man/crruni.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crruni.R 3 | \name{crruni} 4 | \alias{crruni} 5 | \title{Competing risks univariable regression: \code{finalfit} model wrapper} 6 | \usage{ 7 | crruni(.data, dependent, explanatory, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame or tibble.} 11 | 12 | \item{dependent}{Character vector of length 1: name of survival object in 13 | form \code{Surv(time, status)}. \code{Status} default values should be 0 14 | censored (e.g. alive), 1 event of interest (e.g. died of disease of 15 | interest), 2 competing event (e.g. died of other cause).} 16 | 17 | \item{explanatory}{Character vector of any length: name(s) of explanatory 18 | variables.} 19 | 20 | \item{...}{Other arguments to \code{\link[cmprsk]{crr}}} 21 | } 22 | \value{ 23 | A list of univariable \code{\link[cmprsk]{crr}} fitted models class 24 | \code{crrlist}. 25 | } 26 | \description{ 27 | Using \code{finalfit} conventions, produces univariable Competing Risks 28 | Regression models for a set of explanatory variables. 29 | } 30 | \details{ 31 | Uses \code{\link[cmprsk]{crr}} with \code{finalfit} modelling conventions. 32 | Output can be passed to \code{\link{fit2df}}. 33 | } 34 | \examples{ 35 | library(dplyr) 36 | melanoma = boot::melanoma 37 | melanoma = melanoma \%>\% 38 | mutate( 39 | # Cox PH to determine cause-specific hazards 40 | status_coxph = ifelse(status == 2, 0, # "still alive" 41 | ifelse(status == 1, 1, # "died of melanoma" 42 | 0)), # "died of other causes is censored" 43 | 44 | # Fine and Gray to determine subdistribution hazards 45 | status_crr = ifelse(status == 2, 0, # "still alive" 46 | ifelse(status == 1, 1, # "died of melanoma" 47 | 2)), # "died of other causes" 48 | sex = factor(sex), 49 | ulcer = factor(ulcer) 50 | ) 51 | 52 | dependent_coxph = c("Surv(time, status_coxph)") 53 | dependent_crr = c("Surv(time, status_crr)") 54 | explanatory = c("sex", "age", "ulcer") 55 | 56 | # Create single well-formatted table 57 | melanoma \%>\% 58 | summary_factorlist(dependent_crr, explanatory, column = TRUE, fit_id = TRUE) \%>\% 59 | ff_merge( 60 | melanoma \%>\% 61 | coxphmulti(dependent_coxph, explanatory) \%>\% 62 | fit2df(estimate_suffix = " (Cox PH multivariable)") 63 | ) \%>\% 64 | ff_merge( 65 | melanoma \%>\% 66 | crrmulti(dependent_crr, explanatory) \%>\% 67 | fit2df(estimate_suffix = " (competing risks multivariable)") 68 | ) \%>\% 69 | select(-fit_id, -index) \%>\% 70 | dependent_label(melanoma, dependent_crr) 71 | } 72 | \seealso{ 73 | \code{\link{fit2df}, \link{finalfit_merge}} 74 | 75 | Other finalfit model wrappers: 76 | \code{\link{coxphmulti}()}, 77 | \code{\link{coxphuni}()}, 78 | \code{\link{crrmulti}()}, 79 | \code{\link{glmmixed}()}, 80 | \code{\link{glmmulti_boot}()}, 81 | \code{\link{glmmulti}()}, 82 | \code{\link{glmuni}()}, 83 | \code{\link{lmmixed}()}, 84 | \code{\link{lmmulti}()}, 85 | \code{\link{lmuni}()}, 86 | \code{\link{svyglmmulti}()}, 87 | \code{\link{svyglmuni}()} 88 | } 89 | \concept{finalfit model wrappers} 90 | -------------------------------------------------------------------------------- /man/dependent_label.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{dependent_label} 4 | \alias{dependent_label} 5 | \title{Make a label for the dependent variable} 6 | \usage{ 7 | dependent_label(df.out, .data, dependent, prefix = "Dependent: ", suffix = "") 8 | } 9 | \arguments{ 10 | \item{df.out}{Dataframe (results table) to be altered.} 11 | 12 | \item{.data}{Original dataframe.} 13 | 14 | \item{dependent}{Character vector of length 1: quoted name of depdendent 15 | variable. Can be continuous, a binary factor, or a survival object of form 16 | \code{Surv(time, status)}} 17 | 18 | \item{prefix}{Prefix for dependent label} 19 | 20 | \item{suffix}{Suffix for dependent label} 21 | } 22 | \value{ 23 | Returns the label for the dependent variable, if specified. 24 | } 25 | \description{ 26 | Can be add dependent label to final results dataframe. 27 | } 28 | \examples{ 29 | library(dplyr) 30 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 31 | explanatory_multi = c("age.factor", "obstruct.factor") 32 | random_effect = "hospital" 33 | dependent = 'mort_5yr' 34 | 35 | # Separate tables 36 | colon_s \%>\% 37 | summary_factorlist(dependent, explanatory, fit_id=TRUE) -> example.summary 38 | 39 | colon_s \%>\% 40 | glmuni(dependent, explanatory) \%>\% 41 | fit2df(estimate_suffix=" (univariable)") -> example.univariable 42 | 43 | colon_s \%>\% 44 | glmmulti(dependent, explanatory) \%>\% 45 | fit2df(estimate_suffix=" (multivariable)") -> example.multivariable 46 | 47 | colon_s \%>\% 48 | glmmixed(dependent, explanatory, random_effect) \%>\% 49 | fit2df(estimate_suffix=" (multilevel") -> example.multilevel 50 | 51 | # Pipe together 52 | example.summary \%>\% 53 | finalfit_merge(example.univariable) \%>\% 54 | finalfit_merge(example.multivariable) \%>\% 55 | finalfit_merge(example.multilevel) \%>\% 56 | select(-c(fit_id, index)) \%>\% 57 | dependent_label(colon_s, dependent) -> example.final 58 | example.final 59 | } 60 | -------------------------------------------------------------------------------- /man/error_colon_fct_levels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{error_colon_fct_levels} 4 | \alias{error_colon_fct_levels} 5 | \title{Errors: colon in factor levels} 6 | \usage{ 7 | error_colon_fct_levels(.data) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | } 12 | \value{ 13 | Logical 14 | } 15 | \description{ 16 | Errors: colon in factor levels 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/expositionpipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_package.R 3 | \name{\%$\%} 4 | \alias{\%$\%} 5 | \title{magrittr exposition pipe-operator} 6 | \usage{ 7 | lhs \%$\% rhs 8 | } 9 | \description{ 10 | magrittr exposition pipe-operator 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/extract_fit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{extract_fit} 4 | \alias{extract_fit} 5 | \alias{extract_fit.glm} 6 | \alias{extract_fit.glmerMod} 7 | \alias{extract_fit.lm} 8 | \alias{extract_fit.lmerMod} 9 | \alias{extract_fit.coxph} 10 | \alias{extract_fit.crr} 11 | \alias{extract_fit.coxme} 12 | \alias{extract_fit.stanfit} 13 | \title{Extract model output to dataframe} 14 | \usage{ 15 | extract_fit(...) 16 | 17 | \method{extract_fit}{glm}( 18 | .data, 19 | explanatory_name = "explanatory", 20 | estimate_name = "OR", 21 | estimate_suffix = "", 22 | p_name = "p", 23 | exp = TRUE, 24 | confint_type = "profile", 25 | confint_level = 0.95, 26 | ... 27 | ) 28 | 29 | \method{extract_fit}{glmerMod}( 30 | .data, 31 | explanatory_name = "explanatory", 32 | estimate_name = "OR", 33 | estimate_suffix = "", 34 | p_name = "p", 35 | exp = TRUE, 36 | confint_type = "Wald", 37 | confint_level = 0.95, 38 | ... 39 | ) 40 | 41 | \method{extract_fit}{lm}( 42 | .data, 43 | explanatory_name = "explanatory", 44 | estimate_name = "Coefficient", 45 | estimate_suffix = "", 46 | p_name = "p", 47 | confint_level = 0.95, 48 | ... 49 | ) 50 | 51 | \method{extract_fit}{lmerMod}( 52 | .data, 53 | explanatory_name = "explanatory", 54 | estimate_name = "OR", 55 | estimate_suffix = "", 56 | p_name = "p", 57 | confint_type = "Wald", 58 | confint_level = 0.95, 59 | ... 60 | ) 61 | 62 | \method{extract_fit}{coxph}( 63 | .data, 64 | explanatory_name = "explanatory", 65 | estimate_name = "HR", 66 | estimate_suffix = "", 67 | p_name = "p", 68 | ... 69 | ) 70 | 71 | \method{extract_fit}{crr}( 72 | .data, 73 | explanatory_name = "explanatory", 74 | estimate_name = "HR", 75 | estimate_suffix = "", 76 | p_name = "p", 77 | ... 78 | ) 79 | 80 | \method{extract_fit}{coxme}( 81 | .data, 82 | explanatory_name = "explanatory", 83 | estimate_name = "HR", 84 | estimate_suffix = "", 85 | p_name = "p", 86 | confint_level = 0.95, 87 | ... 88 | ) 89 | 90 | \method{extract_fit}{stanfit}( 91 | .data, 92 | explanatory_name = "explanatory", 93 | estimate_name = "OR", 94 | estimate_suffix = "", 95 | p_name = "p", 96 | digits = c(2, 2, 3), 97 | X, 98 | ... 99 | ) 100 | } 101 | \arguments{ 102 | \item{...}{Other arguments.} 103 | 104 | \item{.data}{Model output.} 105 | 106 | \item{explanatory_name}{Name for this column in output.} 107 | 108 | \item{estimate_name}{Name for this column in output.} 109 | 110 | \item{estimate_suffix}{Appeneded to estimate name.} 111 | 112 | \item{p_name}{Name given to p-value estimate} 113 | 114 | \item{confint_type}{One of \code{c("profile", "default")} for GLM 115 | models or \code{c("profile", "Wald", "boot")} for \code{glmer/lmer} models. 116 | Not implemented for \code{lm, coxph or coxphlist}.} 117 | 118 | \item{confint_level}{The confidence level required.} 119 | 120 | \item{X}{Design matrix from Stan modelling procedure.} 121 | } 122 | \description{ 123 | Internal function, not usually called directly. 124 | 125 | Internal function, not called directly. 126 | 127 | Internal function, not called directly. 128 | } 129 | \keyword{internal} 130 | -------------------------------------------------------------------------------- /man/extract_labels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{extract_labels} 4 | \alias{extract_labels} 5 | \title{Extract variable labels and names} 6 | \usage{ 7 | extract_labels(.data) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | } 12 | \value{ 13 | A data frame with three columns: first (vname), variabe names; second 14 | (vlabel), variables labels; third (vfill), variable labels and when null 15 | variable names. 16 | } 17 | \description{ 18 | Extract variable labels and names 19 | } 20 | \examples{ 21 | colon_s \%>\% 22 | extract_labels() 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/extract_variable_label.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{extract_variable_label} 4 | \alias{extract_variable_label} 5 | \title{Extract variable labels from dataframe} 6 | \usage{ 7 | extract_variable_label(.data) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe containing labelled variables.} 11 | } 12 | \description{ 13 | Variable labels can be created using \code{\link{ff_label}}. Some functions 14 | strip variable labels (variable attributes), e.g. \code{forcats::fct_recode}. 15 | Use this function to create a vector of variable labels from a data frame. 16 | Then use \code{\link{ff_relabel}} to relabel variables in data frame. 17 | } 18 | \examples{ 19 | colon_s \%>\% 20 | extract_variable_label 21 | } 22 | -------------------------------------------------------------------------------- /man/ff_column_totals.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_column_totals.R 3 | \name{ff_column_totals} 4 | \alias{ff_column_totals} 5 | \alias{finalfit_column_totals} 6 | \title{Add column totals to \code{summary_factorlist()} output} 7 | \usage{ 8 | ff_column_totals( 9 | df.in, 10 | .data, 11 | dependent, 12 | na_include_dependent = FALSE, 13 | percent = TRUE, 14 | digits = c(1, 0), 15 | label = NULL, 16 | prefix = "", 17 | weights = NULL 18 | ) 19 | 20 | finalfit_column_totals( 21 | df.in, 22 | .data, 23 | dependent, 24 | na_include_dependent = FALSE, 25 | percent = TRUE, 26 | digits = c(1, 0), 27 | label = NULL, 28 | prefix = "", 29 | weights = NULL 30 | ) 31 | } 32 | \arguments{ 33 | \item{df.in}{\code{summary_factorlist()} output.} 34 | 35 | \item{.data}{Data frame used to create \code{summary_factorlist()}.} 36 | 37 | \item{dependent}{Character. Name of dependent variable.} 38 | 39 | \item{na_include_dependent}{Logical. When TRUE, missing data in the dependent 40 | variable is included in totals.} 41 | 42 | \item{percent}{Logical. Include percentage.} 43 | 44 | \item{digits}{Integer length 2. Number of digits for (1) percentage, (2) weighted count.} 45 | 46 | \item{label}{Character. Label for total row.} 47 | 48 | \item{prefix}{Character. Prefix for column totals, e.g "N=".} 49 | 50 | \item{weights}{Character vector of length 1: name of column to use for weights.} 51 | } 52 | \value{ 53 | Data frame. 54 | } 55 | \description{ 56 | Add column totals to \code{summary_factorlist()} output 57 | } 58 | \examples{ 59 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 60 | dependent = 'mort_5yr' 61 | colon_s \%>\% 62 | summary_factorlist(dependent, explanatory) \%>\% 63 | ff_column_totals(colon_s, dependent) 64 | 65 | # Ensure works with missing data in dependent 66 | colon_s = colon_s \%>\% 67 | dplyr::mutate( 68 | mort_5yr = forcats::fct_na_value_to_level(mort_5yr, level = "(Missing)") 69 | ) 70 | colon_s \%>\% 71 | summary_factorlist(dependent, explanatory) \%>\% 72 | ff_column_totals(colon_s, dependent) 73 | } 74 | -------------------------------------------------------------------------------- /man/ff_eval.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{ff_eval} 4 | \alias{ff_eval} 5 | \title{Eval for `lm` and `glm` model wrappers} 6 | \usage{ 7 | ff_eval(.) 8 | } 9 | \arguments{ 10 | \item{.}{} 11 | } 12 | \description{ 13 | Internal function, not called directly. This is in reponse to a long running 14 | issue of the best way to pass `weights` to `lm()` and `glm()`. See here 15 | https://stackoverflow.com/questions/54383414/passing-weights-to-glm-using-rlang 16 | } 17 | \keyword{internal} 18 | -------------------------------------------------------------------------------- /man/ff_expand.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_newdata.R 3 | \name{ff_expand} 4 | \alias{ff_expand} 5 | \alias{finalfit_expand} 6 | \title{Summarise with mode and mean/median and expand given factors} 7 | \usage{ 8 | ff_expand(.data, ..., cont = "mean") 9 | 10 | finalfit_expand(.data, ..., cont = "mean") 11 | } 12 | \arguments{ 13 | \item{.data}{A data frame or tibble.} 14 | 15 | \item{...}{Factors to expand.} 16 | 17 | \item{cont}{One of "mean" or "median": the summary estimate for continuous variables.} 18 | } 19 | \value{ 20 | A data frame or tibble with the mode for factors and mean/median 21 | for continuous variables, with given factors expanded to include all levels. 22 | } 23 | \description{ 24 | When producing conditional estimates from a regression model, it is often useful 25 | to set variables not of interest to their mode for factors and mean or median for numerics 26 | when creating the newdata object, and combine these with all levels for factors of interest. 27 | } 28 | \examples{ 29 | library(dplyr) 30 | colon_s \%>\% 31 | select(-hospital) \%>\% 32 | ff_expand(age.factor, sex.factor) 33 | } 34 | \seealso{ 35 | \code{\link{ff_mode}} \code{\link{summary_df}} 36 | } 37 | -------------------------------------------------------------------------------- /man/ff_formula.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{ff_formula} 4 | \alias{ff_formula} 5 | \alias{finalfit_formula} 6 | \title{Generate formula as character string} 7 | \usage{ 8 | ff_formula(dependent, explanatory, random_effect = NULL) 9 | 10 | finalfit_formula(dependent, explanatory, random_effect = NULL) 11 | } 12 | \arguments{ 13 | \item{dependent}{Optional character vector: name(s) of depdendent 14 | variable(s).} 15 | 16 | \item{explanatory}{Optional character vector: name(s) of explanatory 17 | variable(s).} 18 | 19 | \item{random_effect}{Optional character vector: name(s) of random effect 20 | variable(s).} 21 | } 22 | \value{ 23 | Character vector 24 | } 25 | \description{ 26 | Useful when passing finalfit dependent and explanatory lists to base R 27 | functions 28 | } 29 | \examples{ 30 | explanatory = c("age", "nodes", "sex.factor", "obstruct.factor", "perfor.factor") 31 | dependent = "mort_5yr" 32 | ff_formula(dependent, explanatory) 33 | 34 | explanatory = c("age", "nodes", "sex.factor", "obstruct.factor", "perfor.factor") 35 | dependent = "mort_5yr" 36 | random_effect = "(age.factor | hospital)" 37 | ff_formula(dependent, explanatory) 38 | } 39 | -------------------------------------------------------------------------------- /man/ff_glimpse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_glimpse.R 3 | \name{ff_glimpse} 4 | \alias{ff_glimpse} 5 | \alias{finalfit_glimpse} 6 | \title{Descriptive statistics for dataframe} 7 | \usage{ 8 | ff_glimpse( 9 | .data, 10 | dependent = NULL, 11 | explanatory = NULL, 12 | digits = 1, 13 | levels_cut = 5 14 | ) 15 | 16 | finalfit_glimpse( 17 | .data, 18 | dependent = NULL, 19 | explanatory = NULL, 20 | digits = 1, 21 | levels_cut = 5 22 | ) 23 | } 24 | \arguments{ 25 | \item{.data}{Dataframe.} 26 | 27 | \item{dependent}{Optional character vector: name(s) of depdendent 28 | variable(s).} 29 | 30 | \item{explanatory}{Optional character vector: name(s) of explanatory 31 | variable(s).} 32 | 33 | \item{digits}{Significant digits for continuous variable summaries} 34 | 35 | \item{levels_cut}{Max number of factor levels to include in factor levels 36 | summary (in order to avoid the long printing of variables with many 37 | factors).} 38 | } 39 | \value{ 40 | Dataframe on summary data. 41 | } 42 | \description{ 43 | Everyone has a funcion like this, str, glimpse, glance etc. This one is 44 | specifically designed for use with \code{finalfit} language. It is different 45 | in dividing variables by numeric vs factor. 46 | } 47 | \examples{ 48 | library(finalfit) 49 | dependent = 'mort_5yr' 50 | explanatory = c("age", "nodes", "age.factor", "extent.factor", "perfor.factor") 51 | colon_s \%>\% 52 | finalfit_glimpse(dependent, explanatory) 53 | } 54 | -------------------------------------------------------------------------------- /man/ff_interaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_interaction.R 3 | \name{ff_interaction} 4 | \alias{ff_interaction} 5 | \alias{finalfit_interaction} 6 | \title{Make an interaction variable and add to dataframe} 7 | \usage{ 8 | ff_interaction(.data, ..., levels_sep = "_", var_sep = "_", label_sep = ":") 9 | 10 | finalfit_interaction( 11 | .data, 12 | ..., 13 | levels_sep = "_", 14 | var_sep = "_", 15 | label_sep = ":" 16 | ) 17 | } 18 | \arguments{ 19 | \item{.data}{Data frame.} 20 | 21 | \item{...}{The unquoted names of two factors.} 22 | 23 | \item{levels_sep}{Quoted character: how levels are separated in new variable.} 24 | 25 | \item{var_sep}{Quoted character: how variable name is separated.} 26 | 27 | \item{label_sep}{Quoted character: how variable label is separated} 28 | } 29 | \value{ 30 | Original data frame with new variable added via `dplyr::mutate`. 31 | } 32 | \description{ 33 | Combine two factor variables to make an interaction variable. Factor level 34 | order is determined by the order in the variables themselves. Note, names of 35 | the factor variables should not be quoted. The name of the variable is 36 | created from the names of the two factors. The variable is also 37 | labelled with a name derived from any pre-existing labels. 38 | } 39 | \examples{ 40 | 41 | colon_s \%>\% 42 | ff_interaction(sex.factor, perfor.factor) \%>\% 43 | summary_factorlist("mort_5yr", "sex.factor_perfor.factor") 44 | } 45 | -------------------------------------------------------------------------------- /man/ff_label.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{ff_label} 4 | \alias{ff_label} 5 | \alias{finalfit_label} 6 | \title{Label a variable} 7 | \usage{ 8 | ff_label(.var, variable_label) 9 | 10 | finalfit_label(.var, variable_label) 11 | } 12 | \arguments{ 13 | \item{.var}{Quoted variable name} 14 | 15 | \item{variable_label}{Quoted variable label} 16 | } 17 | \value{ 18 | Labelled variable 19 | } 20 | \description{ 21 | Label a variable 22 | } 23 | \examples{ 24 | colon_s$sex.factor \%>\% 25 | ff_label("Sex") \%>\% 26 | str() 27 | } 28 | \seealso{ 29 | \code{\link{extract_variable_label}} \code{\link{ff_relabel}} 30 | } 31 | -------------------------------------------------------------------------------- /man/ff_merge.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_merge.R 3 | \name{ff_merge} 4 | \alias{ff_merge} 5 | \alias{finalfit_merge} 6 | \title{Merge a \code{\link{summary_factorlist}()} table with any number of model 7 | results tables.} 8 | \usage{ 9 | ff_merge( 10 | factorlist, 11 | fit2df_df, 12 | ref_symbol = "-", 13 | estimate_name = NULL, 14 | last_merge = FALSE 15 | ) 16 | 17 | finalfit_merge( 18 | factorlist, 19 | fit2df_df, 20 | ref_symbol = "-", 21 | estimate_name = NULL, 22 | last_merge = FALSE 23 | ) 24 | } 25 | \arguments{ 26 | \item{factorlist}{Output from \code{\link{summary_factorlist}(..., 27 | fit_id=TRUE)}.} 28 | 29 | \item{fit2df_df}{Output from model wrappers followed by 30 | \code{\link{fit2df}()}.} 31 | 32 | \item{ref_symbol}{Reference symbol for model reference levels, typically "-" 33 | or "1.0".} 34 | 35 | \item{estimate_name}{If you have chosen a new `estimate name` (e.g. "Odds 36 | ratio") when running a model wrapper (e.g. `glmuni`), then you need to pass 37 | this new name to `finalfit_merge` to generate correct table. Defaults to 38 | OR/HR/Coefficient} 39 | 40 | \item{last_merge}{Logical. Set to try for the final merge in a series to 41 | remove index and fit_id columns.} 42 | } 43 | \value{ 44 | Returns a dataframe of combined tables. 45 | } 46 | \description{ 47 | A function that takes the output from \code{\link{summary_factorlist}(..., 48 | fit_id=TRUE)} and merges with any number of model dataframes, usually 49 | produced with a model wrapper followed by the \code{\link{fit2df}()} function 50 | (see examples). 51 | } 52 | \examples{ 53 | library(finalfit) 54 | library(dplyr) 55 | 56 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 57 | explanatory_multi = c("age.factor", "obstruct.factor") 58 | random_effect = "hospital" 59 | dependent = "mort_5yr" 60 | 61 | # Create separate tables 62 | colon_s \%>\% 63 | summary_factorlist(dependent, explanatory, fit_id=TRUE) -> example.summary 64 | 65 | colon_s \%>\% 66 | glmuni(dependent, explanatory) \%>\% 67 | fit2df(estimate_suffix=" (univariable)") -> example.univariable 68 | 69 | colon_s \%>\% 70 | glmmulti(dependent, explanatory) \%>\% 71 | fit2df(estimate_suffix=" (multivariable)") -> example.multivariable 72 | 73 | colon_s \%>\% 74 | glmmixed(dependent, explanatory, random_effect) \%>\% 75 | fit2df(estimate_suffix=" (multilevel)") -> example.multilevel 76 | 77 | # Pipe together 78 | example.summary \%>\% 79 | ff_merge(example.univariable) \%>\% 80 | ff_merge(example.multivariable) \%>\% 81 | ff_merge(example.multilevel, last_merge = TRUE) 82 | 83 | # Using finalfit() 84 | colon_s \%>\% 85 | finalfit(dependent, explanatory, keep_fit_id = TRUE) \%>\% 86 | ff_merge(example.multilevel, last_merge = TRUE) 87 | } 88 | \seealso{ 89 | \code{\link{summary_factorlist}} \code{\link{fit2df}} 90 | } 91 | -------------------------------------------------------------------------------- /man/ff_metrics.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_metrics.R 3 | \name{ff_metrics} 4 | \alias{ff_metrics} 5 | \alias{ff_metrics.lm} 6 | \alias{ff_metrics.lmlist} 7 | \alias{ff_metrics.glm} 8 | \alias{ff_metrics.glmlist} 9 | \alias{ff_metrics.lmerMod} 10 | \alias{ff_metrics.glmerMod} 11 | \alias{ff_metrics.coxph} 12 | \alias{ff_metrics.coxphlist} 13 | \title{Generate common metrics for regression model results} 14 | \usage{ 15 | ff_metrics(.data) 16 | 17 | \method{ff_metrics}{lm}(.data) 18 | 19 | \method{ff_metrics}{lmlist}(.data) 20 | 21 | \method{ff_metrics}{glm}(.data) 22 | 23 | \method{ff_metrics}{glmlist}(.data) 24 | 25 | \method{ff_metrics}{lmerMod}(.data) 26 | 27 | \method{ff_metrics}{glmerMod}(.data) 28 | 29 | \method{ff_metrics}{coxph}(.data) 30 | 31 | \method{ff_metrics}{coxphlist}(.data) 32 | } 33 | \arguments{ 34 | \item{.data}{Model output.} 35 | } 36 | \value{ 37 | Model metrics vector for output. 38 | } 39 | \description{ 40 | Generate common metrics for regression model results 41 | } 42 | \examples{ 43 | library(finalfit) 44 | 45 | # glm 46 | fit = glm(mort_5yr ~ age.factor + sex.factor + obstruct.factor + perfor.factor, 47 | data=colon_s, family="binomial") 48 | fit \%>\% 49 | ff_metrics() 50 | 51 | # glmlist 52 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 53 | dependent = "mort_5yr" 54 | colon_s \%>\% 55 | glmmulti(dependent, explanatory) \%>\% 56 | ff_metrics() 57 | 58 | # glmerMod 59 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 60 | random_effect = "hospital" 61 | dependent = "mort_5yr" 62 | colon_s \%>\% 63 | glmmixed(dependent, explanatory, random_effect) \%>\% 64 | ff_metrics() 65 | 66 | # lm 67 | fit = lm(nodes ~ age.factor + sex.factor + obstruct.factor + perfor.factor, 68 | data=colon_s) 69 | fit \%>\% 70 | ff_metrics() 71 | 72 | # lmerMod 73 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 74 | random_effect = "hospital" 75 | dependent = "nodes" 76 | 77 | colon_s \%>\% 78 | lmmixed(dependent, explanatory, random_effect) \%>\% 79 | ff_metrics() 80 | 81 | # coxphlist 82 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 83 | dependent = "Surv(time, status)" 84 | 85 | 86 | colon_s \%>\% 87 | coxphmulti(dependent, explanatory) \%>\% 88 | ff_metrics() 89 | 90 | # coxph 91 | fit = survival::coxph(survival::Surv(time, status) ~ age.factor + sex.factor + 92 | obstruct.factor + perfor.factor, 93 | data = colon_s) 94 | 95 | fit \%>\% 96 | ff_metrics() 97 | } 98 | -------------------------------------------------------------------------------- /man/ff_mode.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_newdata.R 3 | \name{ff_mode} 4 | \alias{ff_mode} 5 | \alias{finalfit_mode} 6 | \title{Return the most frequent level in a factor} 7 | \usage{ 8 | ff_mode(...) 9 | 10 | finalfit_mode(...) 11 | } 12 | \arguments{ 13 | \item{...}{Unquoted factor names.} 14 | } 15 | \value{ 16 | The most frequent level in a factor. 17 | } 18 | \description{ 19 | When producing conditional estimates from a regression model, it is often useful 20 | to set variables not of interest to their mode when creating the newdata object. 21 | } 22 | \examples{ 23 | library(dplyr) 24 | colon_s \%>\% 25 | summarise(age.factor = ff_mode(age.factor)) 26 | 27 | colon_s \%>\% 28 | select(sex.factor, rx.factor, obstruct.factor, perfor.factor) \%>\% 29 | summarise(across(everything(), ff_mode)) 30 | 31 | colon_s \%>\% 32 | reframe(across(where(is.factor), ff_mode)) 33 | # Note, 4 rows is returned in this example because 4 factor levels within `hospital` 34 | # have the same frequency. 35 | } 36 | \seealso{ 37 | \code{\link{summary_df}} \code{\link{ff_expand}} 38 | } 39 | -------------------------------------------------------------------------------- /man/ff_newdata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_newdata.R 3 | \name{ff_newdata} 4 | \alias{ff_newdata} 5 | \alias{finalfit_newdata} 6 | \title{Generate newdata for simulations} 7 | \usage{ 8 | ff_newdata( 9 | .data, 10 | dependent = NULL, 11 | explanatory = NULL, 12 | rowwise = TRUE, 13 | newdata 14 | ) 15 | 16 | finalfit_newdata( 17 | .data, 18 | dependent = NULL, 19 | explanatory = NULL, 20 | rowwise = TRUE, 21 | newdata 22 | ) 23 | } 24 | \arguments{ 25 | \item{.data}{Dataframe.} 26 | 27 | \item{dependent}{Optional character vector of length 1: name of depdendent 28 | variable. Not usually specified in bootstrapping model predictions.} 29 | 30 | \item{explanatory}{Character vector of any length: name(s) of explanatory 31 | variables.} 32 | 33 | \item{rowwise}{Logical. Format \code{newdata} is provided in.} 34 | 35 | \item{newdata}{A list of rows or columns coresponding exactly to the order of 36 | explanatory variables. Useful errors generated if requirements not fulfilled} 37 | } 38 | \value{ 39 | A list of multivariable \code{\link[stats]{glm}} fitted model 40 | outputs. Output is of class \code{glmlist}. 41 | } 42 | \description{ 43 | Generate newdata while respecting the variable types and factor levels in the 44 | primary data frame used to run model. 45 | } 46 | \details{ 47 | Generate model predictions against a specified set of explanatory levels with 48 | bootstrapped confidence intervals. Add a comparison by difference or ratio of 49 | the first row of \code{newdata} with all subsequent rows. 50 | } 51 | \examples{ 52 | # See boot_predict. 53 | library(finalfit) 54 | library(dplyr) 55 | 56 | # Predict probability of death across combinations of factor levels 57 | explanatory = c("age.factor", "extent.factor", "perfor.factor") 58 | dependent = 'mort_5yr' 59 | 60 | # Generate combination of explanatory variable levels rowwise 61 | colon_s \%>\% 62 | finalfit_newdata(explanatory = explanatory, newdata = list( 63 | c("<40 years", "Submucosa", "No"), 64 | c("<40 years", "Submucosa", "Yes"), 65 | c("<40 years", "Adjacent structures", "No"), 66 | c("<40 years", "Adjacent structures", "Yes") 67 | )) -> newdata 68 | 69 | # Generate combination of explanatory variable levels colwise. 70 | explanatory = c("nodes", "extent.factor", "perfor.factor") 71 | colon_s \%>\% 72 | finalfit_newdata(explanatory = explanatory, rowwise = FALSE, newdata = list( 73 | rep(seq(0, 30), 4), 74 | c(rep("Muscle", 62), rep("Adjacent structures", 62)), 75 | c(rep("No", 31), rep("Yes", 31), rep("No", 31), rep("Yes", 31)) 76 | )) -> newdata 77 | 78 | } 79 | \seealso{ 80 | \code{\link{boot_predict}} \code{\link{boot_compare}} 81 | } 82 | -------------------------------------------------------------------------------- /man/ff_parse_formula.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{ff_parse_formula} 4 | \alias{ff_parse_formula} 5 | \title{Parse a formula to finalfit grammar} 6 | \usage{ 7 | ff_parse_formula(.formula) 8 | } 9 | \arguments{ 10 | \item{.formula}{an object of class "formula" (or one that can be coerced to that class).} 11 | } 12 | \value{ 13 | A list containing dependent, explanatory and random effects variables 14 | } 15 | \description{ 16 | Parse a formula to finalfit grammar 17 | } 18 | \examples{ 19 | ff_parse_formula(mort ~ age + sex + (1 | hospital)) 20 | } 21 | -------------------------------------------------------------------------------- /man/ff_percent_only.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_remove_ref.R 3 | \name{ff_percent_only} 4 | \alias{ff_percent_only} 5 | \alias{finalfit_percent_only} 6 | \title{Include only percentages for factors in \code{\link{summary_factorlist}} output} 7 | \usage{ 8 | ff_percent_only(.data) 9 | 10 | finalfit_percent_only(.data) 11 | } 12 | \arguments{ 13 | \item{.data}{Output from \code{\link{finalfit}} or similar.} 14 | } 15 | \value{ 16 | Data frame. 17 | } 18 | \description{ 19 | Include only percentages for factors in \code{\link{summary_factorlist}} output 20 | } 21 | \examples{ 22 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 23 | dependent = 'mort_5yr' 24 | colon_s \%>\% 25 | summary_factorlist(dependent, explanatory) \%>\% 26 | ff_percent_only() 27 | } 28 | -------------------------------------------------------------------------------- /man/ff_permute.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_permute.R 3 | \name{ff_permute} 4 | \alias{ff_permute} 5 | \alias{finalfit_permute} 6 | \title{Permuate explanatory variables to produce multiple output tables for common 7 | regression models} 8 | \usage{ 9 | ff_permute( 10 | .data, 11 | dependent = NULL, 12 | explanatory_base = NULL, 13 | explanatory_permute = NULL, 14 | multiple_tables = FALSE, 15 | include_base_model = TRUE, 16 | include_full_model = TRUE, 17 | base_on_top = TRUE, 18 | ... 19 | ) 20 | 21 | finalfit_permute( 22 | .data, 23 | dependent = NULL, 24 | explanatory_base = NULL, 25 | explanatory_permute = NULL, 26 | multiple_tables = FALSE, 27 | include_base_model = TRUE, 28 | include_full_model = TRUE, 29 | base_on_top = TRUE, 30 | ... 31 | ) 32 | } 33 | \arguments{ 34 | \item{.data}{Data frame or tibble.} 35 | 36 | \item{dependent}{Character vector of length 1: quoted name of dependent 37 | variable. Can be continuous, a binary factor, or a survival object of form 38 | \code{Surv(time, status)}.} 39 | 40 | \item{explanatory_base}{Character vector of any length: quoted name(s) of 41 | base model explanatory variables.} 42 | 43 | \item{explanatory_permute}{Character vector of any length: quoted name(s) of 44 | explanatory variables to permute through models.} 45 | 46 | \item{multiple_tables}{Logical. Multiple model tables as a list, or a single 47 | table including multiple models.} 48 | 49 | \item{include_base_model}{Logical. Include model using \code{explanatory_base} 50 | variables only.} 51 | 52 | \item{include_full_model}{Logical. Include model using all \code{explanatory_base} 53 | and \code{explanatory_permute} variables.} 54 | 55 | \item{base_on_top}{Logical. Base variables at top of table, or bottom of 56 | table.} 57 | 58 | \item{...}{Other arguments to \code{\link{finalfit}}} 59 | } 60 | \value{ 61 | Returns a list of data frame with the final model table. 62 | } 63 | \description{ 64 | Permuate explanatory variables to produce multiple output tables for common 65 | regression models 66 | } 67 | \examples{ 68 | explanatory_base = c("age.factor", "sex.factor") 69 | explanatory_permute = c("obstruct.factor", "perfor.factor", "node4.factor") 70 | 71 | # Linear regression 72 | colon_s \%>\% 73 | finalfit_permute("nodes", explanatory_base, explanatory_permute) 74 | 75 | # Cox proportional hazards regression 76 | colon_s \%>\% 77 | finalfit_permute("Surv(time, status)", explanatory_base, explanatory_permute) 78 | 79 | # Logistic regression 80 | # colon_s \%>\% 81 | # finalfit_permute("mort_5yr", explanatory_base, explanatory_permute) 82 | 83 | # Logistic regression with random effect (glmer) 84 | # colon_s \%>\% 85 | # finalfit_permute("mort_5yr", explanatory_base, explanatory_permute, 86 | # random_effect = "hospital") 87 | } 88 | -------------------------------------------------------------------------------- /man/ff_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_plot.R 3 | \name{ff_plot} 4 | \alias{ff_plot} 5 | \alias{finalfit_plot} 6 | \title{Produce a table and plot} 7 | \usage{ 8 | ff_plot(.data, dependent, explanatory, ...) 9 | 10 | finalfit_plot(.data, dependent, explanatory, ...) 11 | } 12 | \arguments{ 13 | \item{.data}{Data frame.} 14 | 15 | \item{dependent}{Character vector of length 1.} 16 | 17 | \item{explanatory}{Character vector of any length: name(s) of explanatory 18 | variables.} 19 | 20 | \item{...}{Pass arguments \code{\link{or_plot}}, \code{\link{hr_plot}}, or 21 | \code{\link{coefficient_plot}}} 22 | } 23 | \value{ 24 | A table and a plot using \code{ggplot2}. 25 | } 26 | \description{ 27 | Wraps \code{\link{or_plot}}, \code{\link{hr_plot}}, and 28 | \code{\link{coefficient_plot}} and sends to the appropriate method depending 29 | on the dependent variable type. 30 | } 31 | \examples{ 32 | # Coefficient plot 33 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 34 | dependent = "nodes" 35 | colon_s \%>\% 36 | ff_plot(dependent, explanatory) 37 | 38 | # Odds ratio plot 39 | dependent = "mort_5yr" 40 | colon_s \%>\% 41 | ff_plot(dependent, explanatory) 42 | 43 | # Hazard ratio plot 44 | dependent = "Surv(time, status)" 45 | colon_s \%>\% 46 | ff_plot(dependent, explanatory, dependent_label = "Survival") 47 | } 48 | \seealso{ 49 | Other finalfit plot functions: 50 | \code{\link{coefficient_plot}()}, 51 | \code{\link{hr_plot}()}, 52 | \code{\link{or_plot}()}, 53 | \code{\link{surv_plot}()} 54 | } 55 | \concept{finalfit plot functions} 56 | -------------------------------------------------------------------------------- /man/ff_relabel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{ff_relabel} 4 | \alias{ff_relabel} 5 | \alias{finalfit_relabel} 6 | \title{Relabel variables in a data frame} 7 | \usage{ 8 | ff_relabel(.data, .labels) 9 | 10 | finalfit_relabel(.data, .labels) 11 | } 12 | \arguments{ 13 | \item{.data}{Data frame to be relabelled} 14 | 15 | \item{.labels}{Vector of variable labels (usually created using 16 | \code{\link{extract_variable_label}}).} 17 | } 18 | \description{ 19 | Variable labels can be created using \code{\link{ff_label}}. Some functions 20 | strip variable labels (variable attributes), e.g. \code{forcats::fct_recode}. 21 | Use this function to create a vector of variable labels from a data frame. 22 | Then use \code{\link{ff_relabel}} to relabel variables in data frame. 23 | } 24 | \examples{ 25 | # Label variable 26 | colon_s$sex.factor \%>\% 27 | ff_label("Sex") \%>\% 28 | str() 29 | 30 | # Make factor level "Unknown" NA 31 | colon_s \%>\% 32 | dplyr::mutate_if(is.factor, forcats::fct_recode, 33 | NULL = "Unknown") \%>\% 34 | str() 35 | 36 | # Reset data 37 | data(colon_s) 38 | 39 | # Extract variable labels 40 | vlabels = colon_s \%>\% extract_variable_label() 41 | 42 | # Run function where labels are lost 43 | colon_s \%>\% 44 | dplyr::mutate_if(is.factor, forcats::fct_recode, 45 | NULL = "Unknown") \%>\% 46 | str() 47 | 48 | # Relabel 49 | colon_s \%<>\% ff_relabel(vlabels) 50 | colon_s \%>\% str() 51 | 52 | } 53 | -------------------------------------------------------------------------------- /man/ff_relabel_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{ff_relabel_df} 4 | \alias{ff_relabel_df} 5 | \alias{finalfit_relabel_df} 6 | \title{Relabel variables from data frame after tidyverse functions} 7 | \usage{ 8 | ff_relabel_df(.data, .df) 9 | 10 | finalfit_relabel_df(.data, .df) 11 | } 12 | \arguments{ 13 | \item{.data}{Data frame or tibble after applicaton of label stripping functions.} 14 | 15 | \item{.df}{Original data frame which contains labels.} 16 | } 17 | \value{ 18 | Data frame or tibble 19 | } 20 | \description{ 21 | Relabel variables from data frame after tidyverse functions 22 | } 23 | -------------------------------------------------------------------------------- /man/ff_remove_p.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_remove_ref.R 3 | \name{ff_remove_p} 4 | \alias{ff_remove_p} 5 | \alias{finalfit_remove_p} 6 | \title{Remove p-value from output} 7 | \usage{ 8 | ff_remove_p(.data) 9 | 10 | finalfit_remove_p(.data) 11 | } 12 | \arguments{ 13 | \item{.data}{Output from \code{\link{finalfit}} or similar.} 14 | } 15 | \value{ 16 | Data frame. 17 | } 18 | \description{ 19 | This will work with \code{\link{finalfit}} and any \code{\link{fit2df}} 20 | output. 21 | } 22 | \examples{ 23 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 24 | dependent = 'mort_5yr' 25 | colon_s \%>\% 26 | finalfit(dependent, explanatory) \%>\% 27 | ff_remove_p() 28 | } 29 | -------------------------------------------------------------------------------- /man/ff_remove_ref.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_remove_ref.R 3 | \name{ff_remove_ref} 4 | \alias{ff_remove_ref} 5 | \alias{finalfit_remove_ref} 6 | \title{Remove regression reference level row from table} 7 | \usage{ 8 | ff_remove_ref(.data, only_binary = TRUE) 9 | 10 | finalfit_remove_ref(.data, only_binary = TRUE) 11 | } 12 | \arguments{ 13 | \item{.data}{Output from \code{\link{finalfit}} or similar.} 14 | 15 | \item{only_binary}{Logical. Remove reference level only for two-level 16 | factors. When set to false, reference level for all factors removed.} 17 | } 18 | \value{ 19 | Data frame. 20 | } 21 | \description{ 22 | This looks for a column with a name including "Coefficient", "OR", or "HR" 23 | (\code{\link{finalfit}} defaults) and removes any rows with "-" (the default 24 | for the reference level). Can also be combined to produce an 25 | \code{\link{or_plot}}, see below. 26 | } 27 | \examples{ 28 | # Table example 29 | explanatory = c("age.factor", "age", "sex.factor", "nodes", "obstruct.factor", "perfor.factor") 30 | dependent = 'mort_5yr' 31 | colon_s \%>\% 32 | finalfit(dependent, explanatory, add_dependent_label = FALSE) \%>\% 33 | ff_remove_ref() \%>\% 34 | dependent_label(colon_s, dependent) 35 | 36 | # Plot example 37 | explanatory = c("age.factor", "age", "sex.factor", "nodes", "obstruct.factor", "perfor.factor") 38 | dependent = 'mort_5yr' 39 | colon_s \%>\% 40 | summary_factorlist(dependent, explanatory, total_col = TRUE, fit_id=TRUE) \%>\% 41 | ff_merge( 42 | glmuni(colon_s, dependent, explanatory) \%>\% 43 | fit2df()) \%>\% 44 | ff_remove_ref() \%>\% 45 | dplyr::select(-`OR`) -> factorlist_plot 46 | 47 | colon_s \%>\% 48 | or_plot(dependent, explanatory, factorlist = factorlist_plot) 49 | } 50 | -------------------------------------------------------------------------------- /man/ff_row_totals.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_column_totals.R 3 | \name{ff_row_totals} 4 | \alias{ff_row_totals} 5 | \alias{finalfit_row_totals} 6 | \title{Add row totals to \code{summary_factorlist()} output} 7 | \usage{ 8 | ff_row_totals( 9 | df.in, 10 | .data, 11 | dependent, 12 | explanatory, 13 | missing_column = TRUE, 14 | percent = TRUE, 15 | digits = 1, 16 | na_include_dependent = FALSE, 17 | na_complete_cases = FALSE, 18 | total_name = "Total N", 19 | na_name = "Missing N" 20 | ) 21 | 22 | finalfit_row_totals( 23 | df.in, 24 | .data, 25 | dependent, 26 | explanatory, 27 | missing_column = TRUE, 28 | percent = TRUE, 29 | digits = 1, 30 | na_include_dependent = FALSE, 31 | na_complete_cases = FALSE, 32 | total_name = "Total N", 33 | na_name = "Missing N" 34 | ) 35 | } 36 | \arguments{ 37 | \item{df.in}{\code{summary_factorlist()} output.} 38 | 39 | \item{.data}{Data frame used to create \code{summary_factorlist()}.} 40 | 41 | \item{dependent}{Character. Name of dependent variable.} 42 | 43 | \item{explanatory}{Character vector of any length: name(s) of explanatory 44 | variables.} 45 | 46 | \item{missing_column}{Logical. Include a column of counts of missing data.} 47 | 48 | \item{percent}{Logical. Include percentage.} 49 | 50 | \item{digits}{Integer length 1. Number of digits for percentage.} 51 | 52 | \item{na_include_dependent}{Logical. When TRUE, missing data in the dependent 53 | variable is included in totals.} 54 | 55 | \item{na_complete_cases}{Logical. When TRUE, missing data counts for variables 56 | are for compelte cases across all included variables.} 57 | 58 | \item{total_name}{Character. Name of total column.} 59 | 60 | \item{na_name}{Character. Name of missing column.} 61 | } 62 | \value{ 63 | Data frame. 64 | } 65 | \description{ 66 | This adds a total and missing count to variables. This is useful for 67 | continuous variables. Compare this to \code{summary_factorlist(total_col = 68 | TRUE)} which includes a count for each dummy variable as a factor and mean 69 | (sd) or median (iqr) for continuous variables. 70 | } 71 | \examples{ 72 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 73 | dependent = 'mort_5yr' 74 | colon_s \%>\% 75 | summary_factorlist(dependent, explanatory) \%>\% 76 | ff_row_totals(colon_s, dependent, explanatory) 77 | } 78 | -------------------------------------------------------------------------------- /man/ff_stratify_helper.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{ff_stratify_helper} 4 | \alias{ff_stratify_helper} 5 | \title{Help making stratified summary_factorlist tables} 6 | \usage{ 7 | ff_stratify_helper(df.out, .data) 8 | } 9 | \arguments{ 10 | \item{df.out}{Output from \code{summary_factorlist}} 11 | 12 | \item{.data}{Original data frame used for \code{summary_factorlist}.} 13 | } 14 | \description{ 15 | Help making stratified summary_factorlist tables 16 | } 17 | \examples{ 18 | library(dplyr) 19 | explanatory = c("age.factor", "sex.factor") 20 | dependent = "perfor.factor" 21 | 22 | # Pick option below 23 | split = "rx.factor" 24 | split = c("rx.factor", "node4.factor") 25 | 26 | # Piped function to generate stratified crosstabs table 27 | colon_s \%>\% 28 | group_by(!!! syms(split)) \%>\% #Looks awkward, but avoids unquoted var names 29 | group_modify(~ summary_factorlist(.x, dependent, explanatory)) \%>\% 30 | ff_stratify_helper(colon_s) 31 | } 32 | -------------------------------------------------------------------------------- /man/figures/finalfit_130_150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/man/figures/finalfit_130_150.png -------------------------------------------------------------------------------- /man/figures/finalfit_hex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/man/figures/finalfit_hex.png -------------------------------------------------------------------------------- /man/figures/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/man/figures/logo.png -------------------------------------------------------------------------------- /man/finalfit-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_package.R 3 | \docType{package} 4 | \name{finalfit-package} 5 | \alias{finalfit-package} 6 | \title{finalfit: Quickly create elegant final results tables and plots when modelling.} 7 | \description{ 8 | Quickly create elegant final results tables and plots when modelling. 9 | } 10 | \section{\code{finalfit} model wrappers}{ 11 | 12 | 13 | \link{glmuni}, 14 | \link{glmmulti}, 15 | \link{glmmulti_boot}, 16 | \link{glmmixed}, 17 | \link{lmuni}, 18 | \link{lmmulti}, 19 | \link{lmmixed}, 20 | \link{coxphuni}, 21 | \link{coxphmulti}, 22 | \link{crruni}, 23 | \link{crrmulti}, 24 | \link{svyglmuni}, 25 | \link{svyglmmulti}. 26 | } 27 | 28 | \section{\code{finalfit} model extractor}{ 29 | 30 | 31 | Generic: 32 | \link{fit2df} 33 | 34 | Methods (not called directly): 35 | \link{fit2df.glm}, 36 | \link{fit2df.glmlist}, 37 | \link{fit2df.glmboot}, 38 | \link{fit2df.lm}, 39 | \link{fit2df.lmlist}, 40 | \link{fit2df.glmerMod}, 41 | \link{fit2df.lmerMod}, 42 | \link{fit2df.coxph}, 43 | \link{fit2df.coxphlist}, 44 | \link{fit2df.crr}, 45 | \link{fit2df.crrlist}, 46 | \link{fit2df.stanfit}. 47 | } 48 | 49 | \section{\code{finalfit} all-in-one function}{ 50 | 51 | 52 | Generic: 53 | \link{finalfit}. 54 | \link{finalfit_permute}. 55 | 56 | Methods (not called directly): 57 | \link{finalfit.glm}, 58 | \link{finalfit.lm}, 59 | \link{finalfit.coxph}. 60 | } 61 | 62 | \section{\code{finalfit} plotting functions}{ 63 | 64 | 65 | \link{coefficient_plot}, 66 | \link{or_plot}, 67 | \link{hr_plot}, 68 | \link{surv_plot}, 69 | \link{ff_plot}. 70 | } 71 | 72 | \section{\code{finalfit} helper functions}{ 73 | 74 | 75 | \link{ff_glimpse}, 76 | \link{ff_label}, 77 | \link{ff_merge}, 78 | \link{ff_interaction}. 79 | } 80 | 81 | \section{\code{finalfit} prediction functions}{ 82 | 83 | 84 | \link{boot_predict}, 85 | \link{finalfit_newdata}. 86 | 87 | Methods (not called directly): 88 | \link{boot_compare}. 89 | } 90 | 91 | \section{\code{finalfit} missing data functions}{ 92 | 93 | 94 | \link{missing_glimpse}, 95 | \link{missing_pattern}, 96 | \link{missing_compare}, 97 | \link{missing_plot}, 98 | \link{missing_pairs}. 99 | } 100 | 101 | -------------------------------------------------------------------------------- /man/format_n_percent.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{format_n_percent} 4 | \alias{format_n_percent} 5 | \title{Format n and percent as a character} 6 | \usage{ 7 | format_n_percent(n, percent, digits, digits_n = 0, na_include = TRUE) 8 | } 9 | \arguments{ 10 | \item{n}{Value} 11 | 12 | \item{percent}{Value} 13 | 14 | \item{digits}{Value} 15 | 16 | \item{digits_n}{Value. Used when using weighted frequency counts} 17 | 18 | \item{na_include}{When proportion missing, include in parentheses?} 19 | } 20 | \description{ 21 | Internal, function, not called directly 22 | } 23 | -------------------------------------------------------------------------------- /man/glmmixed.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/glmmixed.R 3 | \name{glmmixed} 4 | \alias{glmmixed} 5 | \title{Mixed effects binomial logistic regression models: \code{finalfit} model wrapper} 6 | \usage{ 7 | glmmixed(.data, dependent, explanatory, random_effect, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{dependent}{Character vector of length 1, name of depdendent variable (must have 2 levels).} 13 | 14 | \item{explanatory}{Character vector of any length: name(s) of explanatory variables.} 15 | 16 | \item{random_effect}{Character vector of length 1, either, (1) name of random 17 | intercept variable, e.g. "var1", (automatically convered to "(1 | var1)"); 18 | or, (2) the full \code{lme4} specification, e.g. "(var1 | var2)". Note 19 | parenthesis MUST be included in (2) but NOT included in (1).} 20 | 21 | \item{...}{Other arguments to pass to \code{lme4::\link[lme4]{glmer}}.} 22 | } 23 | \value{ 24 | A list of multivariable \code{lme4::\link[lme4]{glmer}} fitted model outputs. 25 | Output is of class \code{glmerMod}. 26 | } 27 | \description{ 28 | Using \code{finalfit} conventions, produces mixed effects binomial logistic 29 | regression models for a set of explanatory variables against a binary dependent. 30 | } 31 | \details{ 32 | Uses \code{lme4::\link[lme4]{glmer}} with \code{finalfit} modelling conventions. Output can be 33 | passed to \code{\link{fit2df}}. This is only currently set-up to take a single random effect 34 | as a random intercept. Can be updated in future to allow multiple random intercepts, 35 | random gradients and interactions on random effects if there is a need 36 | } 37 | \examples{ 38 | library(finalfit) 39 | library(dplyr) 40 | 41 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 42 | random_effect = "hospital" 43 | dependent = "mort_5yr" 44 | 45 | colon_s \%>\% 46 | glmmixed(dependent, explanatory, random_effect) \%>\% 47 | fit2df(estimate_suffix=" (multilevel)") 48 | } 49 | \seealso{ 50 | \code{\link{fit2df}, \link{finalfit_merge}} 51 | 52 | Other finalfit model wrappers: 53 | \code{\link{coxphmulti}()}, 54 | \code{\link{coxphuni}()}, 55 | \code{\link{crrmulti}()}, 56 | \code{\link{crruni}()}, 57 | \code{\link{glmmulti_boot}()}, 58 | \code{\link{glmmulti}()}, 59 | \code{\link{glmuni}()}, 60 | \code{\link{lmmixed}()}, 61 | \code{\link{lmmulti}()}, 62 | \code{\link{lmuni}()}, 63 | \code{\link{svyglmmulti}()}, 64 | \code{\link{svyglmuni}()} 65 | } 66 | \concept{finalfit model wrappers} 67 | -------------------------------------------------------------------------------- /man/glmmulti.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/glmmulti.R 3 | \name{glmmulti} 4 | \alias{glmmulti} 5 | \title{Binomial logistic regression multivariable models: \code{finalfit} model 6 | wrapper} 7 | \usage{ 8 | glmmulti(.data, dependent, explanatory, family = "binomial", weights = "", ...) 9 | } 10 | \arguments{ 11 | \item{.data}{Data frame.} 12 | 13 | \item{dependent}{Character vector of length 1: name of dependent variable 14 | (must have 2 levels).} 15 | 16 | \item{explanatory}{Character vector of any length: name(s) of explanatory 17 | variables.} 18 | 19 | \item{family}{Character vector quoted or unquoted of the error distribution 20 | and link function to be used in the model, see \code{\link[stats]{glm}}.} 21 | 22 | \item{weights}{Character vector of length 1: name of variabe for weighting. 23 | 'Prior weights' to be used in the fitting process.} 24 | 25 | \item{...}{Other arguments to pass to \code{\link[stats]{glm}}.} 26 | } 27 | \value{ 28 | A multivariable \code{\link[stats]{glm}} fitted model. 29 | } 30 | \description{ 31 | Using \code{finalfit} conventions, produces a multivariable binomial 32 | logistic regression model for a set of explanatory variables against a 33 | binary dependent. 34 | } 35 | \details{ 36 | Uses \code{\link[stats]{glm}} with \code{finalfit} modelling conventions. 37 | Output can be passed to \code{\link{fit2df}}. 38 | } 39 | \examples{ 40 | library(finalfit) 41 | library(dplyr) 42 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 43 | dependent = "mort_5yr" 44 | 45 | colon_s \%>\% 46 | glmmulti(dependent, explanatory) \%>\% 47 | fit2df(estimate_suffix=" (multivariable)") 48 | 49 | } 50 | \seealso{ 51 | \code{\link{fit2df}, \link{finalfit_merge}} 52 | 53 | Other finalfit model wrappers: 54 | \code{\link{coxphmulti}()}, 55 | \code{\link{coxphuni}()}, 56 | \code{\link{crrmulti}()}, 57 | \code{\link{crruni}()}, 58 | \code{\link{glmmixed}()}, 59 | \code{\link{glmmulti_boot}()}, 60 | \code{\link{glmuni}()}, 61 | \code{\link{lmmixed}()}, 62 | \code{\link{lmmulti}()}, 63 | \code{\link{lmuni}()}, 64 | \code{\link{svyglmmulti}()}, 65 | \code{\link{svyglmuni}()} 66 | } 67 | \concept{finalfit model wrappers} 68 | -------------------------------------------------------------------------------- /man/glmmulti_boot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/glmmultiboot.R 3 | \name{glmmulti_boot} 4 | \alias{glmmulti_boot} 5 | \title{Binomial logistic regression multivariable models with bootstrapped 6 | confidence intervals: \code{finalfit} model wrapper} 7 | \usage{ 8 | glmmulti_boot(.data, dependent, explanatory, R = 1000) 9 | } 10 | \arguments{ 11 | \item{.data}{Dataframe.} 12 | 13 | \item{dependent}{Character vector length 1: name of depdendent variable 14 | (must have 2 levels).} 15 | 16 | \item{explanatory}{Character vector of any length: name(s) of explanatory 17 | variables.} 18 | 19 | \item{R}{Number of draws.} 20 | } 21 | \value{ 22 | A multivariable \code{\link[stats]{glm}} fitted model with 23 | bootstrapped confidence intervals. Output is of class \code{glmboot}. 24 | } 25 | \description{ 26 | Using \code{finalfit} conventions, produces a multivariable binomial logistic 27 | regression models for a set of explanatory variables against a binary 28 | dependent. 29 | } 30 | \details{ 31 | Uses \code{\link[stats]{glm}} with \code{finalfit} modelling conventions. 32 | \code{boot::\link[boot]{boot}} is used to draw bootstrapped confidence 33 | intervals on fixed effect model coefficients. Output can be passed to 34 | \code{\link{fit2df}}. 35 | } 36 | \examples{ 37 | library(finalfit) 38 | library(dplyr) 39 | ## Note number of draws set to 100 just for speed in this example 40 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 41 | dependent = "mort_5yr" 42 | 43 | colon_s \%>\% 44 | glmmulti_boot(dependent, explanatory, R=100) \%>\% 45 | fit2df(estimate_suffix="(multivariable (BS CIs))") 46 | 47 | } 48 | \seealso{ 49 | \code{\link{fit2df}, \link{finalfit_merge}} 50 | 51 | Other finalfit model wrappers: 52 | \code{\link{coxphmulti}()}, 53 | \code{\link{coxphuni}()}, 54 | \code{\link{crrmulti}()}, 55 | \code{\link{crruni}()}, 56 | \code{\link{glmmixed}()}, 57 | \code{\link{glmmulti}()}, 58 | \code{\link{glmuni}()}, 59 | \code{\link{lmmixed}()}, 60 | \code{\link{lmmulti}()}, 61 | \code{\link{lmuni}()}, 62 | \code{\link{svyglmmulti}()}, 63 | \code{\link{svyglmuni}()} 64 | } 65 | \concept{finalfit model wrappers} 66 | -------------------------------------------------------------------------------- /man/glmuni.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/glmuni.R 3 | \name{glmuni} 4 | \alias{glmuni} 5 | \title{Binomial logistic regression univariable models: \code{finalfit} model wrapper} 6 | \usage{ 7 | glmuni(.data, dependent, explanatory, family = "binomial", weights = "", ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | 12 | \item{dependent}{Character vector of length 1: name of depdendent variable (must have 2 levels).} 13 | 14 | \item{explanatory}{Character vector of any length: name(s) of explanatory variables.} 15 | 16 | \item{family}{Character vector quoted or unquoted of the error distribution 17 | and link function to be used in the model, see \code{\link[stats]{glm}}.} 18 | 19 | \item{weights}{Character vector of length 1: name of variabe for weighting. 20 | 'Prior weights' to be used in the fitting process.} 21 | 22 | \item{...}{Other arguments to pass to \code{\link[stats]{glm}}.} 23 | } 24 | \value{ 25 | A list of univariable \code{\link[stats]{glm}} fitted model outputs. 26 | Output is of class \code{glmlist}. 27 | } 28 | \description{ 29 | Using \code{finalfit} conventions, produces multiple univariable binomial logistic 30 | regression models for a set of explanatory variables against a binary dependent. 31 | } 32 | \details{ 33 | Uses \code{\link[stats]{glm}} with \code{finalfit} modelling conventions. Output can be 34 | passed to \code{\link{fit2df}}. 35 | } 36 | \examples{ 37 | library(finalfit) 38 | library(dplyr) 39 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 40 | dependent = "mort_5yr" 41 | 42 | colon_s \%>\% 43 | glmuni(dependent, explanatory) \%>\% 44 | fit2df(estimate_suffix=" (univariable)") 45 | 46 | 47 | } 48 | \seealso{ 49 | \code{\link{fit2df}, \link{finalfit_merge}} 50 | 51 | Other finalfit model wrappers: 52 | \code{\link{coxphmulti}()}, 53 | \code{\link{coxphuni}()}, 54 | \code{\link{crrmulti}()}, 55 | \code{\link{crruni}()}, 56 | \code{\link{glmmixed}()}, 57 | \code{\link{glmmulti_boot}()}, 58 | \code{\link{glmmulti}()}, 59 | \code{\link{lmmixed}()}, 60 | \code{\link{lmmulti}()}, 61 | \code{\link{lmuni}()}, 62 | \code{\link{svyglmmulti}()}, 63 | \code{\link{svyglmuni}()} 64 | } 65 | \concept{finalfit model wrappers} 66 | -------------------------------------------------------------------------------- /man/hr_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/hr_plot.R 3 | \name{hr_plot} 4 | \alias{hr_plot} 5 | \title{Produce a hazard ratio table and plot} 6 | \usage{ 7 | hr_plot( 8 | .data, 9 | dependent, 10 | explanatory, 11 | factorlist = NULL, 12 | coxfit = NULL, 13 | remove_ref = FALSE, 14 | breaks = NULL, 15 | column_space = c(-0.5, 0, 0.5), 16 | dependent_label = "Survival", 17 | prefix = "", 18 | suffix = ": HR (95\% CI, p-value)", 19 | table_text_size = 4, 20 | title_text_size = 13, 21 | plot_opts = NULL, 22 | table_opts = NULL, 23 | ... 24 | ) 25 | } 26 | \arguments{ 27 | \item{.data}{Dataframe.} 28 | 29 | \item{dependent}{Character vector of length 1: name of survival object in form \code{Surv(time, status)}.} 30 | 31 | \item{explanatory}{Character vector of any length: name(s) of explanatory variables.} 32 | 33 | \item{factorlist}{Option to provide output directly from \code{\link{summary_factorlist}()}.} 34 | 35 | \item{coxfit}{Option to provide output directly from \code{coxphmulti()}.} 36 | 37 | \item{remove_ref}{Logical. Remove reference level for factors.} 38 | 39 | \item{breaks}{Manually specify x-axis breaks in format \code{c(0.1, 1, 10)}.} 40 | 41 | \item{column_space}{Adjust table column spacing.} 42 | 43 | \item{dependent_label}{Main label for plot.} 44 | 45 | \item{prefix}{Plots are titled by default with the dependent variable. This adds text before that label.} 46 | 47 | \item{suffix}{Plots are titled with the dependent variable. This adds text after that label.} 48 | 49 | \item{table_text_size}{Alter font size of table text.} 50 | 51 | \item{title_text_size}{Alter font size of title text.} 52 | 53 | \item{plot_opts}{A list of arguments to be appended to the ggplot call by "+".} 54 | 55 | \item{table_opts}{A list of arguments to be appended to the ggplot table call by "+".} 56 | 57 | \item{...}{Other parameters passed to \code{fit2df()}.} 58 | } 59 | \value{ 60 | Returns a table and plot produced in \code{ggplot2}. 61 | } 62 | \description{ 63 | Produce hazard ratio table and plot from a Cox Proportional Hazards analysis, \code{survival::coxph()}. 64 | } 65 | \examples{ 66 | # HR plot 67 | library(finalfit) 68 | library(dplyr) 69 | library(ggplot2) 70 | 71 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 72 | dependent = "Surv(time, status)" 73 | colon_s \%>\% 74 | hr_plot(dependent, explanatory, dependent_label = "Survival") 75 | 76 | colon_s \%>\% 77 | hr_plot(dependent, explanatory, dependent_label = "Survival", 78 | table_text_size=4, title_text_size=14, 79 | plot_opts=list(xlab("HR, 95\% CI"), theme(axis.title = element_text(size=12)))) 80 | 81 | } 82 | \seealso{ 83 | Other finalfit plot functions: 84 | \code{\link{coefficient_plot}()}, 85 | \code{\link{ff_plot}()}, 86 | \code{\link{or_plot}()}, 87 | \code{\link{surv_plot}()} 88 | } 89 | \concept{finalfit plot functions} 90 | -------------------------------------------------------------------------------- /man/is.survival.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{is.survival} 4 | \alias{is.survival} 5 | \title{Test character describes survival object} 6 | \usage{ 7 | is.survival(.name) 8 | } 9 | \arguments{ 10 | \item{.name}{Character string to test} 11 | } 12 | \value{ 13 | Logical 14 | } 15 | \description{ 16 | Test character describes survival object 17 | } 18 | \examples{ 19 | var_s = "Surv(mort, time)" 20 | is.survival(var_s) #TRUE 21 | var_s = "Sur(mort, time)" 22 | is.survival(var_s) #FALSE 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/labels_to_column.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{labels_to_column} 4 | \alias{labels_to_column} 5 | \title{Labels to column names} 6 | \usage{ 7 | labels_to_column(.data) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame or tibble.} 11 | } 12 | \value{ 13 | Data frame or tibble 14 | } 15 | \description{ 16 | Labels to column names 17 | } 18 | \examples{ 19 | library(dplyr) 20 | colon_s \%>\% 21 | select(sex.factor) \%>\% 22 | labels_to_column() 23 | } 24 | -------------------------------------------------------------------------------- /man/labels_to_level.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{labels_to_level} 4 | \alias{labels_to_level} 5 | \title{Labels to level} 6 | \usage{ 7 | labels_to_level(.data, .labels) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame or tibble.} 11 | 12 | \item{.labels}{Output from \code{extract_variable_label}.} 13 | } 14 | \value{ 15 | Data frame or tibble 16 | } 17 | \description{ 18 | For use with forcats::fct_relabel. 19 | } 20 | \examples{ 21 | library(dplyr) 22 | vlabels = extract_variable_label(colon_s) 23 | colon_s \%>\% 24 | select(sex.factor, obstruct.factor) \%>\% 25 | tidyr::gather() \%>\% 26 | mutate( 27 | key = forcats::fct_relabel(key, labels_to_level, vlabels) 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /man/lmmixed.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lmmixed.R 3 | \name{lmmixed} 4 | \alias{lmmixed} 5 | \title{Mixed effects linear regression models: \code{finalfit} model wrapper} 6 | \usage{ 7 | lmmixed(.data, dependent, explanatory, random_effect, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{dependent}{Character vector of length 1, name of depdendent variable 13 | (must be continuous vector).} 14 | 15 | \item{explanatory}{Character vector of any length: name(s) of explanatory 16 | variables.} 17 | 18 | \item{random_effect}{Character vector of length 1, either, (1) name of random 19 | intercept variable, e.g. "var1", (automatically convered to "(1 | var1)"); 20 | or, (2) the full \code{lme4} specification, e.g. "(var1 | var2)". Note 21 | parenthesis MUST be included in (2)2 but NOT included in (1).} 22 | 23 | \item{...}{Other arguments to pass to \code{lme4::\link[lme4]{lmer}}.} 24 | } 25 | \value{ 26 | A list of multivariable \code{lme4::\link[lme4]{lmer}} fitted model 27 | outputs. Output is of class \code{lmerMod}. 28 | } 29 | \description{ 30 | Using \code{finalfit} conventions, produces mixed effects linear regression 31 | models for a set of explanatory variables against a continuous dependent. 32 | } 33 | \details{ 34 | Uses \code{lme4::\link[lme4]{lmer}} with \code{finalfit} modelling 35 | conventions. Output can be passed to \code{\link{fit2df}}. This is only 36 | currently set-up to take a single random effect as a random intercept. Can be 37 | updated in future to allow multiple random intercepts, random gradients and 38 | interactions on random effects if there is a need. 39 | } 40 | \examples{ 41 | library(finalfit) 42 | library(dplyr) 43 | 44 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 45 | random_effect = "hospital" 46 | dependent = "nodes" 47 | 48 | colon_s \%>\% 49 | lmmixed(dependent, explanatory, random_effect) \%>\% 50 | fit2df(estimate_suffix=" (multilevel") 51 | } 52 | \seealso{ 53 | \code{\link{fit2df}} 54 | 55 | Other finalfit model wrappers: 56 | \code{\link{coxphmulti}()}, 57 | \code{\link{coxphuni}()}, 58 | \code{\link{crrmulti}()}, 59 | \code{\link{crruni}()}, 60 | \code{\link{glmmixed}()}, 61 | \code{\link{glmmulti_boot}()}, 62 | \code{\link{glmmulti}()}, 63 | \code{\link{glmuni}()}, 64 | \code{\link{lmmulti}()}, 65 | \code{\link{lmuni}()}, 66 | \code{\link{svyglmmulti}()}, 67 | \code{\link{svyglmuni}()} 68 | } 69 | \concept{finalfit model wrappers} 70 | -------------------------------------------------------------------------------- /man/lmmulti.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lmmulti.R 3 | \name{lmmulti} 4 | \alias{lmmulti} 5 | \title{Linear regression multivariable models: \code{finalfit} model wrapper} 6 | \usage{ 7 | lmmulti(.data, dependent, explanatory, weights = "", ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{dependent}{Character vector of length 1: name of depdendent variable 13 | (must a continuous vector).} 14 | 15 | \item{explanatory}{Character vector of any length: name(s) of explanatory 16 | variables.} 17 | 18 | \item{weights}{Character vector of length 1: name of variabe for weighting. 19 | 'Prior weights' to be used in the fitting process.} 20 | 21 | \item{...}{Other arguments to pass to \code{\link[stats]{lm}}.} 22 | } 23 | \value{ 24 | A multivariable \code{\link[stats]{lm}} fitted model. 25 | } 26 | \description{ 27 | Using \code{finalfit} conventions, produces a multivariable linear regression 28 | model for a set of explanatory variables against a continuous dependent. 29 | } 30 | \details{ 31 | Uses \code{\link[stats]{lm}} with \code{finalfit} modelling conventions. 32 | Output can be passed to \code{\link{fit2df}}. 33 | } 34 | \examples{ 35 | library(finalfit) 36 | library(dplyr) 37 | 38 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 39 | dependent = "nodes" 40 | 41 | colon_s \%>\% 42 | lmmulti(dependent, explanatory) \%>\% 43 | fit2df() 44 | 45 | } 46 | \seealso{ 47 | \code{\link{fit2df}} 48 | 49 | Other finalfit model wrappers: 50 | \code{\link{coxphmulti}()}, 51 | \code{\link{coxphuni}()}, 52 | \code{\link{crrmulti}()}, 53 | \code{\link{crruni}()}, 54 | \code{\link{glmmixed}()}, 55 | \code{\link{glmmulti_boot}()}, 56 | \code{\link{glmmulti}()}, 57 | \code{\link{glmuni}()}, 58 | \code{\link{lmmixed}()}, 59 | \code{\link{lmuni}()}, 60 | \code{\link{svyglmmulti}()}, 61 | \code{\link{svyglmuni}()} 62 | } 63 | \concept{finalfit model wrappers} 64 | -------------------------------------------------------------------------------- /man/lmuni.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lmuni.R 3 | \name{lmuni} 4 | \alias{lmuni} 5 | \title{Linear regression univariable models: \code{finalfit} model wrapper} 6 | \usage{ 7 | lmuni(.data, dependent, explanatory, weights = "", ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{dependent}{Character vector of length 1, name of depdendent variable (must be continuous vector).} 13 | 14 | \item{explanatory}{Character vector of any length: name(s) of explanatory variables.} 15 | 16 | \item{weights}{Character vector of length 1: name of variabe for weighting. 17 | 'Prior weights' to be used in the fitting process.} 18 | 19 | \item{...}{Other arguments to pass to \code{\link[stats]{lm}}.} 20 | } 21 | \value{ 22 | A list of multivariable \code{\link[stats]{lm}} fitted model outputs. 23 | Output is of class \code{lmlist}. 24 | } 25 | \description{ 26 | Using \code{finalfit} conventions, produces multiple univariable linear 27 | regression models for a set of explanatory variables against a continuous dependent. 28 | } 29 | \details{ 30 | Uses \code{\link[stats]{lm}} with \code{finalfit} modelling conventions. Output can be 31 | passed to \code{\link{fit2df}}. 32 | } 33 | \examples{ 34 | library(finalfit) 35 | library(dplyr) 36 | 37 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 38 | dependent = "nodes" 39 | 40 | colon_s \%>\% 41 | lmuni(dependent, explanatory) \%>\% 42 | fit2df() 43 | 44 | } 45 | \seealso{ 46 | \code{\link{fit2df}} 47 | 48 | Other finalfit model wrappers: 49 | \code{\link{coxphmulti}()}, 50 | \code{\link{coxphuni}()}, 51 | \code{\link{crrmulti}()}, 52 | \code{\link{crruni}()}, 53 | \code{\link{glmmixed}()}, 54 | \code{\link{glmmulti_boot}()}, 55 | \code{\link{glmmulti}()}, 56 | \code{\link{glmuni}()}, 57 | \code{\link{lmmixed}()}, 58 | \code{\link{lmmulti}()}, 59 | \code{\link{svyglmmulti}()}, 60 | \code{\link{svyglmuni}()} 61 | } 62 | \concept{finalfit model wrappers} 63 | -------------------------------------------------------------------------------- /man/metrics_hoslem.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metrics_hoslem.R 3 | \name{metrics_hoslem} 4 | \alias{metrics_hoslem} 5 | \title{Hosmer-Lemeshow goodness of fit test} 6 | \source{ 7 | https://github.com/psolymos/ResourceSelection/blob/master/R/hoslem.test.R 8 | } 9 | \usage{ 10 | metrics_hoslem(y, yhat, g = 10, digits = c(2, 3)) 11 | } 12 | \arguments{ 13 | \item{y}{Observed y, usually of the form \code{fit$y}.} 14 | 15 | \item{yhat}{Predicted y_hat, usually for the form \code{fit$fitted}} 16 | 17 | \item{g}{Number of bins to calculate quantiles.} 18 | 19 | \item{digits}{Number of decimal places of form \code{c(2,3)}, where \code{digits[1]} is 20 | for chi-sq estimate and \code{digits[2]} is for p-value.} 21 | } 22 | \value{ 23 | Character string of chi-sq result, df, and p-value. Significant 24 | p-value suggests poor fit. 25 | } 26 | \description{ 27 | Internal, not usually called directly 28 | } 29 | \examples{ 30 | fit = glm(mort_5yr~age.factor+extent.factor, data=colon_s, family="binomial") 31 | metrics_hoslem(fit$y, fit$fitted) 32 | } 33 | \author{ 34 | Adapted from Peter Solymos. 35 | } 36 | -------------------------------------------------------------------------------- /man/missing_compare.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_compare.R 3 | \name{missing_compare} 4 | \alias{missing_compare} 5 | \title{Compare missing data} 6 | \usage{ 7 | missing_compare( 8 | .data, 9 | dependent, 10 | explanatory, 11 | p = TRUE, 12 | na_include = FALSE, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{.data}{Dataframe.} 18 | 19 | \item{dependent}{Variable to test missingness against other variables with.} 20 | 21 | \item{explanatory}{Variables to have missingness tested against.} 22 | 23 | \item{p}{Logical: Include null hypothesis statistical test.} 24 | 25 | \item{na_include}{Include missing data in explanatory variables as a factor 26 | level.} 27 | 28 | \item{...}{Other arguments to \code{\link{summary_factorlist}()}.} 29 | } 30 | \value{ 31 | A dataframe comparing missing data in the dependent variable across 32 | explanatory variables. Continuous data are compared with an Analysis of Variance F-test by default. 33 | Discrete data are compared with a chi-squared test. 34 | } 35 | \description{ 36 | Compare missing data 37 | } 38 | \examples{ 39 | library(finalfit) 40 | 41 | explanatory = c("age", "age.factor", "extent.factor", "perfor.factor") 42 | dependent = "mort_5yr" 43 | 44 | colon_s \%>\% 45 | ff_glimpse(dependent, explanatory) 46 | 47 | colon_s \%>\% 48 | missing_pattern(dependent, explanatory) 49 | 50 | colon_s \%>\% 51 | missing_compare(dependent, explanatory) 52 | } 53 | -------------------------------------------------------------------------------- /man/missing_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_plot.R 3 | \name{missing_df} 4 | \alias{missing_df} 5 | \title{Missing values data frame} 6 | \usage{ 7 | missing_df(.data, dependent = NULL, explanatory = NULL) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | 12 | \item{dependent}{Character vector. Optional name of dependent variable.} 13 | 14 | \item{explanatory}{Character vector. Optional name(s) of explanatory 15 | variables.} 16 | } 17 | \value{ 18 | Data frame of missing values for all variables. 19 | } 20 | \description{ 21 | Create a data frame of missing vs. observed values for all variables 22 | provided. \code{Dependent} and \code{explanatory} are for convenience and are 23 | optional. 24 | } 25 | \examples{ 26 | colon_s \%>\% 27 | missing_df() 28 | } 29 | \keyword{internal} 30 | -------------------------------------------------------------------------------- /man/missing_glimpse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_glimpse.R 3 | \name{missing_glimpse} 4 | \alias{missing_glimpse} 5 | \title{Summary of missing values} 6 | \usage{ 7 | missing_glimpse(.data, dependent = NULL, explanatory = NULL, digits = 1) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame.} 11 | 12 | \item{dependent}{Optional character vector: name(s) of depdendent 13 | variable(s).} 14 | 15 | \item{explanatory}{Optional character vector: name(s) of explanatory 16 | variable(s).} 17 | 18 | \item{digits}{Number of decmial places to show for percentage missing.} 19 | } 20 | \value{ 21 | Data frame. 22 | } 23 | \description{ 24 | Summary of missing values 25 | } 26 | \examples{ 27 | colon_s \%>\% 28 | missing_glimpse() 29 | } 30 | -------------------------------------------------------------------------------- /man/missing_pairs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_plot.R 3 | \name{missing_pairs} 4 | \alias{missing_pairs} 5 | \title{Missing values pairs plot} 6 | \usage{ 7 | missing_pairs( 8 | .data, 9 | dependent = NULL, 10 | explanatory = NULL, 11 | use_labels = TRUE, 12 | title = NULL, 13 | position = "stack", 14 | showXAxisPlotLabels = TRUE, 15 | showYAxisPlotLabels = FALSE 16 | ) 17 | } 18 | \arguments{ 19 | \item{.data}{Data frame.} 20 | 21 | \item{dependent}{Character vector. Optional name of dependent variable.} 22 | 23 | \item{explanatory}{Character vector. Optional name(s) of explanatory 24 | variables.} 25 | 26 | \item{use_labels}{Use variable label names in plot labelling.} 27 | 28 | \item{title}{Character vector. Optional title for plot.} 29 | 30 | \item{position}{For discrete variables, choose "stack" or "fill" to show 31 | counts or proportions.} 32 | 33 | \item{showXAxisPlotLabels}{Show x-axis plot labels.} 34 | 35 | \item{showYAxisPlotLabels}{Show y-axis plot labels.} 36 | } 37 | \value{ 38 | A plot matrix comparing missing values in all variables against each 39 | other. 40 | } 41 | \description{ 42 | Compare the occurence of missing values in all variables by each other. 43 | Suggest limit the number of variables to a maximum of around six. 44 | \code{Dependent} and \code{explanatory} are for convenience of variable 45 | selection, are optional, and have no other specific function. 46 | } 47 | \examples{ 48 | \dontrun{ 49 | explanatory = c("age", "nodes", "age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 50 | dependent = 'mort_5yr' 51 | colon_s \%>\% 52 | missing_pairs(dependent, explanatory) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /man/missing_pattern.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_pattern.R 3 | \name{missing_pattern} 4 | \alias{missing_pattern} 5 | \title{Characterise missing data for \code{finalfit} models} 6 | \usage{ 7 | missing_pattern( 8 | .data, 9 | dependent = NULL, 10 | explanatory = NULL, 11 | rotate.names = TRUE, 12 | ... 13 | ) 14 | } 15 | \arguments{ 16 | \item{.data}{Data frame. Missing values must be coded \code{NA}.} 17 | 18 | \item{dependent}{Character vector usually of length 1, name of depdendent 19 | variable.} 20 | 21 | \item{explanatory}{Character vector of any length: name(s) of explanatory 22 | variables.} 23 | 24 | \item{rotate.names}{Logical. Should the orientation of variable names on plot 25 | should be vertical.} 26 | 27 | \item{...}{pass other arguments such as \code{plot = TRUE} to 28 | \code{\link[mice]{md.pattern}}.} 29 | } 30 | \value{ 31 | A matrix with \code{ncol(x)+1} columns, in which each row corresponds 32 | to a missing data pattern (1=observed, 0=missing). Rows and columns are 33 | sorted in increasing amounts of missing information. The last column and 34 | row contain row and column counts, respectively. 35 | } 36 | \description{ 37 | Using \code{finalfit} conventions, produces a missing data matrix using 38 | \code{\link[mice]{md.pattern}}. 39 | } 40 | \examples{ 41 | library(finalfit) 42 | library(dplyr) 43 | explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor") 44 | dependent = "mort_5yr" 45 | 46 | colon_s \%>\% 47 | missing_pattern(dependent, explanatory) 48 | 49 | } 50 | -------------------------------------------------------------------------------- /man/missing_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_plot.R 3 | \name{missing_plot} 4 | \alias{missing_plot} 5 | \title{Missing values occurrence plot} 6 | \usage{ 7 | missing_plot( 8 | .data, 9 | dependent = NULL, 10 | explanatory = NULL, 11 | use_labels = TRUE, 12 | title = NULL, 13 | plot_opts = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{.data}{Data frame.} 18 | 19 | \item{dependent}{Character vector. Optional name of dependent variable.} 20 | 21 | \item{explanatory}{Character vector. Optional name(s) of explanatory 22 | variables.} 23 | 24 | \item{use_labels}{Use variable label names in plot labelling.} 25 | 26 | \item{title}{Character vector. Optional title for plot.} 27 | 28 | \item{plot_opts}{A list of arguments to be appended to the ggplot call by 29 | "+".} 30 | } 31 | \value{ 32 | Heat map of missing values in dataset. 33 | } 34 | \description{ 35 | Create a plot of missing values by observations on the x-axis and variable on 36 | the y-axis. \code{Dependent} and \code{explanatory} are for convenience and are optional. 37 | } 38 | \examples{ 39 | 40 | colon_s \%>\% 41 | missing_plot() 42 | } 43 | -------------------------------------------------------------------------------- /man/missing_predictorMatrix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/missing_pattern.R 3 | \name{missing_predictorMatrix} 4 | \alias{missing_predictorMatrix} 5 | \title{Create predictorMatrix for use with mice} 6 | \usage{ 7 | missing_predictorMatrix( 8 | .data, 9 | drop_from_imputed = NULL, 10 | drop_from_imputer = NULL 11 | ) 12 | } 13 | \arguments{ 14 | \item{.data}{Data frame.} 15 | 16 | \item{drop_from_imputed}{Quoted names of variables not to impute.} 17 | 18 | \item{drop_from_imputer}{Quoted names of variables not to use in imputation 19 | algorithm.} 20 | } 21 | \value{ 22 | Matrix formatted for predictorMatrix argument in mice. 23 | } 24 | \description{ 25 | Create predictorMatrix for use with mice 26 | } 27 | \examples{ 28 | library(mice) 29 | library(dplyr) 30 | 31 | # Create some extra missing data 32 | ## Smoking missing completely at random 33 | set.seed(1) 34 | colon_s$smoking_mcar = 35 | sample(c("Smoker", "Non-smoker", NA), 36 | dim(colon_s)[1], replace=TRUE, 37 | prob = c(0.2, 0.7, 0.1)) \%>\% 38 | factor() \%>\% 39 | ff_label("Smoking (MCAR)") 40 | 41 | ## Make smoking missing conditional on patient sex 42 | colon_s$smoking_mar[colon_s$sex.factor == "Female"] = 43 | sample(c("Smoker", "Non-smoker", NA), 44 | sum(colon_s$sex.factor == "Female"), 45 | replace = TRUE, prob = c(0.1, 0.5, 0.4)) 46 | 47 | colon_s$smoking_mar[colon_s$sex.factor == "Male"] = 48 | sample(c("Smoker", "Non-smoker", NA), 49 | sum(colon_s$sex.factor == "Male"), 50 | replace=TRUE, prob = c(0.15, 0.75, 0.1)) 51 | colon_s$smoking_mar = factor(colon_s$smoking_mar)\%>\% 52 | ff_label("Smoking (MAR)") 53 | 54 | explanatory = c("age", "sex.factor", 55 | "nodes", "obstruct.factor", "smoking_mar") 56 | dependent = "mort_5yr" 57 | 58 | colon_s \%>\% 59 | select(dependent, explanatory) \%>\% 60 | missing_predictorMatrix(drop_from_imputed = 61 | c("obstruct.factor", "mort_5yr")) -> predM 62 | 63 | colon_s \%>\% 64 | select(dependent, explanatory) \%>\% 65 | mice(m = 2, predictorMatrix = predM) \%>\% # e.g. m=10 when for real 66 | # Run logistic regression on each imputed set 67 | with(glm(formula(ff_formula(dependent, explanatory)), 68 | family="binomial")) \%>\% 69 | pool() \%>\% 70 | summary(conf.int = TRUE, exponentiate = TRUE) \%>\% 71 | # Jiggle into finalfit format 72 | mutate(explanatory_name = rownames(.)) \%>\% 73 | select(explanatory_name, estimate, conf.low, conf.high, p.value) \%>\% 74 | condense_fit(estimate_suffix = " (multiple imputation)") \%>\% 75 | remove_intercept() -> fit_imputed 76 | 77 | } 78 | -------------------------------------------------------------------------------- /man/p_tidy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{p_tidy} 4 | \alias{p_tidy} 5 | \title{Round p-values but keep trailing zeros} 6 | \usage{ 7 | p_tidy(x, digits, prefix = "=") 8 | } 9 | \arguments{ 10 | \item{x}{Numeric vector of values to round} 11 | 12 | \item{digits}{Integer of length one: value to round to.} 13 | 14 | \item{prefix}{Appended in front of values for use with \code{condense_fit}.} 15 | } 16 | \value{ 17 | Vector of strings. 18 | } 19 | \description{ 20 | Internal function, not called directly 21 | } 22 | \details{ 23 | e.g. for 3 decimal places I want 0.100, not 0.1. Note this function with 24 | convert 0.000 to <0.001. All other values are prefixed with "=" by default 25 | } 26 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_package.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \description{ 10 | Pipe operator 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/plot_title.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{plot_title} 4 | \alias{plot_title} 5 | \title{Label plot title} 6 | \usage{ 7 | plot_title(.data, dependent, dependent_label, prefix = "", suffix = "") 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{dependent}{Character vector of length 1: quoted name of dependent 13 | variable. Can be continuous, a binary factor, or a survival object of form 14 | \code{Surv(time, status)}} 15 | 16 | \item{prefix}{Prefix for dependent label} 17 | 18 | \item{suffix}{Suffix for dependent label} 19 | } 20 | \description{ 21 | Not called directly. 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/print.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{print.data.frame.ff} 4 | \alias{print.data.frame.ff} 5 | \title{Print methods for finalfit data frames} 6 | \usage{ 7 | \method{print}{data.frame.ff}(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{Data frame} 11 | } 12 | \value{ 13 | Data frame with no line numbers 14 | } 15 | \description{ 16 | Print methods for finalfit data frames 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/remove_intercept.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{remove_intercept} 4 | \alias{remove_intercept} 5 | \title{Remove intercept from model output} 6 | \usage{ 7 | remove_intercept(.data, intercept_name = "(Intercept)") 8 | } 9 | \arguments{ 10 | \item{.data}{Numeric vector of values to round} 11 | 12 | \item{intercept_name}{Name given to interept in model. Should never have to 13 | change from default.} 14 | } 15 | \value{ 16 | Vector of strings. 17 | } 18 | \description{ 19 | Internal function, not called directly 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/remove_labels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_label.R 3 | \name{remove_labels} 4 | \alias{remove_labels} 5 | \title{Remove variable labels.} 6 | \usage{ 7 | remove_labels(.data) 8 | } 9 | \arguments{ 10 | \item{.data}{Data frame} 11 | } 12 | \value{ 13 | The original data frame with variable label attributes removed. 14 | } 15 | \description{ 16 | Remove variable labels. 17 | } 18 | \examples{ 19 | colon_s \%>\% 20 | remove_labels() 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/rm_duplicate_labels.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{rm_duplicate_labels} 4 | \alias{rm_duplicate_labels} 5 | \title{Remove duplicate levels within \code{\link{summary_factorlist}}: \code{finalfit} helper function} 6 | \usage{ 7 | rm_duplicate_labels(factorlist, na_to_missing = TRUE) 8 | } 9 | \arguments{ 10 | \item{factorlist}{A factorlist intermediary.} 11 | 12 | \item{na_to_missing}{Logical: convert \code{NA} to 'Missing' when \code{na_include=TRUE}.} 13 | } 14 | \value{ 15 | Returns a \code{factorlist} dataframe. 16 | } 17 | \description{ 18 | Not called directly. 19 | } 20 | \keyword{internal} 21 | -------------------------------------------------------------------------------- /man/rm_duplicates.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{rm_duplicates} 4 | \alias{rm_duplicates} 5 | \title{Remove duplicates and replace} 6 | \usage{ 7 | rm_duplicates(.var, fromLast = FALSE, replacement = "") 8 | } 9 | \arguments{ 10 | \item{.var}{Vector.} 11 | 12 | \item{fromLast}{Logical. Consider duplication from last to first.} 13 | 14 | \item{replacement}{Character for what to replace duplicate with.} 15 | } 16 | \value{ 17 | Character vector. 18 | } 19 | \description{ 20 | Remove duplicates and replace 21 | } 22 | -------------------------------------------------------------------------------- /man/rm_empty_block.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{rm_empty_block} 4 | \alias{rm_empty_block} 5 | \title{Remove rows where all specified variables are missing} 6 | \usage{ 7 | rm_empty_block(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{...}{Unquoted variable/column names.} 13 | } 14 | \value{ 15 | Data frame. 16 | } 17 | \description{ 18 | It is common to want to remove cases/rows where all variables in a particular set are missing, 19 | e.g. all symptom variables are missing in a health care dataset. 20 | } 21 | \examples{ 22 | # Pretend that we want to remove rows that are missing in group1, group2, and group3 23 | # but keep rest of dataset. 24 | colon_s \%>\% 25 | dplyr::mutate( 26 | group1 = rep(c(NA, 1), length.out = 929), 27 | group2 = rep(c(NA, 1), length.out = 929), 28 | group3 = rep(c(NA, 1), length.out = 929) 29 | ) \%>\% 30 | rm_empty_block(group1, group2, group3) \%>\% 31 | head() 32 | } 33 | -------------------------------------------------------------------------------- /man/round_tidy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{round_tidy} 4 | \alias{round_tidy} 5 | \title{Round values but keep trailing zeros} 6 | \usage{ 7 | round_tidy(x, digits) 8 | } 9 | \arguments{ 10 | \item{x}{Numeric vector of values to round} 11 | 12 | \item{digits}{Integer of length one: value to round to.} 13 | } 14 | \value{ 15 | Vector of strings. 16 | } 17 | \description{ 18 | e.g. for 3 decimal places I want 1.200, not 1.2. 19 | } 20 | \examples{ 21 | round_tidy(0.01023, 3) 22 | } 23 | -------------------------------------------------------------------------------- /man/summary_df.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ff_newdata.R 3 | \name{summary_df} 4 | \alias{summary_df} 5 | \title{Summarise with mode for factors and mean/median for numeric variables} 6 | \usage{ 7 | summary_df(.data, cont = "mean") 8 | } 9 | \arguments{ 10 | \item{.data}{A data frame or tibble.} 11 | 12 | \item{cont}{One of "mean" or "median": the summary estimate for continuous variables.} 13 | } 14 | \value{ 15 | A data frame or tibble with the mode for factors and mean/median 16 | for continuous variables. 17 | } 18 | \description{ 19 | When producing conditional estimates from a regression model, it is often useful 20 | to set variables not of interest to their mode for factors and mean or median for numerics 21 | when creating the newdata object. 22 | } 23 | \examples{ 24 | library(dplyr) 25 | colon_s \%>\% 26 | select(age, sex.factor, obstruct.factor, perfor.factor) \%>\% 27 | summary_df() 28 | 29 | colon_s \%>\% 30 | select(age, sex.factor, obstruct.factor, perfor.factor) \%>\% 31 | summary_df(cont = "median") 32 | } 33 | \seealso{ 34 | \code{\link{ff_mode}} \code{\link{ff_expand}} 35 | } 36 | -------------------------------------------------------------------------------- /man/summary_factorlist_stratified.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/summaryfactorlist.R 3 | \name{summary_factorlist_stratified} 4 | \alias{summary_factorlist_stratified} 5 | \title{Summarise a set of factors (or continuous variables) by a dependent variable} 6 | \usage{ 7 | summary_factorlist_stratified( 8 | .data, 9 | ..., 10 | split, 11 | colname_sep = "|", 12 | level_max_length = 10, 13 | n_common_cols = 2 14 | ) 15 | } 16 | \arguments{ 17 | \item{.data}{Dataframe.} 18 | 19 | \item{...}{Arguments to \code{\link{summary_factorlist}}.} 20 | 21 | \item{split}{Quoted variable name to stratify columns by.} 22 | 23 | \item{colname_sep}{Separator for creation of new column name.} 24 | 25 | \item{level_max_length}{Maximum name for each factor level contributing to column name.} 26 | 27 | \item{n_common_cols}{Number of common columns in \code{\link{summary_factorlist}} table, usually 2.} 28 | } 29 | \value{ 30 | Dataframe. 31 | } 32 | \description{ 33 | A function that takes a single dependent variable with a vector of 34 | explanatory variable names (continuous or categorical variables) to produce a 35 | summary table. 36 | } 37 | \details{ 38 | This function aims to produce publication-ready summary tables for 39 | categorical or continuous dependent variables. It usually takes a categorical 40 | dependent variable to produce a cross table of counts and proportions 41 | expressed as percentages or summarised continuous explanatory variables. 42 | However, it will take a continuous dependent variable to produce mean 43 | (standard deviation) or median (interquartile range) for use with linear 44 | regression models. 45 | Stratify a \code{\link{summary_factorlist}} table (beta testing) 46 | } 47 | \examples{ 48 | # Table 1 - Perforation status stratified by sex ---- 49 | explanatory = c("age", "obstruct.factor") 50 | dependent = "perfor.factor" 51 | 52 | # Single split 53 | colon_s \%>\% 54 | summary_factorlist_stratified(dependent, explanatory, split = c("sex.factor")) 55 | 56 | # Double split 57 | colon_s \%>\% 58 | summary_factorlist_stratified(dependent, explanatory, split = c("sex.factor", "age.factor")) 59 | } 60 | -------------------------------------------------------------------------------- /man/summary_mipo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{summary_mipo} 4 | \alias{summary_mipo} 5 | \title{Call to mice:::summary.mipo} 6 | \usage{ 7 | summary_mipo( 8 | object, 9 | type = c("tests", "all"), 10 | conf.int = FALSE, 11 | conf.level = 0.95, 12 | exponentiate = FALSE, 13 | ... 14 | ) 15 | } 16 | \description{ 17 | Not called directly. 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /man/surv_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/surv_plot.R 3 | \name{surv_plot} 4 | \alias{surv_plot} 5 | \title{Plot survival curves with number-at-risk table} 6 | \usage{ 7 | surv_plot(.data, dependent, explanatory, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{Dataframe.} 11 | 12 | \item{dependent}{Character vector of length 1: Survival object of the form \code{Surv(time, status)}.} 13 | 14 | \item{explanatory}{Character vector of max length 2: quoted name(s) of explanatory variables.} 15 | 16 | \item{...}{Arguments passed to \code{\link[survminer]{ggsurvplot}}.} 17 | } 18 | \value{ 19 | Returns a table and plot produced in \code{ggplot2}. 20 | } 21 | \description{ 22 | Produce a survival curve plot and number-at-risk table using \code{survminer::ggsurvplot} 23 | and \code{finalfit} conventions. 24 | } 25 | \examples{ 26 | library(finalfit) 27 | library(dplyr) 28 | 29 | # Survival plot 30 | data(colon_s) 31 | explanatory = c("perfor.factor") 32 | dependent = "Surv(time, status)" 33 | colon_s \%>\% 34 | surv_plot(dependent, explanatory, xlab="Time (days)", pval=TRUE, legend="none") 35 | 36 | } 37 | \seealso{ 38 | Other finalfit plot functions: 39 | \code{\link{coefficient_plot}()}, 40 | \code{\link{ff_plot}()}, 41 | \code{\link{hr_plot}()}, 42 | \code{\link{or_plot}()} 43 | } 44 | \concept{finalfit plot functions} 45 | -------------------------------------------------------------------------------- /man/variable_type.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_internal_functions.R 3 | \name{variable_type} 4 | \alias{variable_type} 5 | \title{Determine type/class of a variable} 6 | \usage{ 7 | variable_type(.var) 8 | } 9 | \arguments{ 10 | \item{.var}{A vector, data frame column, or equivalent.} 11 | } 12 | \value{ 13 | One of "factor", "character", "numeric", "logical", "date". 14 | } 15 | \description{ 16 | Determine type/class of a variable 17 | } 18 | \examples{ 19 | var_d = as.Date("12.03.18", "\%d.\%m.\%y") 20 | var_f = factor(c("yes", "no")) 21 | var_c = c("yes", "no") 22 | var_n = 1:10 23 | var_l = as.logical(c("true", "false")) 24 | variable_type(var_d) 25 | variable_type(var_f) 26 | variable_type(var_c) 27 | variable_type(var_n) 28 | variable_type(var_l) 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /man/wcgs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/finalfit_package.R 3 | \docType{data} 4 | \name{wcgs} 5 | \alias{wcgs} 6 | \title{Western Collaborative Group Study} 7 | \format{ 8 | A data frame with 3154 observations on the following 13 variables. 9 | \describe{ \item{\code{id}}{ Subject ID } \item{\code{age}}{ Age: age in 10 | years } \item{\code{height}}{ Height: height in inches } 11 | \item{\code{weight}}{ Weight: weight in pounds } \item{\code{sbp}}{ 12 | Systolic blood pressure: mmHg } \item{\code{dbp}}{ Diastolic blood 13 | pressure: mmHg } \item{\code{chol}}{ Cholesterol: mg/100 ml } 14 | \item{\code{personality}}{Personality type/Behavior pattern: a factor with 15 | levels \code{A1}, \code{A2}, \code{B3}, \code{B4} } 16 | \item{\code{personality_2L}}{ Dichotomous personality type / behavior 17 | pattern: \code{A} = aggressive; \code{B} = passive } \item{\code{ncigs}}{ 18 | Smoking: Cigarettes/day } \item{\code{smoking}}{ Smoking: \code{No}, 19 | \code{Yes} } \item{\code{arcus}}{ Corneal arcus: \code{No}, \code{Yes} } 20 | \item{\code{chd}}{ Coronary heart disease event: \code{No} \code{Yes}} 21 | \item{\code{typechd}}{ coronary heart disease is a factor with levels 22 | \code{No}, \code{MI_SD} (MI or sudden death), \code{Silent_MI}, 23 | \code{Angina} } \item{\code{timechd}}{ Observation (follow up) time: Days } 24 | } 25 | } 26 | \source{ 27 | Statistics for Epidemiology by N. Jewell (2004) 28 | } 29 | \usage{ 30 | data(wcgs) 31 | } 32 | \description{ 33 | 3154 healthy young men aged 39-59 from the San Francisco area were assessed 34 | for their personality type. All were free from coronary heart disease at the 35 | start of the research. Eight and a half years later change in this situation 36 | was recorded. 37 | } 38 | \details{ 39 | The WCGS began in 1960 with 3,524 male volunteers who were employed by 11 40 | California companies. Subjects were 39 to 59 years old and free of heart 41 | disease as determined by electrocardiogram. After the initial screening, the 42 | study population dropped to 3,154 and the number of companies to 10 because 43 | of various exclusions. The cohort comprised both blue- and white-collar 44 | employees. At baseline the following information was collected: 45 | socio-demographic including age, education, marital status, income, 46 | occupation; physical and physiological including height, weight, blood 47 | pressure, electrocardiogram, and corneal arcus; biochemical including 48 | cholesterol and lipoprotein fractions; medical and family history and use of 49 | medications; behavioral data including Type A interview, smoking, exercise, 50 | and alcohol use. Later surveys added data on anthropometry, triglycerides, 51 | Jenkins Activity Survey, and caffeine use. Average follow-up continued for 52 | 8.5 years with repeat examinations 53 | } 54 | \references{ 55 | Coronary Heart Disease in the Western Collaborative Group Study 56 | Final Follow-up Experience of 8 1/2 Years Ray H. Rosenman, MD; Richard J. 57 | Brand, PhD; C. David Jenkins, PhD; Meyer Friedman, MD; Reuben Straus, MD; 58 | Moses Wurm, MD JAMA. 1975;233(8):872-877. 59 | doi:10.1001/jama.1975.03260080034016. 60 | } 61 | \keyword{data} 62 | -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(finalfit) 3 | 4 | test_check("finalfit") 5 | -------------------------------------------------------------------------------- /tests/testthat/Rplots.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/tests/testthat/Rplots.pdf -------------------------------------------------------------------------------- /tests/testthat/test_boot.R: -------------------------------------------------------------------------------- 1 | context("Bootstrapping") 2 | library(finalfit) 3 | 4 | test_that("ff_newdata gives dataframe", { 5 | expect_is(ff_newdata(colon_s, explanatory = c("age.factor", "extent.factor"), newdata = list( 6 | c("<40 years", "Submucosa"), 7 | c("<40 years", "Submucosa"))) -> newdata, 8 | "data.frame") 9 | }) 10 | 11 | test_that("ff_newdata gives dataframe", { 12 | expect_is(ff_newdata(colon_s, explanatory = c("nodes", "extent.factor", "perfor.factor"), rowwise = FALSE, 13 | newdata = list( 14 | rep(seq(0, 30), 4), 15 | c(rep("Muscle", 62), rep("Adjacent structures", 62)), 16 | c(rep("No", 31), rep("Yes", 31), rep("No", 31), rep("Yes", 31)) 17 | )) -> newdata, 18 | "data.frame") 19 | }) 20 | 21 | test_that("ff_newdata gives dataframe", { 22 | expect_is(colon_s %>% 23 | glmmulti("mort_5yr", c("age.factor", "extent.factor")) %>% 24 | boot_predict(newdata = ff_newdata(colon_s, explanatory = c("age.factor", "extent.factor"), 25 | newdata = list( 26 | c("<40 years", "Submucosa"), 27 | c("<40 years", "Submucosa"))), 28 | estimate_name = "Predicted probability of death", 29 | compare_name = "Absolute risk difference", R=40, digits = c(2,3)), 30 | "data.frame") 31 | }) 32 | 33 | test_that("ff_newdata gives dataframe", { 34 | expect_is(colon_s %>% 35 | glmmulti("mort_5yr", c("age.factor", "extent.factor")) %>% 36 | boot_predict(newdata = ff_newdata(colon_s, explanatory = c("age.factor", "extent.factor"), 37 | newdata = list( 38 | c("<40 years", "Submucosa"), 39 | c("<40 years", "Submucosa"))), 40 | condense = FALSE, 41 | comparison = "ratio", R=40, digits = c(2,3)), 42 | "data.frame") 43 | }) 44 | -------------------------------------------------------------------------------- /tests/testthat/test_check_recode.R: -------------------------------------------------------------------------------- 1 | context("check_recode") 2 | library(finalfit) 3 | test_that("check_recode gives list", { 4 | expect_is(check_recode(colon_s[,1:2]), "list") 5 | }) 6 | 7 | test_that("check_recode gives list", { 8 | expect_is(check_recode(colon_s[,1:2], include_numerics = TRUE), "list") 9 | }) 10 | 11 | -------------------------------------------------------------------------------- /tests/testthat/test_ff_metrics.R: -------------------------------------------------------------------------------- 1 | context("Metrics") 2 | library(finalfit) 3 | test_that("ff_metrics glm", { 4 | expect_is(glm(mort_5yr ~ age.factor, data=colon_s, family="binomial") %>% 5 | ff_metrics(), "data.frame") 6 | }) 7 | 8 | 9 | test_that("ff_metrics glmlist", { 10 | expect_is(glmmulti(colon_s, "mort_5yr", "age.factor") %>% 11 | ff_metrics(), "data.frame") 12 | }) 13 | 14 | test_that("ff_metrics glmerMod", { 15 | expect_is(glmmixed(colon_s, "mort_5yr", "age.factor", "hospital") %>% 16 | ff_metrics(), "data.frame") 17 | }) 18 | 19 | 20 | test_that("ff_metrics lm", { 21 | expect_is(lm(nodes ~ age.factor, data=colon_s) %>% 22 | ff_metrics(), "data.frame") 23 | }) 24 | 25 | test_that("ff_metrics lmerlist", { 26 | expect_is(lmmulti(colon_s, "nodes", "age.factor") %>% 27 | ff_metrics(), "data.frame") 28 | }) 29 | 30 | 31 | test_that("ff_metrics lmermixed", { 32 | expect_is(lmmixed(colon_s, "nodes", "age.factor", "hospital") %>% 33 | ff_metrics(), "data.frame") 34 | }) 35 | 36 | test_that("ff_metrics coxphlist", { 37 | expect_is(coxphmulti(colon_s, "Surv(time, status)", "age.factor") %>% 38 | ff_metrics(), "data.frame") 39 | }) 40 | 41 | test_that("ff_metrics coxph", { 42 | expect_is(survival::coxph(survival::Surv(time, status) ~ age.factor, data = colon_s) %>% 43 | ff_metrics(), "data.frame") 44 | }) 45 | -------------------------------------------------------------------------------- /tests/testthat/test_ffs.R: -------------------------------------------------------------------------------- 1 | context("ff") 2 | library(finalfit) 3 | test_that("ff_columns_totals gives data.frame", { 4 | expect_is(summary_factorlist(colon_s, "mort_5yr", "age.factor") %>% 5 | ff_column_totals(colon_s, "mort_5yr"), "data.frame") 6 | }) 7 | -------------------------------------------------------------------------------- /tests/testthat/test_interactions.R: -------------------------------------------------------------------------------- 1 | context("Interactions") 2 | library(finalfit) 3 | test_that("ff_interaction", { 4 | expect_is(colon_s %>% ff_interaction(sex.factor, perfor.factor), "data.frame") 5 | }) 6 | -------------------------------------------------------------------------------- /tests/testthat/test_internals.R: -------------------------------------------------------------------------------- 1 | context("Internals") 2 | library(finalfit) 3 | test_that("ff_merge fit_id==NULL", { 4 | expect_error(ff_merge(summary_factorlist(colon_s, "mort_5yr", "age.factor"))) 5 | }) 6 | 7 | test_that("ff_merge fit_id==NULL", { 8 | expect_error(finalfit_merge(summary_factorlist(colon_s, "mort_5yr", "age.factor"))) 9 | }) 10 | 11 | test_that("extract_variable_label gives character", { 12 | expect_is(extract_variable_label(colon_s[,1:2]), "character") 13 | }) 14 | 15 | 16 | test_that("round_tidy", { 17 | expect_is(round_tidy(1.123, 2), "character") 18 | }) 19 | 20 | test_that("p_tidy", { 21 | expect_is(p_tidy(1.123, 2), "character") 22 | }) 23 | 24 | test_that("dependent_label", { 25 | expect_is( 26 | summary_factorlist(colon_s, "mort_5yr", "age.factor") %>% 27 | dependent_label(colon_s, "mort_5yr"), "data.frame") 28 | }) 29 | 30 | 31 | test_that("extract_labels", { 32 | expect_is(extract_labels(colon_s[,1:2]), "data.frame") 33 | }) 34 | 35 | test_that("extract_variable_labels", { 36 | expect_is(extract_variable_label(colon_s[,1:2]), "character") 37 | }) 38 | 39 | test_that("remove_label", { 40 | expect_is(remove_labels(colon_s[,1:2]), "data.frame") 41 | }) 42 | 43 | test_that("missing_glimpse", { 44 | expect_is(missing_glimpse(colon_s, digits=2), "data.frame") 45 | }) 46 | 47 | test_that("missing_glimpse", { 48 | expect_is(missing_glimpse(colon_s, dependent="mort_5yr"), "data.frame") 49 | }) 50 | 51 | test_that("variable type works", { 52 | expect_match(variable_type(as.Date("12.03.18", "%d.%m.%y")), "date") 53 | }) 54 | 55 | test_that("variable type works", { 56 | expect_match(variable_type(factor(c("yes", "no"))), "factor") 57 | }) 58 | 59 | test_that("variable type works", { 60 | expect_match(variable_type(c("yes", "no")), "character") 61 | }) 62 | 63 | test_that("variable type works", { 64 | expect_match(variable_type(1:10), "numeric") 65 | }) 66 | 67 | test_that("variable type works", { 68 | expect_match(variable_type(as.logical(c("true", "false"))), "logical") 69 | }) 70 | 71 | test_that("is.factor", { 72 | expect_true(is.survival("Surv(mort, time)")) 73 | }) 74 | 75 | test_that("is.factor", { 76 | expect_false(is.survival("Sur(mort, time)")) 77 | }) 78 | 79 | 80 | test_that("is.factor", { 81 | expect_false(is.survival("Sur(mort, time)")) 82 | }) 83 | 84 | test_that("ff_label", { 85 | expect_is(colon_s$sex.factor %>% ff_label("Sex"), "factor") 86 | }) 87 | 88 | test_that("finalfit_label", { 89 | expect_is(colon_s$sex.factor %>% finalfit_label("Sex"), "factor") 90 | }) 91 | 92 | 93 | test_that("finalfit_label", { 94 | expect_is(colon_s %>% 95 | extract_variable_label() %>% 96 | ff_relabel(colon_s, .), "data.frame") 97 | }) 98 | -------------------------------------------------------------------------------- /tests/testthat/test_missing.R: -------------------------------------------------------------------------------- 1 | context("Missing") 2 | library(finalfit) 3 | 4 | test_that("ff_glimpse gives list", { 5 | expect_is(ff_glimpse(colon_s, explanatory = c("age", "age.factor")), "list") 6 | }) 7 | 8 | 9 | test_that("missing_pattern gives matrix", { 10 | expect_is(missing_pattern(colon_s, "mort_5yr", c("age", "age.factor")), "matrix") 11 | }) 12 | 13 | test_that("missing_pattern gives matrix", { 14 | expect_is(missing_pattern(colon_s), "matrix") 15 | }) 16 | 17 | test_that("missing_pairs gives plot", { 18 | expect_is(missing_pairs(colon_s, explanatory = c("age", "age.factor")), "ggmatrix") 19 | }) 20 | 21 | test_that("missing_pairs gives plot", { 22 | expect_is(missing_compare(colon_s, "mort_5yr", explanatory = c("age", "age.factor")), "data.frame") 23 | }) 24 | 25 | test_that("missing_predictorMatrix gives matrix", { 26 | expect_is(colon_s %>% 27 | dplyr::select(age, age.factor) %>% 28 | missing_predictorMatrix(drop_from_imputed = "age") -> predM, 29 | "matrix") 30 | }) 31 | -------------------------------------------------------------------------------- /tests/testthat/test_plots.R: -------------------------------------------------------------------------------- 1 | context("Plots") 2 | library(finalfit) 3 | 4 | test_that("or_plot gives plot", { 5 | expect_is(or_plot(colon_s, "mort_5yr", "age.factor"), "grob") 6 | }) 7 | 8 | test_that("hr_plot gives plot", { 9 | expect_is(hr_plot(colon_s, "Surv(time, status)", "age.factor"), "grob") 10 | }) 11 | 12 | 13 | test_that("or_plot gives plot with remove ref level", { 14 | expect_is(or_plot(colon_s, "mort_5yr", "age.factor", remove_ref = TRUE), "grob") 15 | }) 16 | 17 | test_that("hr_plot gives plot with remove ref level", { 18 | expect_is(hr_plot(colon_s, "Surv(time, status)", c("age.factor", "sex.factor"), remove_ref = TRUE), "grob") 19 | }) 20 | 21 | 22 | test_that("surv_plot gives plot", { 23 | expect_is(surv_plot(colon_s, "Surv(time, status)", "age.factor"), "ggsurvplot") 24 | }) 25 | 26 | test_that("missing_plot gives plot", { 27 | expect_is(missing_plot(colon_s[,1:2]), "ggplot") 28 | }) 29 | 30 | test_that("missing_plot gives plot", { 31 | expect_is(missing_plot(colon_s[,1:2]), "ggplot") 32 | }) 33 | 34 | test_that("missing_plot gives plot", { 35 | expect_is(missing_plot(colon_s[,1:2]), "ggplot") 36 | }) 37 | 38 | test_that("ff_plot gives grob", { 39 | expect_is(ff_plot(colon_s, "nodes", "age.factor"), "grob") 40 | }) 41 | 42 | test_that("ff_plot gives grob", { 43 | expect_is(ff_plot(colon_s, "mort_5yr", "age.factor"), "grob") 44 | }) 45 | 46 | test_that("ff_plot gives grob", { 47 | expect_is(ff_plot(colon_s, "Surv(time, status)", "age.factor"), "grob") 48 | }) 49 | -------------------------------------------------------------------------------- /tests/testthat/test_tests.R: -------------------------------------------------------------------------------- 1 | context("Statistical tests") 2 | library(finalfit) 3 | test_that("catTestfisher works", { 4 | expect_is(summary_factorlist(colon_s, "mort_5yr", "age.factor"), "data.frame") 5 | }) 6 | 7 | -------------------------------------------------------------------------------- /tests/testthat/testthat-problems.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ewenharrison/finalfit/3de1fc6fba91e6d851ca5b358e9b21165461cd86/tests/testthat/testthat-problems.rds -------------------------------------------------------------------------------- /vignettes/bootstrap.R: -------------------------------------------------------------------------------- 1 | ## ----setup, include = FALSE---------------------------------------------- 2 | knitr::opts_chunk$set( 3 | collapse = TRUE, 4 | comment = "#>" 5 | ) 6 | 7 | ## ---- eval=FALSE--------------------------------------------------------- 8 | # install.packages("finalfit") 9 | 10 | ## ------------------------------------------------------------------------ 11 | library(finalfit) 12 | explanatory = c("age.factor", "extent.factor", "perfor.factor") 13 | dependent = 'mort_5yr' 14 | 15 | colon_s %>% 16 | finalfit_newdata(explanatory = explanatory, newdata = list( 17 | c("<40 years", "Submucosa", "No"), 18 | c("<40 years", "Submucosa", "Yes"), 19 | c("<40 years", "Adjacent structures", "No"), 20 | c("<40 years", "Adjacent structures", "Yes") )) -> newdata 21 | newdata 22 | 23 | ## ------------------------------------------------------------------------ 24 | colon_s %>% 25 | glmmulti(dependent, explanatory) %>% 26 | boot_predict(newdata, 27 | estimate_name = "Predicted probability of death", 28 | R=100, boot_compare = FALSE, 29 | digits = c(2,3)) 30 | 31 | ## ---- eval=FALSE--------------------------------------------------------- 32 | # knitr::kable(table, row.names = FALSE, align = c("l", "l", "l", "r")) 33 | 34 | ## ------------------------------------------------------------------------ 35 | colon_s %>% 36 | glmmulti(dependent, explanatory) %>% 37 | boot_predict(newdata, 38 | estimate_name = "Predicted probability of death", 39 | compare_name = "Absolute risk difference", 40 | R=100, digits = c(2,3)) 41 | 42 | ## ---- eval=FALSE--------------------------------------------------------- 43 | # library(finalfit) 44 | # library(ggplot2) 45 | # theme_set(theme_bw()) 46 | # 47 | # explanatory = c("nodes", "extent.factor", "perfor.factor") 48 | # dependent = 'mort_5yr' 49 | # 50 | # colon_s %>% 51 | # finalfit_newdata(explanatory = explanatory, rowwise = FALSE, 52 | # newdata = list( 53 | # rep(seq(0, 30), 4), 54 | # c(rep("Muscle", 62), rep("Adjacent structures", 62)), 55 | # c(rep("No", 31), rep("Yes", 31), rep("No", 31), rep("Yes", 31)) 56 | # ) 57 | # ) -> newdata 58 | # 59 | # colon_s %>% 60 | # glmmulti(dependent, explanatory) %>% 61 | # boot_predict(newdata, boot_compare = FALSE, 62 | # R=100, condense=FALSE) %>% 63 | # ggplot(aes(x = nodes, y = estimate, ymin = estimate_conf.low, 64 | # ymax = estimate_conf.high, fill=extent.factor))+ 65 | # geom_line(aes(colour = extent.factor))+ 66 | # geom_ribbon(alpha=0.1)+ 67 | # facet_grid(.~perfor.factor)+ 68 | # xlab("Number of postive lymph nodes")+ 69 | # ylab("Probability of death")+ 70 | # labs(fill = "Extent of tumour", colour = "Extent of tumour")+ 71 | # ggtitle("Probability of death by lymph node count") 72 | 73 | -------------------------------------------------------------------------------- /vignettes/data_prep.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Preparing data for finalfit" 3 | author: "Ewen Harrison" 4 | output: rmarkdown::html_vignette 5 | vignette: > 6 | %\VignetteIndexEntry{Preparing data for finalfit} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | %\VignetteEncoding{UTF-8} 9 | --- 10 | 11 | ```{r setup, include = FALSE} 12 | knitr::opts_chunk$set( 13 | collapse = TRUE, 14 | comment = "#>" 15 | ) 16 | ``` 17 | 18 | This vignette shows you how to upload and prepare any dataset for use with finalfit. The demonstration will use the `boot::melanoma`. Use `?boot::melanoma` to see the help page with data description. I will use `library(tidyverse)` methods. First I'll `write_csv()` the data just to demonstrate reading it. 19 | 20 | ## Read data 21 | 22 | Note the various options in `read_csv()`, including providing column names, variable type, missing data identifier etc. 23 | 24 | ```{r} 25 | library(readr) 26 | 27 | # Save example 28 | write_csv(boot::melanoma, "boot.csv") 29 | 30 | # Read data 31 | melanoma = read_csv("boot.csv") 32 | ``` 33 | 34 | ## Column types 35 | 36 | Note the output shows how the columns/variables have been parsed. For full details see `?readr::cols()`. 37 | 38 | ### Continuous data 39 | 40 | * Integer (whole numbers) - `col_integer()` 41 | * Double or numeric (real numbers; the name comes from "double-precision floating point") - `col_double()` 42 | 43 | ### Categorical data 44 | 45 | * Factor (a fixed set of names/strings or numbers) - `col_factor()` 46 | * Character (sequences letters, numbers, and symbols) - `col_character()` 47 | * Logical (containing only TRUE or FALSE) - `col_logical()` 48 | 49 | ### Dates and times 50 | 51 | * Date - `col_date()` 52 | * Time - `col_time()` 53 | * Date-time - `col_datetime()` 54 | 55 | ## Check data 56 | 57 | `ff_glimpse()` provides a convenient overview of all data in a tibble or data frame. It is particularly important that factors are correctly specified. Hence, `ff_glimpse()` separates variables into continuous and categorcial. As expected, no factors are yet specified in the melanoma dataset. 58 | 59 | ```{r} 60 | library(finalfit) 61 | ff_glimpse(melanoma) 62 | ``` 63 | 64 | If you wish to see the variables in the order in which they appear in the data frame or tibble, `missing_glimpse()` or `tibble::glimpse()` are useful. 65 | 66 | ```{r} 67 | missing_glimpse(melanoma) 68 | ``` 69 | 70 | ## Specify factors 71 | 72 | Use an original description of the data (often called a data dictionary) to correctly assign and label any factor variables. This can be done in a single pipe. 73 | 74 | ```{r} 75 | library(dplyr) 76 | melanoma %>% 77 | mutate( 78 | status.factor = factor(status, levels = c(1, 2, 3), 79 | labels = c("Died from melanoma", "Alive", "Died from other causes")) %>% 80 | ff_label("Status"), 81 | sex.factor = factor(sex, levels = c(1, 0), 82 | labels = c("Male", "Female")) %>% 83 | ff_label("Sex"), 84 | ulcer.factor = factor(ulcer, levels = c(1, 0), 85 | labels = c("Present", "Absent")) %>% 86 | ff_label("Ulcer") 87 | ) -> melanoma 88 | 89 | ff_glimpse(melanoma) 90 | ``` 91 | 92 | Everything looks good and you are ready to start analysis. --------------------------------------------------------------------------------