R/Trim.R

#' Remove Leading/Trailing White Space
#' 
#' Remove leading/trailing white space.
#' 
#' @param x The text variable.  
#' @return Returns a vector with the leading/trailing white spaces removed.
#' @export
#' @examples
#' \dontrun{
#' (x <- c("  talkstats.com ", "   really? ", " yeah"))
#' Trim(x)
#' }
Trim <-
function (x) gsub("^\\s+|\\s+$", "", x)

Try the qdap package in your browser

Any scripts or data that you put into this service are public.

qdap documentation built on May 31, 2023, 5:20 p.m.