trimws: Backport of trimws for R < 3.3.0

Description Usage Examples

View source: R/trimws.R

Description

See the original description in base::trimws.

Usage

1
trimws(x, which = c("both", "left", "right"))

Examples

1
2
3
4
5
6
# get function from namespace instead of possibly getting
# implementation shipped with recent R versions:
bp_trimws = getFromNamespace("trimws", "backports")
bp_trimws(c("  a  ", "b  ", "  c"))

bp_trimws(c("  a  ", "b  ", "  c"), which = "left")

Example output

[1] "a" "b" "c"
[1] "a  " "b  " "c"  

backports documentation built on Dec. 13, 2021, 5:08 p.m.