count-method: Get counts.

Description Usage Arguments Value See Also Examples

Description

Count number of occurrences of a query (CQP syntax may be used) or, if query is NULL (default), of all tokens.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
count(.Object, ...)

## S4 method for signature 'partition'
count(.Object, query = NULL, cqp = is.cqp,
  id2str = TRUE, pAttribute = getOption("polmineR.pAttribute"),
  mc = getOption("polmineR.cores"), verbose = TRUE, progress = FALSE)

## S4 method for signature 'partitionBundle'
count(.Object, query, pAttribute = NULL,
  freq = FALSE, total = T, mc = F, progress = T, verbose = FALSE)

## S4 method for signature 'character'
count(.Object, query = NULL,
  pAttribute = getOption("polmineR.pAttribute"), verbose = TRUE)

## S4 method for signature 'vector'
count(.Object, corpus, pAttribute)

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.

cqp

either logical (TRUE if query is a CQP query), or a function to check whether query is a CQP query or not (defaults to is.query auxiliary function)

id2str

logical, whether to add rownames (only if query is NULL)

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

corpus

name of CWB corpus

Value

a "data.table"

See Also

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

count

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
\dontrun{
  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)

nrauscher/corpus documentation built on May 23, 2019, 9:34 p.m.