Or a little more 'by hand', if your data frame is xx
then a split endPoints into separate elements, figure out the lengths of each row
endPoints = strsplit(as.character(xx$endPoints), ",", fixed=TRUE)
startPoints = strsplit(as.character(xx$startPoints), ",", fixed=TRUE)
len = sapply(endPoints, length)
Use the lengths to expand the original data frame, unlisting previously compressed elements
yy = cbind(xx[rep(seq_len(nrow(xx)), len), c("id", "group")],
startPoints=as.integer(unlist(startPoints)),
endPoints=as.integer(unlist(endPoints)))
After that aggregate
is your friend.
aggregate(endPoints - startPoints ~ group, yy, sum)