Вопрос

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

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

Throws undefined slot classes. It looks like I want to use setOldClass, but I am having trouble figuring out how to use it. Assuming I do want setOldClass, How would I use setOldClass so that I can include my RODBC connection as slot to my Node class?

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top