9
Dear friends, good afternoon
Suppose I have a vector the following way
caption<- c("I really liked the performance", "I didn’t like the performance", "I neither liked nor disliked")
I want to create a function that automatically enters the n separator every two words
For example
function(legend, 2)
"I liked the performance", "I liked the performance", "I neither liked it nor disliked it"
It would be interesting to generalize and determine the intervals of introduction of line break
for example, a function this way
function (vector, c(2,3,5))
where c(2,4,5) means that each vector element will be introduced a first n after two words, a second n after 3 words and a third n after 5 words.