Count tokens by splitting strings
countTokens(str, split = "\t", ...)
Arguments
- str
A character string vector
- split
Character used to split the strings
- ...
Other parameters passed to the strsplit
function
Value
Integer vector: count of tokens in the strings
Author
Jitao David Zhang <jitao_david.zhang@roche.com>
Examples
myStrings <- c("HSV\t1887\tFavorite", "FCB\t1900", "FCK\t1948")
countTokens(myStrings)
#> [1] 3 2 2
## the function deals with factors as well
countTokens(factor(myStrings))
#> [1] 3 2 2