Learn R Programming

ribiosUtils (version 1.5-6)

countTokens: Count tokens by splitting strings

Description

Count tokens by splitting strings

Usage

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

See Also

strsplit to split strings, or a convenient wrapper strtoken in this package.

Examples

Run this code
# NOT RUN {
myStrings <- c("HSV\t1887\tFavorite", "FCB\t1900", "FCK\t1948")
countTokens(myStrings)

## the function deals with factors as well
countTokens(factor(myStrings))

# }

Run the code above in your browser using DataLab