handyTools is an R package that brings together functions for everyday data work. It includes helpers for tasks such as normalizing values, expanding date ranges, handling missing values, and exporting data.

A few examples

  • normalize_0_to_1() scales numeric values to a range from zero to one. For a vector of identical non-missing values, it returns 0.5 by default; all_same_return lets you choose another value.
  • paste_na() combines non-missing values without turning missing values into the text "NA".
  • expand_periods() expands start and end dates into a sequence of dates for each unique ID.
  • export_xlsx() writes a data frame to an Excel sheet with filters and automatic column widths. It replaces an existing file at the same path.

Install and try it

The package requires R 4.1 or later. With the remotes package installed, install it from GitHub:

remotes::install_github("GildasLepennetier/handyTools")

Then try a couple of the exported functions:

handyTools::normalize_0_to_1(c(10, 20, 30))
# 0.0 0.5 1.0

handyTools::paste_na(c("alpha", NA, "omega"))
# "alpha,omega"

Explore the repository for the full collection, installation details, and package documentation.