Skip to content

Commit dd28cee

Browse files
author
smeyer
committed
do show code required to run the example
git-svn-id: https://svn.r-project.org/R/trunk@87652 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 3a8c80f commit dd28cee

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/library/methods/man/setIs.Rd

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
272268
setClass("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
276272
setClass("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
283279
setIs("trackCurve",
@@ -294,7 +290,6 @@ setIs("trackCurve",
294290
obj@smooth <- as.matrix(value@smooth)
295291
obj})
296292

297-
298293
\dontshow{
299294
removeClass("trackMultiCurve")
300295
removeClass("trackCurve")

0 commit comments

Comments
 (0)