Skip to content
Prev 360851 / 398506 Next

break string at specified possitions

On 5/11/2016 2:23 PM, Jan Kacaba wrote:
I think you can simply this. just create a function (I'll call it begs) 
to compute the beginning positions.

     begs <- function(x) c(0,x[-length(x)])+1

Then, then use that function in your call to str_sub

     str_sub(test_string,begs(ends),ends) %>% print


Hope this is helpful,

Dan

Daniel Nordlund
Bothell, WA USA