Tools

Tools

The small utilities that keep everyday analysis quick, consistent and safe to share.

R package

VLabR

A lightweight R package for common data-cleaning and summary-table tasks in health data work: tidy column names, duplicate and uniqueness checks, one-row summaries, covariate balance, stable de-identified IDs and personal-name masking. Name masking can use Python and spaCy when available, with a pure-R fallback for locked-down work computers. Requires R 4.1.0 or later.

View VLabR on GitHub →

Install

install.packages("remotes")
remotes::install_github("LaboratoireV/VLabR", upgrade = "never")

library(VLabR)
vlab_load_vlabr_packages()

Selected functions

FunctionWhat it does
Data cleaning
vlab_fix_colname()Clean column names: strip special characters, replace spaces.
vlab_boost_data()Detect and convert date-like columns automatically.
vlab_date_conversion()Convert input to R Date or date-time values.
vlab_quote_rm()Remove stray quotes from character and factor columns.
vlab_get_duplicates()Return duplicate rows by one or more keys.
vlab_check_unique()Check whether a column is unique.
vlab_data_type()Classify columns by analysis type.
Summary tables
vlab_1_cat()One-row n (%) table for a categorical variable.
vlab_1_cont()One-line summary for a continuous variable.
vlab_cross_table()Two-variable cross table.
vlab_count_unique_categories()Count unique non-missing categories.
vlab_compare_balance()Compare covariate balance between two data frames.
De-identification
vlab_SID_creator()Stable de-identified study ID from name, date of birth and gender.
mask_person_names()Detect and mask personal names in free text (spaCy, with a pure-R fallback).
vlab_mask_PHN()Mask Alberta Personal Health Numbers near a PHN label.
vlab_mask()Mask vector values from the front or back.
Geography & reference data
vlab_travel()Road travel distance and time for origin–destination pairs via OSRM.
vlab_google_travel()The same using Google routing.
Alberta reference setsMunicipalities, health facilities, schools and Health Canada drug products.
Practice notes

Python Lab

A running set of beginner Python exercises — variables, type casting, input, conditionals, string methods, loops and functions — written as small, printable programs.