Dear all, I have an S4 class with a slot "extra" which is a list. I want to be able to add an element called "name" to that list, containing the object "value" (which can be a vector, a dataframe or another S4 object)
Obviously setMethod("add.extra",signature=c("PM10Data","character","vector"), function(object,name,value){ obj...@extra[[name]] <- value } ) Contrary to what I would expect, the line : eval(eval(substitute(expression(obj...@extra[[name]] <<- value)))) gives the error : Error in obj...@extra[[name]] <<- value : object 'object' not found Substitute apparently doesn't work any more in S4 methods... I found a work-around by calling the initializer every time, but this influences the performance. Returning the object is also not an option, as I'd have to remember to assign that one each time to the original name. Basically I'm trying to do some call by reference with S4, but don't see how I should do that. How would I be able to tackle this problem in an efficient and elegant way? Thank you in advance Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ 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.