> There may be cases when changing the class of the left-hand side make sense > (such as one subclass of "Matrix" to another) but certainly not for the base > R vector classes.
I'm not sure what you mean by "not for the base R vector classes". Historically, the simpler class (or mode) gets coerced to the more complex class (or mode). x <- y <- 1:10 y [1] <- 1 (class (x) == class (y) ) #FALSE Also, I note the behavior of multiplication of a matrix with a Matrix. library (Matrix) m <- matrix (1:16, 4, 4) M <- Matrix (1:16, 4, 4) as.vector (class (m * M) ) #dgeMatrix as.vector (class (M * m) ) #dgeMatrix as.vector (class (m %*% M) ) #dgeMatrix as.vector (class (M %*% m) ) #dgeMatrix So, here also, the output is a Matrix, regardless of the type of multiplication, or the order of the operands. But the following surprised me: k <- m mode (k) <- "complex" k %*% M ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel