The R Project SVN R

Rev

Rev 47143 | Rev 47916 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 47143 Rev 47157
Line 153... Line 153...
153
stopifnot(identical(cc(), c())) # no arguments implies the default method
153
stopifnot(identical(cc(), c())) # no arguments implies the default method
154
 
154
 
155
setGeneric("numMax", function(...)standardGeneric("numMax"))
155
setGeneric("numMax", function(...)standardGeneric("numMax"))
156
 
156
 
157
setMethod("numMax", "numeric", function(...)max(...)) # won't work for complex data
157
setMethod("numMax", "numeric", function(...)max(...)) # won't work for complex data
158
setMethod("numMax", "Number", function(...) paste(...)) # should not be selected w/o clomplex args
158
setMethod("numMax", "Number", function(...) paste(...)) # should not be selected w/o complex args
159
 
159
 
160
stopifnot(identical(numMax(1:10, pi, 1+1i), paste(1:10, pi, 1+1i)))
160
stopifnot(identical(numMax(1:10, pi, 1+1i), paste(1:10, pi, 1+1i)))
161
stopifnot(identical(numMax(1:10, pi, 1), max(1:10, pi, 1)))
161
stopifnot(identical(numMax(1:10, pi, 1), max(1:10, pi, 1)))
162
 
162
 
163
try(numMax(1:10, pi, TRUE)) # should be an error:  no default method
163
try(numMax(1:10, pi, TRUE)) # should be an error:  no default method