| counts {maptpx} | R Documentation |
Tools for manipulating (sparse) count matrices.
normalize(x,byrow=TRUE) stm_tfidf(x)
x |
A |
byrow |
Whether to normalize by row or column totals. |
normalize divides the counts by row or column totals, and stm_tfidf returns a matrix with entries x_{ij} \log[ n/(d_j+1) ], where x_{ij} is term-j frequency in document-i,
and d_j is the number of documents containing term-j.
Matt Taddy mataddy@gmail.com
normalize( matrix(1:9, ncol=3) ) normalize( matrix(1:9, ncol=3), byrow=FALSE ) (x <- matrix(rbinom(15,size=2,prob=.25),ncol=3)) stm_tfidf(x)