Soma de linhas para matriz de documentos a termo grande / simple_triplet_matrix ?? {pacote tm}
Então, eu tenho uma matriz termo-documento muito 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)
Como obtenho o rowSum (frequência) de cada termo? Eu tentei:
> 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, eu sei sobreremoveSparseTerms
:
ph.DTM2 <- removeSparseTerms(ph.DTM, 0.99999)
O que reduz um pouco o tamanho:
> 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)
Mas ainda não consigo aplicar nenhuma função relacionada à 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
Como posso obter uma soma simples de linhas nesse objeto? Obrigado!!