Hi there,
It does. I found a much better way to work with my data. In terms of solving it for the data provided here, this approach seems work decently well. One would still just have to wrap this and iterate over each cell but that is not so bad.
library(stringr)
x <- " c(3,1"
numbers <- gsub("[^0-9.-]", " ", x) %>% stringr::str_squish()
sapply(strsplit(numbers, ' '), function(x) sum(as.numeric(x)))
#> [1] 4
x <- "2:1"
numbers <- gsub("[^0-9.-]", " ", x) %>% stringr::str_squish()
sapply(strsplit(numbers, ' '), function(x) sum(as.numeric(x)))
#> [1] 3
x <- "2,1"
numbers <- gsub("[^0-9.-]", " ", x) %>% stringr::str_squish()
sapply(strsplit(numbers, ' '), function(x) sum(as.numeric(x)))
#> [1] 3
x <- "2"
numbers <- gsub("[^0-9.-]", " ", x) %>% stringr::str_squish()
sapply(strsplit(numbers, ' '), function(x) sum(as.numeric(x)))
#> [1] 2
Created on 2022-03-01 by the reprex package (v2.0.0)