powered by
Align two vectors using their names attributes, either expanding with NAs or reducing to the common values.
align_vectors(x, y, expand = TRUE)
A list with two components, x and y
x
y
A vector
Another vector
If TRUE, expand each to the same length using NAs. If FALSE, remove elements not in common.
x <- c(a=1, b=2, c=3, d=4) y <- c(b=1, c=2, e=3, a=4) align_vectors(x,y) align_vectors(x,y,expand=FALSE)
Run the code above in your browser using DataLab