R: Trim Spaces

trim.space {rapportools} | R Documentation

## Trim Spaces

### Description

Removes leading and/or trailing space(s) from a character vector. By default, it removes both leading and trailing spaces.

### Usage

    trim.space(x, what = c("both", "leading", "trailing", "none"),
      space.regex = "[:space:]", ...)

### Arguments

`x` | a character vector which values need whitespace trimming
`what` | which part of the string should be trimmed. Defaults to `both` which removes trailing and leading spaces. If `none`, no trimming will be performed.
`space.regex` | a character value containing a regex that defines a space character
`...` | additional arguments for `gsub` function

### Value

a character vector with (hopefully) trimmed spaces

[Package rapportools version 1.0 Index]