Reputation: 2203
I have created one function Dummyfunc
which calculates fold-change for different samples.
I am using gsva
function inside this Dummyfunc
function. I want to access all the arguments of the gsva
function from my Dummyfunc
so that I can change the values of the arguments as per the need.
So far I have tried doing like this :-
Dummyfunc <- function(method="gsva",verbose=TRUE,kernel=){
gsva(method=method,kernel=kernel,verbose=verbose)
}
But can it be done in automated fashion so that all arguments of gsva
function can be accessed from Dummyfunc
Upvotes: 1
Views: 151
Reputation: 6094
if i understand your problem correctly, you should just pass them all with ...
you could potentially write them all out, but that might take a while.
# 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 )
Upvotes: 2
Reputation: 60452
I'm not really sure what you are after, but would about using ...
. For example:
Dummyfunc = function(...)
gsva(...)
or
Dummyfunc = function(method="gsva", verbose=TRUE, ...)
gsva(method=method, verbose=verbose, ...)
We use ...
to pass any additional arguments.
Upvotes: 1