Skip to contents

Data management functions

Functions for typical data management tasks

cpR()
Fix CPR numbers with removed leading zeros
cutR()
Cut numeric variables into intervals
datR()
Convert dates from character to date format
distributR()
Assessment of distribution of continuous variables with histograms, QQ-plots and the Shapiro-Wilks test
factR()
Factorize variables
groupR()
Extract first n groups in data frame
joinR()
Join two or more dataframes
missR()
Overview of NAs in a dataframe
pvertR()
Format p-values to AMA manual of style
structR()
Convert dates to status indicator and time-to-event
readR()
Load csv, excel, rds and parquet files
recodR()
Recode multiple variables
redcapR()
Autoformatting of redcap exports
rowR()
Perform rowwise operations
summarisR()
Graphical overview of an entire dataset

Statistical Analyses

Functions that perform statistical analysis

estimatR()
Absolute risk estimation of time-to-event data with competing risks
extractR()
Extraction of key results from the estimatR function
followR()
Calculate median follow-up time using the inverse Kaplan-Meier method
incidencR()
Directly standardized incidence rates using the WHO standard population
inferencR()
Causal inference of time-to-event data
iteratR()
Perform multiple estimatR analyses
weightR()
Weight diagnostics for IPTW

Tables and figures

Functions for producing and formatting tables and figures

collectR()
Collection of multiple plots into one. Wrapper for ggarrange. Input must be a list of plots.
dagR()
Draw directed acyclic graphs (DAGS)
plotR()
Autoplot for estimatR, inferencR and clustR
savR()
Save plots and tables
swimmR()
Plot individual patient trajectories from time-to-event data (Swimmer plot)
tablR()
Create frequency tables

Register-specific functions

Functions customized for the danish registers

cci_timR()
Generation of time-dependent CCI and comorbidities from the Charlson Comorbidity Index
decodR()
Decoding of the main codelist for loading and searching in registries
formatR()
Auto-formatting of a data frame with layout option for typical levels and labels
includR()
Inclusion criteria for registry-studies
loadR()
Load registers
matchR()
Perform exposure-density matching for multilevel data
reportR()
Overview of matched and unmatched cases
searchR()
Find covariates or outcomes from the registers
simulatR()
Simulate danish health registers
updatR()
Update of Charlson Comorbidity Index or covariate values over time

Built-in datasets

Datasets for testing functions

analysis_df
Simulated dataset for model testing
match_df
Simulated dataset for the matchR algorithm
redcap_df
Simulated Redcap dataset
covariates_df
Simulated time-dependent covariates dataset.
population_denmark
Population table, Denmark
population_who
Population table, WHO

Miscellaneous functions

Small utility functions

checkR()
Detection of positivity violations (empty levels)
closR()
Pick the closest value from a range in vector.
colR()
Set default color palette
combinR()
Generate all possible cominations/permutations
formatR()
Auto-formatting of a data frame with layout option for typical levels and labels
listR()
Routine modifications of lists
modeR()
Get the mode (most common value) of a vector.
multitaskR()
Start a multisession with automatic reset
numbR()
Format numeric vectors
powR()
Automated keyboard strokes
rollR()
Assign rolling ID.
tickR()
First timestamp for taking time
tockR()
Last timestamp for taking time
viewR()
Graphical overview of the structure of a multilevel list