Hi!
Consider this code.

setClass("Ctest"
        ,representation(
                test="character"
                ,bla="character"
                ,mod="lm" 
                )
        )
        
new("Ctest",test="bla")                     #This produces an error.

#Error in validObject(.Object) : Invalid "Ctest" object: Invalid object for slot "mod" 
in class "Ctest": got class "NULL", should be or extend class "lm"



setClass("Ctest"
        ,representation(
                test="character"
                ,bla="character"
                ,mod="character"                # its the only with the class 
definition above.
        )
        )
new("Ctest",test="bla")                         #this works as I would expect.

#An object of class "Ctest"
#Slot "test":
#[1] "bla"
#
#Slot "bla":
#character(0)
#
#Slot "mod":
#character(0)


Thought that this is due to that the class lm has no lm(0) object. Hence i tried

setClass("brum",representation(brum="brum"))
setClass("Ctest"
        ,representation(
                test="character"
                ,bla="character"
                ,mod="brum"                # its the only with the class definition 
above.
        )
        )

new("Ctest",test="best")  #but this works to.

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to