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

From: Wolski <wolski_at_molgen.mpg.de>
Date: Thu 30 Sep 2004 - 03:20:31 EST


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.



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Sep 30 03:24:14 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:25 EST