I have a question regarding mapply which allows us to execute a function simultaneously over multiple lists specified as arguments.
See code below. Here mapply performs (l1$a[1] + l1$b[1] + l2$a[1] + l2$b[1]) up until (l1$a[10] + l1$b[10] + l2$c[10] + l2$d[10]). What if what I meant was for the sum function to work independently on each of the individual lists being l1$a, l1$b, l2$a, l2$b and return the sum of elements in each of those lists, so the output would be just four sums?
> l1 <- list(a = c(1:10), b = c(11:20))
> l2 <- list(a = c(21:30), b = c(31:40))
> mapply(sum, l1$a, l1$b, l2$a, l2$b)
[1] 64 68 72 76 80 84 88 92 96 100