This is a simplified example. My real dataset is very large, so the answer should be computationally inexpensive.
start.list <- list(cb_1 = c("VR_1", "VR_2", "VR_3"), cb_2 = c("VR_2", "VR_3", "VR_4"),
cb_3 = c("VR_3", "VR_4", "VR_5"))
> start.list
$cb_1
[1] "VR_1" "VR_2" "VR_3"
$cb_2
[1] "VR_2" "VR_3" "VR_4"
$cb_3
[1] "VR_3" "VR_4" "VR_5"
Desired output list:
> output.list
$VR_1
[1] "cb_1"
$VR_2
[1] "cb_1" "cb_2"
$VR_3
[1] "cb_1" "cb_2" "cb_3"
$VR_4
[1] "cb_2" "cb_3"
$VR_5
[1] "cb_3"