Hello,
I have this toy example below which I hope can explain what I want to do. This relates to a problem in shiny where I have a set of arguments captured in a list object and I need to append. It also relates to a do.call with a function across my lists which are the arguments themselves. I think something like the below is happening.
How do I correctly bind e
to listb
to have the same properties as listc
?
dummy <- function(w,x,y,z,...) {
w + x / z * y + ...
}
a <- sample(1:100,5,replace = FALSE)
b <- sample(1:100,5,replace = FALSE)
c <- sample(1:100,5,replace = FALSE)
d <- sample(1:100,5,replace = FALSE)
e <- sample(1:100,5,replace = FALSE)
lista <- list(a,b,c,d)
listb <- list(lista,e)
listc <- list(a,b,c,d,e)
dummy(a,b,c,d,e) == do.call(dummy,list(a,b,c,d,e))
#> [1] TRUE TRUE TRUE TRUE TRUE
dummy(a,b,c,d,e) == do.call(dummy,listb)
#> Error in (function (w, x, y, z, ...) : argument "z" is missing, with no default
dummy(a,b,c,d,e) == do.call(dummy,listc)
#> [1] TRUE TRUE TRUE TRUE TRUE
Created on 2021-03-03 by the reprex package (v0.3.0)