Skip to content

This abstract class provides a set of useful default methods that makes it considerably easier to get started with a new S3 vector class. See vignette("s3-vector") to learn how to use it to create your own S3 vector classes.


new_vctr(.data, ..., class = character(), inherit_base_type = NULL)



Foundation of class. Must be a vector


Name-value pairs defining attributes


Name of subclass.


[Experimental] A single logical, or NULL. Does this class extend the base type of .data? i.e. does the resulting object extend the behaviour of the underlying type? Defaults to FALSE for all types except lists, which are required to inherit from the base type.


List vctrs are special cases. When created through new_vctr(), the resulting list vctr should always be recognized as a list by vec_is_list(). Because of this, if inherit_base_type is FALSE an error is thrown.

Base methods

The vctr class provides methods for many base generics using a smaller set of generics defined by this package. Generally, you should think carefully before overriding any of the methods that vctrs implements for you as they've been carefully planned to be internally consistent.