Learn R Programming

ribiosUtils (version 1.7.7)

countTokens: Count tokens by splitting strings

Description

Count tokens by splitting strings

Usage

countTokens(str, split = "\t", ...)

Value

Integer vector: count of tokens in the strings

Arguments

str

A character string vector

split

Character used to split the strings

...

Other parameters passed to the strsplit function

Author

Jitao David Zhang <jitao_david.zhang@roche.com>

See Also

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

Examples

Run this code

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