R/getMeanWordLength.R

Defines functions getMeanWordLength

getMeanWordLength <- function(text) {
    words <- str_split(text, " ")
    word_lengths <- lapply(words, str_length)[[1]]
    return(mean(word_lengths))
}
cw25/opencpu_service_ci_tutorial documentation built on Jan. 4, 2021, 2:54 a.m.