Re: [R] creating function bodies using body()

2003-04-04 Thread Peter Dalgaard BSA
[EMAIL PROTECTED] writes: > I'm having trouble figuring out how to create a function using "body<-" > (). The help file for body() says that the argument should be a list of > R expressions. However if I try that I get an error: > > > tmpfun <- function(a, b=2){} > > body(tmpfun) <- list(expres

[R] creating function bodies using body()

2003-04-04 Thread Setzer . Woodrow
I'm having trouble figuring out how to create a function using "body<-" (). The help file for body() says that the argument should be a list of R expressions. However if I try that I get an error: > tmpfun <- function(a, b=2){} > body(tmpfun) <- list(expression(z <- a + b),expression(z^2)) Error