trim: Trim white-space from either side of string

Description Usage Arguments Value See Also Examples

View source: R/short_generic.R

Description

Removes white-space before and after each string in a vector of strings. There is a base R function trimws that should be preferred. The trim function is being maintained here strictly for backward compatibility and to avoid breaking code.

Usage

1
trim(x)

Arguments

x

a character vector

Value

A vector x of strings with white-space removed

See Also

trimws for a base R function

Examples

1
2
3
4
5
# Example vector
fish_code = c("STHD ", " CHUM", " PINK ", "COHO")

# Remove the white-space
trim(fish_code)

arestrom/remisc documentation built on July 16, 2020, 8:48 a.m.