The R Project SVN R

Rev

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

Rev 77436 Rev 77446
Line 3249... Line 3249...
3249
y <- structure(list(), AA = 1)
3249
y <- structure(list(), AA = 1)
3250
stopifnot(is.null(attr(y, exact = TRUE, "A")))
3250
stopifnot(is.null(attr(y, exact = TRUE, "A")))
3251
 
3251
 
3252
 
3252
 
3253
if(nzchar(Sys.getenv("_R_CLASS_MATRIX_ARRAY_"))) {
3253
if(nzchar(Sys.getenv("_R_CLASS_MATRIX_ARRAY_"))) {
3254
## A matrix is an array, too:
3254
## 1) A matrix is an array, too:
3255
stopifnot( vapply(1:9, function(N) inherits(array(pi, dim = 1:N), "array"), NA) )
3255
stopifnot( vapply(1:9, function(N) inherits(array(pi, dim = 1:N), "array"), NA) )
3256
## was false for N=2 in R < 4.0.0
3256
## was false for N=2 in R < 4.0.0
-
 
3257
##
-
 
3258
## 2) Matrix must dispatch for array methods, too :
-
 
3259
foo <- function(x) UseMethod("foo")
-
 
3260
foo.array <- function(x) "made in foo.array()"
-
 
3261
stopifnot(
-
 
3262
    vapply(1:9, function(N) foo(array(pi, dim = 1:N)), "chr") == foo.array())
-
 
3263
## foo(array(*)) gave error for N=2 in R < 4.0.0
-
 
3264
} else
3257
} else cat("not tested\n")
3265
    cat("not tested\n")
3258
 
3266
 
3259
 
3267
 
3260
 
3268
 
3261
## keep at end
3269
## keep at end
3262
rbind(last =  proc.time() - .pt,
3270
rbind(last =  proc.time() - .pt,