[R-sig-Geo] Extending STIDF class : cannot creat an empty STIDF object

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Jun 19 19:10:35 CEST 2013



On 06/19/2013 06:55 PM, scizmeli wrote:
> Hello everyone,
> 
> Greetings to the r-sig-geo community.
> 
> I would like to extend the STIDF class :
> setClass("newClass1",contains="STIDF",
> representation(myslot="numeric"),prototype=prototype(myslot=numeric()))
> setClass("newClass2",representation(first="newClass1",second="newClass1",third="newClass1"))
> 
> But a new empty newClass1 class created with the new() function does not
> pass the validObject() test:
> validObject(new("newClass1"))
> Error in checkSlotAssignment(object, name, value) : 
> 		assignment of an object of class “NULL” is not valid for slot ‘time’ in an
> object of class “STIDF”; is(value, "xts") is not TRUE
> 
> Tracking down the error, I could come to :
> validObject(new("STIDF"))
> Error in checkSlotAssignment(object, name, value) : 
> 		assignment of an object of class “NULL” is not valid for slot ‘time’ in an
> object of class “STI”; is(value, "xts") is not TRUE
> 
> I need to be able to pass the test validObject(new("STIDF")) because my
> newClass2 should be able to contain empty newClass1 slots. For now, it is
> not possible!
> 
> Is this a bug?

No, this is intentional.

> Servet
> 
> 
> 
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Extending-STIDF-class-cannot-creat-an-empty-STIDF-object-tp7583841.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
83 33081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de



More information about the R-sig-Geo mailing list