[R] S3 vs S4 class

Duncan Murdoch murdoch at stats.uwo.ca
Tue Oct 7 16:53:17 CEST 2008

On 07/10/2008 10:41 AM, Terry Therneau wrote:
>   A simple example:
>   	temp <- as.Date('2001-10-5')
>   	class(temp)
>   	  "Date"
> How do I tell if "Date" is implemented as an S3 or an S4 class type?
> I tried ?class, but didn't see anything obvious.  Functions like inherit() work
> equally well with both types (which is a good thing).
>   I expect the answer will be obvious - once someone points it out to me.

You could use the isS4 function:

 > temp <- as.Date('2001-10-5')
 > isS4(temp)

Duncan Murdoch

More information about the R-help mailing list