Below is a reproducible example. First my data:
myvec <- c(-0.531346314931298, 0.298659434001583, -0.691720475359108) mymat <- new("dgeMatrix", x