see also `%but%.character` in the operators package.
>rnorm %but% list( mean = 3 )
function (n, mean = 3, sd = 1)
.Internal(rnorm(n, mean, sd))
baptiste
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.
Look at the source code to the Defaults package.
On Fri, Jun 26, 2009 at 12:52 PM, Miguel
Bernal wrote:
> Dear R-users,
>
> I am trying to develop a function that takes another function as an argument,
> changes its default values and returns a list of things, among which the
> initial function wi
That was indeed what i was looking for (thanks also for the currying cite). I
also wanted flexibility on the number of arguments you can pass to the
function, which can be achieved by:
myfun <- function(x, a=19, b=21){ return(a * x + b) }
mysecond.fun <-
function(dumb1, dumb2, cc=myfun, cc.ar
Is this what you want?
myfun <- function(x, a=19, b=21){ return(a * x + b) }
mysecond.fun <- function(a, b, cc=myfun, cc.args=list(a=2,b=15) ){
list(a=a, b=b, cc = function(x) cc(x, cc.args$a, cc.args$b))
}
mysecond.fun(a=1,b=2)$cc(x=12)
It may be that you're after a Curry (*) function, as in,
On Jun 26, 2009, at 12:52 PM, Miguel Bernal wrote:
Dear R-users,
I am trying to develop a function that takes another function as an
argument,
changes its default values and returns a list of things, among which
the
initial function with its default arguments changed. An example of
what
Dear R-users,
I am trying to develop a function that takes another function as an argument,
changes its default values and returns a list of things, among which the
initial function with its default arguments changed. An example of what i
will like to obtain below:
## initial function
myfun
6 matches
Mail list logo