我已经创建了一个函数Dummyfunc,它可以计算不同样本的折叠变化。我在这个Dummyfunc函数中使用了gsva函数。我想从我的Dummyfunc访问gsva函数的所有参数,这样我就可以根据需要更改参数的值。到目前为止,我已经尝试过这样做:
Dummyfunc <- function(method="gsva",verbose=TRUE,kernel=){
gsva(method=method,kernel=kernel,verbose=verbose)
}但是,它能否以自动方式完成,以便可以从Dummyfunc访问gsva函数的所有参数
发布于 2012-12-13 20:02:29
我不是很确定你想要什么,但我会使用...。例如:
Dummyfunc = function(...)
gsva(...)或
Dummyfunc = function(method="gsva", verbose=TRUE, ...)
gsva(method=method, verbose=verbose, ...)我们使用...来传递任何额外的参数。
发布于 2012-12-13 20:05:37
如果我对你的问题理解正确的话,你应该用...把它们都传递出去,你也可以把它们都写出来,但这可能需要一段时间。
# define the internal function
f.two <-
function( y , z ){
print( y )
print( z )
}
# define the external function,
# notice it passes the un-defined contents of ... on to the internal function
f.one <-
function( x , ... ){
print( x )
f.two( ... )
}
# everything gets executed properly
f.one( x = 1 , y = 2 , z = 3 ) https://stackoverflow.com/questions/13859342
复制相似问题