Software
vctrs

vctrs

Generic programming with typed R vectors

C

The vctrs package provides a framework for working with vectors in R through three core concepts: standardized definitions of size and type (via vec_size() and vec_ptype()), size-recycling and type-coercion rules, and a base class for creating new S3 vector types. It’s designed as a developer-focused tool for building robust vector classes that work consistently across R packages.

This package solves the problem of inconsistent vector behavior in base R by establishing principles of size-stability and type-stability for functions. It simplifies the creation of new S3 vector types by providing a vctr base class with methods for many base generics, reducing implementation complexity. The framework enables package developers to create new vector classes that work seamlessly throughout the tidyverse ecosystem while maintaining minimal dependencies.

Contributors