assigning lists elements as function arguments
问题 Suppose that: list_a <- list(1, 10) list_2 <- list(5, 20) my.foo <- function (z,w) z+w My main question is: for each list_ object, how to pass its two elements as the arguments of my.foo so that to obtain 11 and 25? My closest guess to solve the problem so far is: mapply(my.foo, list_a, list_2) but it is not suited for what I need to do, as it returns 6 and 30. Thanks for any suggestions, Stefano 回答1: You can use ls and get to get the objects and do.call to call your function with the content