Learn R Programming

polmineR (version 0.6.1)

count: get counts

Description

Count number of occurrences of a query (CQP syntax may be used) in a partition, or a partitionBundle.

Usage

count(.Object, ...)
"count"(.Object, query, pAttribute = getOption("polmineR.pAttribute"), mc = F, verbose = T, progress = F)
"count"(.Object, query, pAttribute = NULL, freq = FALSE, total = T, mc = F, progress = T, verbose = FALSE)
"count"(.Object, query, pAttribute = getOption("polmineR.pAttribute"), verbose = TRUE)

Arguments

.Object
a "partition" or "partitionBundle" object, or a character vector (length 1) providing the name of a corpus
...
further parameters
query
a character vector (one or multiple terms to be looked up), CQP syntax can be used.
pAttribute
the p-attribute(s) to use
mc
logical, whether to use multicore (defaults to FALSE)
verbose
logical, whether to be verbose
progress
logical, whether to show progress
freq
logical, if FALSE, counts will be reported, if TRUE, frequencies
total
defaults to FALSE, if TRUE, the added value of counts (column: TOTAL) will be amended to the data.table that is returned

Value

a "data.table"

See Also

For a metadata-based breakdown of counts (i.e. a differentiation by s-attributes), see "dispersion".

count

Examples

Run this code
## Not run: 
# if (require(polmineR.sampleCorpus) && require(rcqp)){
#   use("polmineR.sampleCorpus")
#   debates <- partition("PLPRBTTXT", list(text_id=".*"), regex=TRUE)
#   x <- count(debates, "Arbeit") # get frequencies for one token
#   x <- count(debates, c("Arbeit", "Freizeit", "Zukunft")) # get frequencies for multiple tokens
#   x <- count("PLPRBTTXT", c("Migration", "Integration"), "word")
# 
#   debates <- partitionBundle(
#     .Object="PLPRBTTXT",
#     def=list(text_date=sAttributes("PLPRBTTXT", "text_date")),
#     regex=TRUE, mc=FALSE, verbose=FALSE
#   )
#   aiu <- count(debates, c("Arbeit", "Integration", "Umwelt"))
# }
# ## End(Not run)

Run the code above in your browser using DataLab