[R] Standard method for S4 object
Christophe Genolini
cgenolin at u-paris10.fr
Sun Feb 24 16:57:33 CET 2008
> /I think your question should be more relevant on Rdev./
ok, I will
> Personnally I would find stuff like "names", "$", "$<-", or "["
> useful as these are usual operation with S3 objects.
Is it possible in S4 to define "$<-" ? If there is a slot name 'a' in
object 'B', I find (in "S4 in 15 pages more or less")
setGeneric("a<-", function(x, value) standardGeneric("a<-"))
setReplaceMethod("a", .....
Then we can use
obj <- new("B")
a(obj)<- 3
But I did not find how to define
obj$a <- 3
Is it possible ? Is it the 'usual' way ?
Christophe
More information about the R-help
mailing list