counts {maptpx} | R Documentation |
Utilities for count matrices
Description
Tools for manipulating (sparse) count matrices.
Usage
normalize(x,byrow=TRUE)
stm_tfidf(x)
Arguments
x |
A |
byrow |
Whether to normalize by row or column totals. |
Value
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.
Author(s)
Matt Taddy mataddy@gmail.com
Examples
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)
[Package maptpx version 1.9-7 Index]