The following two functions might be worth adding to the distribution: ************************************************************** as.ordered <- function(x) { if (is.ordered(x)) x else ordered(x) } data.class <- function(x) { if (length(cl <- class(x))) cl[1] else { l <- length(dim(x)) if (l == 2) "matrix" else if (l > 0) "array" else mode(x) } } ************************************************************** Re data.class: Couldn't we introduce a "matrix" and an "array" class right away? (I already asked this once). The functions for creating or coercing such objects could easily add the corresponding class attribute ... -k =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-