A collection of helpful functions for summarizing data and formatting results.
These or similar functions can be found in other R packages on github.com or
on CRAN. However, this is a collection of methods I have generated to help with
particular projects I have worked on over the last several years. Using my
original qwraps package as the foundation, this work is aimed at simplicity
and ease of use.
Some of the tools provided by qwraps2 are:
-
Formatting results:
frmt,frmtci, andfrmtpmake it easier to consistently format numeric values, confidence intervals, and p-values in reports.qableis a wrapper aroundknitr::kablewith my preferred defaults.summary_tableis used to generate data summary tables in markdown or LaTeXmean_ci,mean_sd,median_iqr,n_percmake it easy to report formatted summary statistics.
-
Plotting: Tools for building specific types of plots in ggplot2
qacf: Autocorrelation plotsqblandaltman: Bland Altman plotsqkmplot: Kaplan-Meier plotsqprc: Precision Recall Curvesqroc: Receiver Operator Curvesggplot2_extract_legend: extract the legend from a ggplot.
-
R Programming and Development
lazyload_cacheLoad the cache generated by knitr into an interactive session.
-
Other Tools:
confusion_matrix: building and generate statistics for confusion matrices.logitandinvlogit: quick logit and inverse logit functionsll: a variant forls()
If you have a particular task or function used for data summaries or for reporting that you think would be helpful to include in this package please fork the repo, add the feature, and send me a pull request.
Use the makefile. RStudio users, you will find a qwraps2.Rproj that will set
the default to use the makefile in the build. My preferred IDE is
neovim with the
Nvim-R plug-in and I prefer to work on a
Debian system. After cloning the repo, a simple call
make
will build the package. This includes generating man files via
roxygen2, building the vignettes,
and then building the package via R CMD build ..
Passing arguments to R CMD build can be done too.
For example, building the package without the vignettes is done via:
make build-options=--no-build-vignettes
Download and install from The Comprehensive R Archive Network (CRAN).
install.packages("qwraps2", repo = "http://cran.rstudio.com")
Install the development version of qwraps2 directly from github via the
remotes package:
if (!("remotes" %in% rownames(installed.packages()))) {
warning("installing remotes from https://cran.rstudio.com")
install.packages("remotes", repo = "https://cran.rstudio.com")
}
remotes::install_github("dewittpe/qwraps2", build_vignettes = TRUE)
NOTE: If you are working on a Windows machine you will need to download and
install Rtools.
Install with GNU make
make install
