Fast data manipulation functions implemented in C for large datasets. Provides vectorized alternatives to base R functions with significant performance improvements.
Installation
# From CRAN
install.packages("kit")
# Development version
install.packages("kit", repos = "https://fastverse.r-universe.dev")Features
Parallel Statistical Functions
Vector-valued functions operating in parallel over vectors or data frames:
-
psum,pprod,pmean: Parallel sum, product, and mean (similar topmin/pmax) -
pall,pany: Parallel all/any operations -
pcount,pcountNA: Count occurrences of values or NAs -
pfirst,plast: First/last non-missing values
Vectorized and Nested Switches
Fast vectorized conditional logic:
-
iif: Fast replacement forifelse()with attribute preservation -
nif: Nested if-else (SQL CASE WHEN equivalent) -
vswitch,nswitch: Vectorized switch statements
Sorting
-
psort: Parallel sort for character vectors -
topn: Efficient partial sort (top N values) without full sorting
topn(x, n = 6L, decreasing = TRUE) # Much faster than order()[1:6]Factors
-
charToFact: Fast character-to-factor conversion -
setlevels: Change factor levels by reference
Documentation
Full documentation available at: https://fastverse.github.io/kit/