An example of using the S3 class in an S4 object

I want to enable a RODBC connection as part of an S4 object. It appears that RODBC is S3. For instance:

setClass( Class="Node", representation=representation( nodeName = "character", connection = "RODBC" ) ) 

Throws away undefined slot classes . Looks like I want to use setOldClass , but it's hard for me to figure out how to use it. Assuming I really want setOldClass , how to use setOldClass so that I can include my RODBC connection as a slot in my Node class?

+6
source share
1 answer

Despite the fact that documentation is sufficiently involved for this function, if all you need to do is include the class in the slot, it is simple:

 setOldClass("RODBC") setClass( Class="Node", representation=representation( nodeName = "character", connection = "RODBC" ) ) 

This is also what you would use for reference classes.

+7
source

Source: https://habr.com/ru/post/907250/


All Articles