str_to_char: convert string into a vector of each char

Description Usage Arguments Value Examples

View source: R/utils.R

Description

convert string into a vector of each char

Usage

1
str_to_char(x, unique = F, sort = F, ...)

Arguments

x

a string or a vector of strings. Note if a vector supplied, it will be collapsed. If you wanna multiple vectors of char returned, you can use sapply() to wrapper the function.

unique

If 'TRUE' chars should be uniqued, otherwise as it is.

sort

If 'TRUE' chars should be sorted by alphabetic, otherwise as it is.

...

more parameters to be used in sort(). such as order decreasing = T if you like.

Value

a vector of chars

Examples

1
2
3
str_to_char(x = c("Here it is"), unique = F, sort = F)
str_to_char(x = c("Yes", "or", "Not"), unique = F, sort = F)
sapply(c("Yes", "or", "Not"), str_to_char, sort = F, unique = F)

zzwch/convgene documentation built on July 11, 2021, 9:41 a.m.