Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用R中另一个函数的参数创建函数_R_Function_Arguments - Fatal编程技术网

使用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 )