Is it possible to insert line breaks into a character string like this that automatically adjust so it don't split up words?
nif <- as.character(c("I am a string", "So am I",
"I am also a string but way to long"))
I found this code in a post but it splits up words and also add a line break after each string which I would like to avoid
gsub('(.{1,20})', '\\1\n',nif)
The output I am going for is this:
"I am a string" "So am I" "I am also a string but \n way to long"