使用R中另一个函数的参数创建函数
我创建了一个函数使用R中另一个函数的参数创建函数,r,function,arguments,R,Function,Arguments,我创建了一个函数Dummyfunc,用于计算不同样本的折叠变化。 我正在这个Dummyfunc函数中使用gsva函数。我想从我的Dummyfunc访问gsva函数的所有参数,以便根据需要更改参数值。 到目前为止,我已经尝试过这样做:- Dummyfunc <- function(method="gsva",verbose=TRUE,kernel=){ gsva(method=method,kernel=kernel,verbose=verbose) } Dummyfunc我不确定你想要什
Dummyfunc
,用于计算不同样本的折叠变化。
我正在这个Dummyfunc
函数中使用gsva
函数。我想从我的Dummyfunc
访问gsva
函数的所有参数,以便根据需要更改参数值。
到目前为止,我已经尝试过这样做:-
Dummyfunc <- function(method="gsva",verbose=TRUE,kernel=){
gsva(method=method,kernel=kernel,verbose=verbose)
}
Dummyfunc我不确定你想要什么,但我想知道如何使用…
。例如:
Dummyfunc = function(...)
gsva(...)
或
我们使用..
传递任何附加参数。如果我正确理解您的问题,您应该使用..
传递所有参数。您可以将它们全部写出,但这可能需要一段时间
# 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 )
#定义内部功能
f、 两个
# 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 )