# NOT RUN {
mydfm <- dfm(data_corpus_inaugural[1:2])
docfreq(mydfm[, 1:20])
# replication of worked example from
# https://en.wikipedia.org/wiki/Tf-idf#Example_of_tf.E2.80.93idf
wikiDfm <- new("dfm",
Matrix::Matrix(c(1,1,2,1,0,0, 1,1,0,0,2,3),
byrow = TRUE, nrow = 2,
dimnames = list(docs = c("document1", "document2"),
features = c("this", "is", "a", "sample",
"another", "example")),
sparse = TRUE))
wikiDfm
docfreq(wikiDfm)
docfreq(wikiDfm, scheme = "inverse")
docfreq(wikiDfm, scheme = "inverse", k = 1, smoothing = 1)
docfreq(wikiDfm, scheme = "unary")
docfreq(wikiDfm, scheme = "inversemax")
docfreq(wikiDfm, scheme = "inverseprob")
# }
Run the code above in your browser using DataLab