> A 8 x 10 sparse Matrix of class "dgCMatrix" [1,] . 7 . . . . . . . . [2,] . . . . . . . . . . [3,] . . . . . . . . 14 . [4,] . . . . . 21 . . . . [5,] . . . . . . 28 . . . [6,] . . . . . . . 35 . . [7,] . . . . . . . . 42 . [8,] . . . . . . . . . 49
> mat_A <- as.matrix(A)
> mat_A
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 0 7 0 0 0 0 0 0 0 0
[2,] 0 0 0 0 0 0 0 0 0 0
[3,] 0 0 0 0 0 0 0 0 14 0
[4,] 0 0 0 0 0 21 0 0 0 0
[5,] 0 0 0 0 0 0 28 0 0 0
[6,] 0 0 0 0 0 0 0 35 0 0
[7,] 0 0 0 0 0 0 0 0 42 0
[8,] 0 0 0 0 0 0 0 0 0 49Bom dia.Gente, alguem sabe como transformar objetos do tipo sparseMatrix em matrizes porem com zeros onde tem pontos, veja exemplo abaixo. Obs: tem de ser como classe matriz, ou seja, class(A) tem de retornar matriz.i <- c(1,3:8); j <- c(2,9,6:10); x <- 7 * (1:7)(A <- sparseMatrix(i, j, x = x))
_______________________________________________
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia ) e forneça código mínimo reproduzível.