Learn R Programming

polmineR (version 0.7.0)

compare,partition-method: compare features

Description

The features of two objects, usually a partition defining a corpus of interest, and a partition defining a reference corpus are compared. The most important purpose is term extraction.

Usage

"compare"(x, y, included = FALSE, method = "chisquare", verbose = FALSE)
"compare"(x, y, included = FALSE, method = "chisquare", verbose = TRUE, mc = getOption("polmineR.mc"), progress = FALSE)
"compare"(x, y, included = FALSE, method = "ll", mc = TRUE, verbose = TRUE)
"compare"(x, y, included = FALSE, method = "chisquare", verbose = TRUE, ...)

Arguments

x
a partition or partitionBundle object
y
a partition object, it is assumed that the coi is a subcorpus of ref
included
TRUE if coi is part of ref, defaults to FALSE
method
the statistical test to apply (chisquare or log likelihood)
verbose
logical, defaults to TRUE
mc
logical, whether to use multicore
progress
logical
...
further parameters

Value

The function returns a data frame with the following structure: - absolute frequencies in the first row - ...

References

Manning / Schuetze ...

Examples

Run this code
## Not run: 
#   use(polmineR.sampleCorpus)
#   kauder <- partition("PLPRBTTXT", text_name="Volker Kauder", pAttribute="word")
#   all <- partition("PLPRBTTXT", text_date=".*", regex=TRUE, pAttribute="word")
#   terms_kauder <- compare(kauder, all, included=TRUE)
#   top100 <- subset(terms_kauder, rank_chisquare <= 100)
# ## End(Not run)
## Not run: 
#   use(polmineR.sampleCorpus)
#   byName <- partitionBundle("PLPRBTTXT", sAttribute="text_name")
#   byName <- enrich(byName, pAttribute="word")
#   all <- partition("PLPRBTTXT", text_date=".*", regex=TRUE, pAttribute="word")
#   result <- compare(byName, all, included=TRUE, progress=TRUE)
#   dtm <- as.DocumentTermMatrix(result, col="chisquare")
# ## End(Not run)

Run the code above in your browser using DataLab