I am trying to pass a set of parameters into a function. This function has two sub functions that take part of the above set of parameters.
In the following "SIMPLIFIED" example
f_combined
is a function that takes ...
I would like to make the following function call such that xx
is passed to f_sqr
and yy
is passed to f_plus
:
f_combined(xx = 2, yy = 2)
but it would give me an error:
Error in f_sqr(...) : unused argument (yy = 2)
any suggustions?
f_sqr <- function(xx =1){
xx ^ 2
}
f_plus <- function(yy =1){
yy + 1
}
f_combined <- function(...){
f_sqr(...) + f_plus(...)
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…