Example of Using an S3 Class in a S4 Object

后端 未结 1 1715
既然无缘
既然无缘 2021-01-05 15:24

I want to include an RODBC connection as part of S4 object. It looks like RODBC is S3. For example:

setClass(
  Class=\"Node\",
  representation=representati         


        
相关标签:
1条回答
  • 2021-01-05 16:21

    Although the documentation is quite involved for this function, if all you need to do include the class in a slot it is as simple as:

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

    This is also what you would use for reference classes.

    0 讨论(0)
提交回复
热议问题