R/reducews.R

Defines functions reducews

Documented in reducews

#' Reduce consecutive, internal whitespace characters (not leading or trailing) to a single whitespace character
#'
#' @param x A chacter vector
#'
#' @return modified vector where serial whitespace characters have been replaced with a single whitespace character (the first in the series)
#' @export
#'
#' @examples
#' reducews("CCN      51")
#' @seealso [stringr:::str_squish()] which does essentially the same thing
reducews <- function(x){
	gsub("(\\s)\\s+","\\1",x)
}
stackcon/rngt documentation built on June 17, 2022, 5:29 p.m.