R/nwords.R

#' function counting the number of words
#' @param text character vector
#' 

nwords <- function(text){
  if ( length(text)==1 ) {
    length(words(text))
  } else {
    unlist(lapply(text, function(text) length(words(text)) ))
  }
}
petermeissner/idep documentation built on May 25, 2019, 1:53 a.m.