From spluque at gmail.com  Tue Nov 22 20:12:10 2005
From: spluque at gmail.com (Sebastian Luque)
Date: Tue, 22 Nov 2005 13:12:10 -0600
Subject: [Rd] failure in `setClass' examples
Message-ID: <87psosfqet.fsf@gmail.com>

Hello,

Below is what I got running the examples from `setClass'.  Could somebody
please help explain why the last `setIs' call is returning the warning and
whether this is expected?


R>      setClass("track",
+               representation(x="numeric", y="numeric"))
[1] "track"
R>      setClass("trackCurve",
+               representation("track", smooth = "numeric"))
[1] "trackCurve"
R>      setClass("trackMultiCurve",
+               representation(x="numeric", y="matrix", smooth="matrix"),
+               prototype = list(x=numeric(), y=matrix(0,0,0),
+                                smooth= matrix(0,0,0)))
[1] "trackMultiCurve"
R>      try(setIs("trackMultiCurve", "trackCurve",
+          test = function(obj) {ncol(slot(obj, "y")) == 1}))
Warning message:
there is no automatic definition for as(object, "trackCurve") <- value when object has class "trackMultiCurve" and no 'replace' argument was supplied; replacement will be an error in: makeExtends(class1, class2, coerce, test, replace, by, classDef1 = classDef,  
R>      setIs("trackMultiCurve", "trackCurve",
+        test = function(obj) {ncol(slot(obj, "y")) == 1},
+        coerce = function(obj) {
+           new("trackCurve",
+               x = slot(obj, "x"),
+               y = as.numeric(slot(obj,"y")),
+               smooth = as.numeric(slot(obj, "smooth")))
+        })
Warning message:
there is no automatic definition for as(object, "trackCurve") <- value when object has class "trackMultiCurve" and no 'replace' argument was supplied; replacement will be an error in: makeExtends(class1, class2, coerce, test, replace, by, classDef1 = classDef,  
R> version
         _                
platform i486-pc-linux-gnu
arch     i486             
os       linux-gnu        
system   i486, linux-gnu  
status                    
major    2                
minor    2.0              
year     2005             
month    10               
day      06               
svn rev  35749            
language R                


Thanks in advance,

-- 
Sebastian P. Luque



[Rd] failure in `setClass' examples
Sebastian Luque