Re: [R] Processing a hierarchical string name

2023-06-29 Thread Kevin Zembower via R-help
Ivan and Bert, thank you so much for your help. Ivan, your solution worked perfectly. I didn't really understand how to do string processing on a vector of strings, and your solution demonstrated it for me. I modified it to work with the tidyverses' stringr library in this way: bg3_race_sum

Re: [R] Processing a hierarchical string name

2023-06-28 Thread Bert Gunter
I probably misunderstand what you want to do, but for: test <- c(" !!Total:", " !!Total:!!Population of one race:", " !!Total:!!Population of one race:!!White alone", " !!Total:!!Population of one race:!!Black or African American alone", " !!Total:!!Population of one race:!!American Indian and

Re: [R] Processing a hierarchical string name

2023-06-28 Thread Ivan Krylov
On Wed, 28 Jun 2023 20:29:23 + Kevin Zembower via R-help wrote: > I think my algorithm for the labels is: > 1. keep everything from the last "!!" up to and including the last > character > 2. for everything remaining, replace each "!!.*:" group with a single > space. If you remove the