Learn R Programming

polmineR (version 0.7.4)

size: Get number of tokens.

Description

The method will get the number of tokens in a corpus or partition, or the dispersion across one or more s-attributes.

Usage

size(x, ...)

# S4 method for character size(x, sAttribute = NULL, verbose = TRUE)

# S4 method for partition size(x, sAttribute = NULL)

# S4 method for DocumentTermMatrix size(x)

Arguments

x

object to get size(s) for

...

further arguments

sAttribute

character vector with s-attributes (one or more)

verbose

logical, whether to print messages

Value

an integer vector if sAttribute is NULL, a data.table otherweise

Details

One or more s-attributes can be provided to get the dispersion of tokens across one or more dimensions. Two or more s-attributes can lead to reasonable results only if the corpus XML is flat.

See Also

See dispersion-method for counts of hits. The hits method calls the size-method to get sizes of subcorpora.

Examples

Run this code
# NOT RUN {
use("polmineR.sampleCorpus")
size("PLPRBTTXT")
size("PLPRBTTXT", sAttribute = "text_date")
size("PLPRBTTXT", sAttribute = c("text_date", "text_party"))

P <- partition("PLPRBTTXT", text_date = "2009-11-11")
size(P, sAttribute = "text_name")
size(P, sAttribute = "text_party")
size(P, sAttribute = c("text_name", "text_party"))
# }

Run the code above in your browser using DataLab