I am trying to take a string and reverse the words without replying on strsplit
in R. Specifically, I need to only use base R commands. If I have:
string1 <- "This is a string with words"
I would like to be able to get
"words with string a is This"
The biggest challenge for me is that I am not sure if there exist ways to access the elements of a string by indexing (unlike in Python). Any advice would be appreciated, thanks!