Hello Everyone: As usual, thanks in advance for any help.
I was hoping to get some more advice on this question: I'm trying to write a subsetting routine for an S3 object I've created -- lets call it myObject. myObject has a few attributes basically of type string and numerics. Its atomic value is just a vector of ints. I want to write my own subsetting routine to subset myObject in an unconventional way. So my method looks like this: "[.myObject" <- function( obj, i, j, ...){ ..... parameter checking and calculations.... print("Test") } If I call this method in an R session I get the following results: obj <- "an instance of a myObject" obj[] OUTPUT: Test Test Error: index of length zero. I'm not sure how to prevent it from printing twice. I don't understand why "print.default() is returning what it was asked to print, which then gets printed again automatically" as was mentioned in a previous thread. Does the solution involve creating a child class as mentioned here: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77057.html I'm having a difficult time following the execution steps for this R code: obj[] Again, thanks very much for any suggestions. ______________________________________________ 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.