rfunctions icon indicating copy to clipboard operation
rfunctions copied to clipboard

add/subtract don't preserve col/row names

Open dselivanov opened this issue 9 years ago • 0 comments

Hi! thx for you work. I found minor issue:

library(Matrix)
library(rfunctions)
xx = 1:10
m1 = sparseMatrix(i = xx, j = xx, x = xx, dims = c(10, 10), dimnames = list(xx, xx))
str(m1 + m1)

Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:10] 0 1 2 3 4 5 6 7 8 9 ..@ p : int [1:11] 0 1 2 3 4 5 6 7 8 9 ... ..@ Dim : int [1:2] 10 10 ..@ Dimnames:List of 2 .. ..$ : chr [1:10] "1" "2" "3" "4" ... .. ..$ : chr [1:10] "1" "2" "3" "4" ... ..@ x : num [1:10] 2 4 6 8 10 12 14 16 18 20 ..@ factors : list()

str(add(m1, m1))

Formal class 'dgCMatrix' [package "Matrix"] with 6 slots ..@ i : int [1:10] 0 1 2 3 4 5 6 7 8 9 ..@ p : int [1:11] 0 1 2 3 4 5 6 7 8 9 ... ..@ Dim : int [1:2] 10 10 ..@ Dimnames:List of 2 .. ..$ : NULL .. ..$ : NULL ..@ x : num [1:10] 2 4 6 8 10 12 14 16 18 20 ..@ factors : list()

dselivanov avatar Jun 19 '16 14:06 dselivanov