@@ -254,30 +254,26 @@ setIs(class1, class2, test=NULL, coerce=NULL, replace=NULL,
254254}
255255
256256\examples {
257- \dontshow {
258- # # A simple class with two slots
259- setClass ("track ",
260- slots = c(x = " numeric" , y = " numeric" ))
261- # # A class extending the previous, adding one more slot
262- }
263257# # Two examples of setIs() with coerce= and replace= arguments
264258# # The first one works fairly well, because neither class has many
265259# # inherited methods do be disturbed by the new inheritance
266260
267261# # The second example does NOT work well, because the new superclass,
268262# # "factor", causes methods to be inherited that should not be.
269263
270- # # First example:
271- # # a class definition (see \link{setClass} for class "track")
264+ # # First example (classes taken from examples in ?setClass):
265+ # # A simple class with two slots
266+ setClass ("track ", slots = c(x="numeric", y="numeric"))
267+ # # A class extending the previous, adding one more slot
272268setClass ("trackCurve ", contains = "track",
273- slots = c( smooth = " numeric" ))
269+ slots = c(smooth = " numeric" ))
274270# # A class similar to "trackCurve", but with different structure
275271# # allowing matrices for the "y" and "smooth" slots
276272setClass ("trackMultiCurve ",
277273 slots = c(x = " numeric" , y = " matrix" , smooth = " matrix" ),
278274 prototype = structure(list (), x = numeric (), y = matrix (0 ,0 ,0 ),
275+ smooth = matrix (0 ,0 ,0 )))
279276
280- smooth = matrix (0 ,0 ,0 )))
281277# # Automatically convert an object from class "trackCurve" into
282278# # "trackMultiCurve", by making the y, smooth slots into 1-column matrices
283279setIs(" trackCurve" ,
@@ -294,7 +290,6 @@ setIs("trackCurve",
294290 obj @ smooth <- as.matrix(value @ smooth )
295291 obj })
296292
297-
298293\dontshow {
299294removeClass(" trackMultiCurve" )
300295removeClass(" trackCurve" )
0 commit comments