compare-method: compare features

Description Usage Arguments Value Author(s) References Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## S4 method for signature 'partition'
compare(x, y, included = FALSE, method = "chisquare",
  verbose = FALSE)

## S4 method for signature 'partitionBundle'
compare(x, y, included = FALSE,
  method = "chisquare", verbose = TRUE, mc = getOption("polmineR.mc"),
  progress = FALSE)

## S4 method for signature 'cooccurrences'
compare(x, y, included = FALSE, method = "ll",
  mc = TRUE, verbose = TRUE)

## S4 method for signature 'ngrams'
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 - ...

Author(s)

Andreas Blaette

References

Manning / Schuetze ...

Examples

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

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