Suma de filas para matriz de documentos a largo plazo / simple_triplet_matrix ?? {paquete tm}
Entonces tengo una matriz de documentos a término muy grande:
> class(ph.DTM)
[1] "TermDocumentMatrix" "simple_triplet_matrix"
> ph.DTM
A term-document matrix (109996 terms, 262811 documents)
Non-/sparse entries: 3705693/28904453063
Sparsity : 100%
Maximal term length: 191
Weighting : term frequency (tf)
¿Cómo obtengo el rowSum (frecuencia) de cada término? Lo intenté:
> apply(ph.DTM, 1, sum)
Error in vector(typeof(x$v), nr * nc) : vector size cannot be NA
In addition: Warning message:
In nr * nc : NAs produced by integer overflow
Obviamente, sé sobreremoveSparseTerms
:
ph.DTM2 <- removeSparseTerms(ph.DTM, 0.99999)
Lo que reduce un poco el tamaño:
> ph.DTM2
A term-document matrix (28842 terms, 262811 documents)
Non-/sparse entries: 3612620/7576382242
Sparsity : 100%
Maximal term length: 24
Weighting : term frequency (tf)
Pero todavía no puedo aplicarle ninguna función relacionada con la matriz:
> as.matrix(ph.DTM2)
Error in vector(typeof(x$v), nr * nc) : vector size cannot be NA
In addition: Warning message:
In nr * nc : NAs produced by integer overflow
¿Cómo puedo obtener una simple suma de filas en este objeto? ¡¡Gracias!!