Data Science Desktop Survival Guide
by Graham Williams |
|||||
Wrapping and Words |
st <- "All the Worlds a stage, All men are merely players"
cat(str_wrap(st, width=25))
Words of course form the basis for wrapping a sentence. We may wish to extract words from a sentence ourselves for further processing. Here we us stringr::word() to do so.We specify the positions of the word to be extracted from the setence. The default separator value is space. |
st <- c("The quick brown fox", "jumps on the brown dog")
word(st, start=1, end=2)
word(st, start=1, end=-2)
|