[Rd] Problem with _new_ if class "lm" in object representation.

Wolski wolski at molgen.mpg.de
Wed Sep 29 19:20:31 CEST 2004


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.



More information about the R-devel mailing list