R/rm.whitespace.R

Defines functions rm.whitespace

## Authors: Gerko Vink, Stef van Buuren

rm.whitespace <- function(string, side = "both") {
  side <- match.arg(side, c("left", "right", "both"))
  pattern <- switch(side,
    left = "^\\s+",
    right = "\\s+$",
    both = "^\\s+|\\s+$"
  )
  sub(pattern, "", string)
}

Try the mice package in your browser

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

mice documentation built on June 7, 2023, 5:38 p.m.