The R Project SVN R

Rev

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

Rev 62402 Rev 62410
Line 67... Line 67...
67
setClassUnion("an", c("array", "integer")); removeClass("an")#  (ditto)
67
setClassUnion("an", c("array", "integer")); removeClass("an")#  (ditto)
68
setClassUnion("AM", c("array", "matrix"));  removeClass("AM")#  (ditto)
68
setClassUnion("AM", c("array", "matrix"));  removeClass("AM")#  (ditto)
69
## as had "matrix" -> "array" -> "matrix" ... recursion
69
## as had "matrix" -> "array" -> "matrix" ... recursion
70
 
70
 
71
## and we want this to *still* work:
71
## and we want this to *still* work:
72
stopifnot(is(tryCatch(as(array(1:24, 2:4), "matrix"), error=function(e)e),
72
stopifnot(is(tryCatch(as(a3 <- array(1:24, 2:4), "matrix"), error=function(e)e),
73
	     "error"),
73
	     "error"),
74
	  is(as(array(1:12, 3:4), "matrix"),
74
	  is(as(a2 <- array(1:12, 3:4), "matrix"),
75
	     "matrix"))
75
	     "matrix"),
-
 
76
	  is(a2, "matrix"), is(a2, "array"), is(a3, "array"), !is(a3, "matrix"),
-
 
77
	  ## and yes, "for now":
-
 
78
	  identical(a2, matrix(1:12, 3)))
76
 
79