(Wow, this task is incredibly awkward and painful compared to Python. Anyhoo ...)
PS Now I see that your main intention was to convert the substring length vector to index pairs. You can use cumsum() and then sort the indices together:
ll <- c(2,3,5,1,4) sort( c(1, cumsum(ll), (cumsum(ll)+1)[1:(length(ll)-1)]) )
But it is rather painful. flodel answer is better for this.
As for the real problem of splitting df columns into df and does it efficiently:
stringr::str_sub() blends elegantly with plyr::ddply() / ldply
require(plyr) require(stringr) df <- data.frame(value=c(360010001001002,360010001001004,360010001001005,360010001001006)) df$valc = as.character(df$value) df <- ddply(df, .(value), mutate, chk1=str_sub(valc,1,2), chk3=str_sub(valc,3,5), chk6=str_sub(valc,6,10), chk11=str_sub(valc,11,11), chk14=str_sub(valc,12,15) )