R/remove_empty_strings.R

Defines functions remove_empty_strings

Documented in remove_empty_strings

#' Remove empty string elements
#'
#' Take a vector and remove empty string elements. Useful after string splitting and being left with lots of empty string vectors.
#' @param vec A vector that may contain empty strings
#' @keywords string
#'
#' @export
#'
#' @examples
#'
#' remove_empty_strings(c("a", "", "c"))

remove_empty_strings <- function(vec) {
  out <- vec[-which(vec == "")]
  return(out)
}
aedobbyn/dobtools documentation built on May 28, 2019, 2:33 a.m.