Skip to content

User FAQ

faq-compatibility-types
FAQ - How is the compatibility of vector types decided?
faq-error-incompatible-attributes
FAQ - Error/Warning: Some attributes are incompatible
faq-error-scalar-type
FAQ - Error: Input must be a vector

Developer FAQ

howto-faq-coercion-data-frame
FAQ - How to implement ptype2 and cast methods? (Data frames)
howto-faq-coercion
FAQ - How to implement ptype2 and cast methods?
howto-faq-fix-scalar-type-error
FAQ - Why isn't my class treated as a vector?
theory-faq-coercion
FAQ - How does coercion work in vctrs?
theory-faq-recycling vector_recycling_rules
FAQ - How does recycling work in vctrs and the tidyverse?
reference-faq-compatibility
FAQ - Is my class compatible with vctrs?

Internal FAQ

internal-faq-matches-algorithm
Internal FAQ - Implementation of vec_locate_matches()
internal-faq-ptype2-identity
Internal FAQ - vec_ptype2(), NULL, and unspecified vectors

Genericity

vec_ptype2()
Find the common type for a pair of vectors
vec_cast() vec_cast_common()
Cast a vector to a specified type
vec_proxy() vec_restore()
Proxy and restore
vec_proxy_compare() vec_proxy_order()
Comparison and order proxy
vec_proxy_equal()
Equality proxy

Foundations

Combining

vec_c()
Combine many vectors into one vector
vec_interleave()
Interleave many vectors into one vector
vec_rbind() vec_cbind()
Combine many data frames into one data frame
name_spec
Name specifications

Slicing and recycling

vec_init()
Initialize a vector
vec_slice() `vec_slice<-`() vec_assign()
Get or set observations in a vector
vec_recycle() vec_recycle_common()
Vector recycling
vec_chop() list_unchop()
Chopping
list_drop_empty()
Drop empty elements from a list

Assigning

vec_slice() `vec_slice<-`() vec_assign()
Get or set observations in a vector
vec_fill_missing()
Fill in missing values with the previous or following value

Equality and ordering

vec_equal()
Equality
vec_detect_complete()
Complete
vec_detect_missing() vec_any_missing()
Missing values
vec_compare()
Compare two vectors

Sorting

vec_order() vec_sort()
Order and sort vectors
vec_rank()
Compute ranks

Matching and splitting

vec_count()
Count unique values in a vector
vec_duplicate_any() vec_duplicate_detect() vec_duplicate_id()
Find duplicated values
vec_unique() vec_unique_loc() vec_unique_count()
Find and count unique values
vec_match() vec_in()
Find matching observations across vectors
vec_locate_matches()
Locate observations matching specified conditions
vec_set_intersect() vec_set_difference() vec_set_union() vec_set_symmetric_difference()
Set operations
vec_split()
Split a vector into groups

Sequences and repetitions

vec_rep() vec_rep_each() vec_unrep()
Repeat a vector
vec_seq_along() vec_init_along()
Useful sequences
vec_identify_runs() vec_run_sizes()
Runs
vec_expand_grid()
Create a data frame from all combinations of the inputs

New classes

Data frame

df_list()
Collect columns for data frame construction
new_data_frame()
Assemble attributes for data frame construction
data_frame()
Construct a data frame
df_ptype2() df_cast() tib_ptype2() tib_cast()
Coercion between two data frames

User tools

`%0%`
Default value for empty vectors

Developer tools

new_vctr()
vctr (vector) S3 class
vec_ptype_full() vec_ptype_abbr()
Vector type as a string
new_partial() is_partial() vec_ptype_finalise()
Partial type
stop_incompatible_type() stop_incompatible_cast() stop_incompatible_op() stop_incompatible_size() allow_lossy_cast()
Custom conditions for vctrs package
new_rcrd()
rcrd (record) S3 class
fields() n_fields() field() `field<-`()
Tools for accessing the fields of a record.
s3_register
Register a method for a suggested dependency
vec_arith() vec_arith_base() MISSING()
Arithmetic operations
vec_math() vec_math_base()
Mathematical operations
unspecified()
A 1d vector of unspecified type
vec_default_cast() vec_default_ptype2()
Default cast and ptype2 methods
vec_as_names()
Retrieve and repair names
vec_names2() vec_names() vec_set_names()
Get or set the names of a vector
vec_as_location() num_as_location() vec_as_location2() num_as_location2()
Create a vector of locations
vec_as_subscript() vec_as_subscript2()
Convert to a base subscript type