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?
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.
Extending STIDF class : cannot creat an empty STIDF object
3 messages · Servet Ahmet Çizmeli, Edzer Pebesma
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
Thank you for your reply, Edzer, I am not very profficient at R OO programming so If you don't mind, can you then suggest me a way to deal with the situation? My second class sometimes does not have data, I need to be able to create objects inherited from an emtpy STIDF class. any suggestions? -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Extending-STIDF-class-cannot-creat-an-empty-STIDF-object-tp7583841p7583843.html Sent from the R-sig-geo mailing list archive at Nabble.com.