Re: [R] Partition vector of strings into lines of preferred width

2022-10-28 Thread Leonard Mada via R-help
Dear Andrew, Thank you for the fast reply. I forgot about strwrap. Though my problem is slightly different. I do have the actual vector. Of course, I could first join the strings - but this then involves both a join and a split (done by strwrap). Maybe its possible to avoid the join and

Re: [R] Partition vector of strings into lines of preferred width

2022-10-28 Thread Martin Morgan
> strwrap(text) [1] "What is the best way to split/cut a vector of strings into lines of" [2] "preferred width? I have come up with a simple solution, albeit naive," [3] "as it involves many arithmetic divisions. I have an alternative idea" [4] "which avoids this problem. But I may miss some

Re: [R] Partition vector of strings into lines of preferred width

2022-10-28 Thread Andrew Simmons
I would suggest using strwrap(), the documentation at ?strwrap has plenty of details and examples. For paragraphs, I would usually do something like: strwrap(x = , width = 80, indent = 4) On Fri, Oct 28, 2022 at 5:42 PM Leonard Mada via R-help wrote: > > Dear R-Users, > > text = " > What is the

[R] Partition vector of strings into lines of preferred width

2022-10-28 Thread Leonard Mada via R-help
Dear R-Users, text = " What is the best way to split/cut a vector of strings into lines of preferred width? I have come up with a simple solution, albeit naive, as it involves many arithmetic divisions. I have an alternative idea which avoids this problem. But I may miss some existing