R/n-words.R

Defines functions n_words

Documented in n_words

#' Return the number of words in a string
#'
#' @param x a string
#'
#' @return vector of numbers
#' @export
#'
#' @examples
#' syn_end <- syn("end")
#' syn_end_words <- n_words(syn_end)
#' syn_end[syn_end_words <= 1]
n_words <- function(x){
  lengths(strsplit(x, " "))
}
ropenscilabs/syn documentation built on Feb. 3, 2024, 4:32 a.m.