Re: [R] Set without argument

2008-02-26 Thread Christophe Genolini
Hi Martin What do you think of the following code ? A <- 1 imputeMyObj <- function(x){ xImp <- 3 #Calcul for Imputation of x nam<-deparse(substitute(x)) assign(nam,xImp,envir=parent.frame()) } imputeMyObj(A) A I guess it is not usual, but do you think it is 'bad' programming or will have

Re: [R] Set without argument

2008-02-23 Thread Christophe Genolini
Thanks a lot > The 'usual' way to write the above code is > > >> a <- imputeMyObj(a) >> :-( I was hopping something like the use of the superassignator <<- inside imputeMyObj (I was hoping even if I did not find it myself)... To bad. But thanks for teaching me 'usual' pratice. It is somet

Re: [R] Set without argument

2008-02-23 Thread Martin Morgan
Christophe Genolini <[EMAIL PROTECTED]> writes: > Hi the list, > > I am defining S4 objet. Is it possbile to define a method that change > the slot of an object without using <- ? > My object contain a numeric and a matrix. At some point, I would like to > impute the missing value in the matrix.