| string_to_vector | R Documentation |
","-joined string back to a vector (generic ggDNAvis helper)Takes a string (character) produced by vector_to_string() and recreates the vector.
Note that if a vector of multiple strings is input (e.g. c("1,2,3", "9,8,7")) the output
will be a single concatenated vector (e.g. c(1, 2, 3, 9, 8, 7)).
If the desired output is a list of vectors, try lapply() e.g.
lapply(c("1,2,3", "9,8,7"), string_to_vector) returns list(c(1, 2, 3), c(9, 8, 7)).
string_to_vector(string, type = "numeric", sep = ",")
string |
|
type |
|
sep |
|
<type> vector. The resulting vector (e.g. c(1, 2, 3)).
## String to numeric vector (default)
string_to_vector("1,2,3,4")
string_to_vector("1,2,3,4", type = "numeric")
string_to_vector("1;2;3;4", sep = ";")
## String to character vector
string_to_vector("A,B,C,D", type = "character")
## String to logical vector
string_to_vector("TRUE FALSE TRUE", type = "logical", sep = " ")
## By default, vector inputs are concatenated
string_to_vector(c("1,2,3", "4,5,6"))
## To create a list of vector outputs, use lapply()
lapply(c("1,2,3", "4,5,6"), string_to_vector)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.