Learn R Programming

udpipe (version 0.8.3)

dtm_colsums: Column sums and Row sums for document term matrices

Description

Column sums and Row sums for document term matrices

Usage

dtm_colsums(dtm)

dtm_rowsums(dtm)

Arguments

dtm

an object returned by document_term_matrix

Value

a vector of row/column sums with corresponding names

Examples

Run this code
# NOT RUN {
x <- data.frame(
 doc_id = c(1, 1, 2, 3, 4), 
 term = c("A", "C", "Z", "X", "G"), 
 freq = c(1, 5, 7, 10, 0))
dtm <- document_term_matrix(x)
x <- dtm_colsums(dtm)
x
x <- dtm_rowsums(dtm)
head(x)
# }

Run the code above in your browser using DataLab