The finalfit
package provides functions that help you
quickly create elegant final results tables and plots when modelling in
R. These can easily be exported as Word documents, PDFs, or html
files.
Its design follows Hadley Wickham’s tidy tool manifesto.
In addition, it provides functions for identifying and handling missing data, together with a number of functions to bootstrap simulate regression model results.
You can install finalfit
from CRAN:
install.packages("finalfit")
It is recommended that this package is used together with
dplyr
which can be installed via:
install.packages("dplyr")
The package documentation is maintained independently at finalfit.org.
See Get started and the All tables vignettes for extensive examples.
# Crosstable
= c("age.factor", "sex.factor", "obstruct.factor")
explanatory = 'mort_5yr'
dependent %>%
colon_s summary_factorlist(dependent, explanatory,
p=TRUE, add_dependent_label=TRUE) -> t1
::kable(t1, align=c("l", "l", "r", "r", "r")) knitr
= c("age.factor", "sex.factor",
explanatory "obstruct.factor", "perfor.factor")
= 'mort_5yr'
dependent %>%
colon_s finalfit(dependent, explanatory, metrics=TRUE) -> t2
::kable(t2[[1]], row.names=FALSE, align=c("l", "l", "r", "r", "r", "r"))
knitr::kable(t2[[2]], row.names=FALSE, col.names="") knitr
When exported to PDF:
= c("age.factor", "sex.factor",
explanatory "obstruct.factor", "perfor.factor")
= 'mort_5yr'
dependent %>%
colon_s or_plot(dependent, explanatory)