(这一定是一个非常基本的问题,但到目前为止我没有在R手册中找到答案......)
当我使用lapply语法时lapply- 这很容易理解,我可以像这样定义myfun:
myfun <- function(x) {
# doing something here with x
}
lapply(input, myfun);
Run Code Online (Sandbox Code Playgroud)
和元素R作为lapply(input, myfun);参数传递给input.
但是,如果我需要传递更多参数x呢?例如,它定义如下:
myfun <- function(x, arg1) {
# doing something here with x and arg1
}
Run Code Online (Sandbox Code Playgroud)
如何使用此函数传递两个myfun元素(作为myfunc参数)和其他一些参数?