segment.string.Rd
Split strings into their constituent segments (and count them).
segment.string(x, split = NULL) segment.counts(x, split = NULL)
x | one or more strings to be split (and, optionally, counted) |
---|---|
split | the boundary character or sequence at which to segment the
string(s). The default, |
segment.string
: Returns a list (of the same length as x
), each item a vector of
character vectors.
segment.counts
: Calculate the frequency of individual characters in one or more strings.
Returns a matrix with one row for every string in x
.
segment.string(c("asd", "fghj"))#> [[1]] #> [1] "a" "s" "d" #> #> [[2]] #> [1] "f" "g" "h" "j" #>segment.string(c("la-dee-da", "lala-la"), "-")#> [[1]] #> [1] "la" "dee" "da" #> #> [[2]] #> [1] "lala" "la" #>segment.counts(c("asd", "aasd", "asdf"))#> a s d f #> asd 1 1 1 0 #> aasd 2 1 1 0 #> asdf 1 1 1 1