lapply在使用in时,我有一个关于将多个参数传递给函数的问题R。
当我将 lapply 与lapply(input, myfun);- 的语法一起使用时,这很容易理解,我可以这样定义 myfun:
myfun <- function(x) {
# doing something here with x
}
lapply(input, myfun);
和元素input作为x参数传递给myfun.
但是,如果我需要向 传递更多参数myfunc怎么办?例如,它是这样定义的:
myfun <- function(x, arg1) {
# doing something here with x and arg1
}
如何通过传递两个input元素(作为x参数)和其他一些参数来使用这个函数?