Skip to contents

remove_caps() removes the first and/or last element of a vector.

Usage

remove_caps(x, start = TRUE, end = TRUE)

Arguments

x

An atomic vector.

start

(optional) A logical flag indicating whether to remove the first element of x (default: TRUE).

end

(optional) A logical flag indicating whether to remove the last element of x (default: TRUE).

Value

The same vector x with the first and/or last element removed.

See also

Other vector functions: cut_vector(), split_by_pattern()

Examples

remove_caps(c("a", "b", "c"))
#> [1] "b"
#> [1] "b" # Expected

remove_caps(c("a", "b", "c"), start = FALSE)
#> [1] "a" "b"
#> [1] "a" "b" # Expected

remove_caps(c("a", "b", "c"), end = FALSE)
#> [1] "b" "c"
#> [1] "b" "c" # Expected