1 | initial version |
You can turn a string of characters into a list using the strsplit() function in R.
For example, let's say you have a string of characters "hello world":
mystring <- "hello world"
mylist <- strsplit(mystring, " ")
In this example, we use the strsplit() function to split the string at each space, creating a list with two elements:
[[1]]
[1] "hello"
[[2]]
[1] "world"
The double brackets show that the list has two elements, and each element is a character vector with one value.