[Rd] more Matrix weirdness

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Wed Sep 9 04:04:44 CEST 2020


   Am I being too optimistic in expecting this (mixing and matching 
matrices and Matrices) to work?  If x is a matrix and m is a Matrix, 
replacing a commensurately sized sub-matrix of x with m throws "number 
of items to replace is not a multiple of replacement length" ...

x <- matrix(0,nrow=3,ncol=10, dimnames=list(letters[1:3],LETTERS[1:10]))
rr <- c("a","b","c")
cc <- c("B","C","E")
m <- Matrix(matrix(1:9,3,3))
x[rr,cc] <- m

    cheers
     Ben Bolker



More information about the R-devel mailing list