You cannot use the sum function on nested lists. If you want to find the total sum of nested list elements the unlist the nested lists and then use sum function.

> list(1,1:5,6)
[[1]]
[1] 1
[[2]]
[1] 1 2 3 4 5
[[3]]
[1] 6
> sum(list(1,1:5,6))
Error in sum(list(1, 1:5, 6)) : invalid 'type' (list) of argument

> sum(unlist(list(1,1:5,6)))
[1] 22