Re: [R] Check the class of an object

2013-07-23 Thread Simon Zehnder
Hi Hervé, thank you very much for your reply! This makes the different treatment of S3 and S4 objects by 'class' clear. Best Simon On Jul 23, 2013, at 7:20 PM, Hervé Pagès wrote: > Hi, > > On 07/23/2013 09:59 AM, Simon Zehnder wrote: >> Hi David, >> >> thanks for the reply. You are right.

Re: [R] Check the class of an object

2013-07-23 Thread Simon Zehnder
Hi Martin, I didn't know that. But that is even more comfortable for checking. Thanks for the quick update! Best Simon P.S. And thanks for the online documents about S4 - I could already learn a lot! On Jul 23, 2013, at 7:11 PM, Martin Morgan wrote: > On 07/23/2013 09:59 AM, Simon Zehnder

Re: [R] Check the class of an object

2013-07-23 Thread Hervé Pagès
Hi, On 07/23/2013 09:59 AM, Simon Zehnder wrote: Hi David, thanks for the reply. You are right. Using the %in% is more stable and I gonna change my code. Unlike with S3 objects, class() on an S4 object can only return 1 class. Also note that, on an S3 object, doing "firstClass" %in% clas

Re: [R] Check the class of an object

2013-07-23 Thread Martin Morgan
On 07/23/2013 09:59 AM, Simon Zehnder wrote: Hi David, thanks for the reply. You are right. Using the %in% is more stable and I gonna change my code. you said you were you were using S4 classes. S4 classes do not report vectors of length != 1, from ?class For objects which have a form

Re: [R] Check the class of an object

2013-07-23 Thread Simon Zehnder
Hi David, thanks for the reply. You are right. Using the %in% is more stable and I gonna change my code. When testing for a specific class using 'is' one has to start at the lowest heir and walk up the inheritance structure. Starting at the checks at the root will always give TRUE. Having a st

Re: [R] Check the class of an object

2013-07-23 Thread David Winsemius
On Jul 23, 2013, at 5:36 AM, Simon Zehnder wrote: > Dear R-Users and R-Devels, > > I have large project based on S4 classes. While writing my unit tests I found > out, that 'is' cannot test for a specific class, as also inherited classes > can be treated as their super classes. I need to do ch

[R] Check the class of an object

2013-07-23 Thread Simon Zehnder
Dear R-Users and R-Devels, I have large project based on S4 classes. While writing my unit tests I found out, that 'is' cannot test for a specific class, as also inherited classes can be treated as their super classes. I need to do checks for specific classes. What I do right now is sth. like