This is probably a very simple answer but can't seem to find a solution. I have a function which gives a set of parameters:
theta <-
function(
e = 0.2,l= 0.01,p= 0.05)
return(c(e=e,l=l,p=p))
So I can return from it a set of parameters, whilst changing one or more of them, e.g. by using
theta(e=0.1) #or
theta(l=0.1)
My problem is I want to call this function inside another function, where an input for that function is one of the variables.
So for example a function such as:
randFunc<-function(parameter,value){
s<-theta(parameter=value)
return(s)
}
Then use
randFunc("e",0.1) #or
randFunc("l",0.3)
However i'll get the error "Error in theta(parameter = value) : unused argument (parameter = value)"
I've tried a few things but can't seem to get the parameter "value" to be used within the theta function.
