Skip to content
Prev 223667 / 398500 Next

OOP and passing by value

by returning the object ?

setMethod("setData","test",
 function(this,fcn,k){
   this at t <- as.numeric(seq(-k,k))/(2*k+1)
   this at f <- sapply(this at t,FUN=fcn)   #changed!
   return(this)                                          #changed!
 }
)

#-----------------------------------------------------------
[1] -0.4545455 -0.3636364 -0.2727273 -0.1818182 -0.0909091  0.0000000
0.0909091  0.1818182  0.2727273  0.3636364  0.4545455
On Wed, Jun 9, 2010 at 2:28 PM, michael meyer <mjhmeyer at googlemail.com> wrote: