[Rd] Testing for a reference class object

From: Jeffrey Horner <jeffrey.horner_at_gmail.com>
Date: Thu, 10 Mar 2011 09:40:04 -0600

ink1">Hi all,

I've constructed the following function to test whether or not an object was created from a reference class:

isRefClassObject <- function(x) isS4(x) && is.environment(attr(x,'.xData')) &&

but I'm unsure if it's a complete test or if there's a better way to test. Regardless, It would be nice to have such a function in the methods package.

I have a case where I'd like to ensure that an object is constructed from a reference class AND that it implements a certain method:

if (isRefClassObject(x) && 'run' %in% getRefClass(x)$methods())





R-devel_at_r-project.org mailing list
Received on Thu 10 Mar 2011 - 15:44:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Mar 2011 - 19:50:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive