search for: funfn

Displaying 5 results from an estimated 5 matches for "funfn".

2009 May 26
1
passing "..." arguments to a function called by eval()
...The code for my toy package looks like this: ########## R code, in pkg/R directory dTest <- function(x,...){ retVal = .Call("dTestC",x[1],dnorm,...,rho=new.env(),PACKAGE="pkg") return(retVal) } ########## C code, in pkg/src directory SEXP dTestC(SEXP dblX, SEXP funFn, SEXP dots, SEXP rho); /*--------------------------*/ SEXP dTestC(SEXP dblX, SEXP funFn, SEXP dots, SEXP rho){ SEXP retVal; SEXP R_fcall; PROTECT(retVal = NEW_NUMERIC(1)); PROTECT(R_fcall = lang3(funFn, R_NilValue, R_NilValue)); SETCADR(R_fcall, dblX); SETCADDR(R_fcall, dots); re...
2008 Oct 20
0
New verion 0.3-7 of gsubfn package
...strapply to the rest of R any R function may be prefaced with fn$ like this: # Example 4. Integrate x^2 fn$integrate(~ x^2, 0, 1) It also supports quasi-perl style string interpolation: # Example 5. Quasi-perl style string interpolation fn$cat("pi = $pi and e = `exp(1)`\n") match.funfn is an alternative to match.fun which allows developers to add this functionality to their own functions by simply replacing match.fun with match.funfn -- a one line change. In that case even the fn$ prefix is not needed. _______________________________________________ R-packages mailing list R-pa...
2008 Oct 20
0
New verion 0.3-7 of gsubfn package
...strapply to the rest of R any R function may be prefaced with fn$ like this: # Example 4. Integrate x^2 fn$integrate(~ x^2, 0, 1) It also supports quasi-perl style string interpolation: # Example 5. Quasi-perl style string interpolation fn$cat("pi = $pi and e = `exp(1)`\n") match.funfn is an alternative to match.fun which allows developers to add this functionality to their own functions by simply replacing match.fun with match.funfn -- a one line change. In that case even the fn$ prefix is not needed. _______________________________________________ R-packages mailing list R-pa...
2012 Mar 29
4
Handling functions as objects
I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { + print(a) + print(b) + } > > f1 = function(foo) { + foo(1,2) + } > > f1(f) [1] 1 [1] 2 > I also know that operators are functions, so, I can call: > '+'(1,2) [1] 3 > However, when I want to pass the
2008 Mar 07
5
Passing function to tapply as a string
Hi, Was wondering if it is possible to pass function name as a parameter, smth along this line param.to.pass<-c(1,'max','h') dd<-function(dfd, param=param.to.pass,...){ ttime.int <- format(ttime,fmt) data.frame( param[3] = tapply(dfd[,param[1]],ttime.int,param[3]), ...) } I know there is a as.formula expression but not quite sure if there is some