On Sat, Oct 30, 2010 at 9:03 AM, Mark Heckmann <mark.heckm...@gmx.de> wrote: > How can I overload the "[" and "[<-" operators using S3 classes? > Something like '['.{class} did not work or at least I do not know how to > define it properly. > > > For S4 it is straightforward: > > setMethod("[", signature(x = "myClass", i = "numeric"), > function (x, i, j, ..., drop){ > ... some operations > }) > > How to do the same for S3?
Check out some examples by entering this into R: methods("[") # lists [ methods `[.data.frame` stats:::`[.ts` -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.