Learn R Programming

mark (version 0.8.2)

expand_by: Expands a vector

Description

Expands vector x by y

Usage

expand_by(x, y, expand = c("x", "y", "intersect", "both"), sort = FALSE)

Value

A vector with expanded

Arguments

x, y

Vectors

expand

Character switch to expand or keep only the values that intersect, all values in x or y, or retain all values found.

sort

Logical, if TRUE will sort by names in output

Examples

Run this code
x <- letters[c(3:2, 5, 9)]
y <- letters[c(1:4, 8)]
expand_by(x, y, "x")
expand_by(x, y, "y")
expand_by(x, y, "intersect")
expand_by(x, y, "both")

Run the code above in your browser using DataLab