R convert string to vector tokenize using " "

Viewed 43412

I have a string :

string1 <- "This is my string"

I would like to convert it to a vector that looks like this:

vector1
"This"
"is"
"my"
"string"

How do I do this? I know I could use the tm package to convert to termDocumentMatrix and then convert to a matrix but it would alphabetize the words and I need them to stay in the same order.

5 Answers
Related