Displaying 3 results from an estimated 3 matches for "examplefun".
Did you mean:
exampledn
2007 May 10
1
how to pass "arguments" to a function within a function?
...Please trust me that something like this will in fact be useful what I am trying to accomplish. I am using R 2.4.1 in Windows XP.)
I have created two functions:
1. minus <- function(x,y) {get(x)-get(y)}
a. note: x and y are of type character and represent the names of numerical objects)
2. examplefun <- function(fun, vars=vars.in, ...) {
for(v in 1: ncol(vars) ) {
assign( names(vars)[v] , vars[1,v] , env=.GlobalEnv)
}
fun(...) }
a. FUN = another function (e.g. minus() that takes as its inputs variables of type chatrcater...
2002 Nov 04
2
Sweave - documenting a long function
...SE>>=
a <- a^2
a
} # end of function
@
% now bring the chunks together so that Sweave evaluates the function.
<<evalFun, echo=FALSE>>=
<<defFunHdr>>
<<defFunBodyPt1>>
<<defFunBodyPt2>>
@
% Finally, show an example of the function
<<exampleFun>>=
x(3)
@
===========
eval=FALSE doesnt seem to prevent the code being evaluated,
as I get an error with the first chunk.
(label=defFunHdr)
Error in parse(file, n, text, prompt) : parse error
Execution halted
The output from Stangle seems ok
i.e. I can execute it without error.
I am on R...
2002 Nov 05
0
summary: Sweave - documenting a long function
...SE>>=
a <- a^2
a
} # end of function
@
% now bring the chunks together so that Sweave evaluates the function.
<<evalFun, echo=FALSE>>=
<<defFunHdr>>
<<defFunBodyPt1>>
<<defFunBodyPt2>>
@
% Finally, show an example of the function
<<exampleFun>>=
x(3)
@
===========
eval=FALSE doesnt seem to prevent the code being evaluated,
as I get an error with the first chunk.
(label=defFunHdr)
Error in parse(file, n, text, prompt) : parse error
Execution halted
The output from Stangle seems ok
i.e. I can execute it without error.
I am on R...