summary,kRp.corpus-method {tm.plugin.koRpus}R Documentation

Apply summary() to all texts in kRp.corpus objects

Description

This method performs a summary call on all text objects inside the given object object. Contrary to what other summary methods do, this method always returns the full object with an updated summary slot.

Usage

## S4 method for signature 'kRp.corpus'
summary(object, missing = NA, ...)

corpusSummary(obj)

## S4 method for signature 'kRp.corpus'
corpusSummary(obj)

corpusSummary(obj) <- value

## S4 replacement method for signature 'kRp.corpus'
corpusSummary(obj) <- value

Arguments

object

An object of class kRp.corpus.

missing

Character string to use for missing values.

...

Used for internal processes.

obj

An object of class kRp.corpus.

value

The new value to replace the current with.

Details

The summary slot contains a data.frame with aggregated information of all texts that the respective object contains.

corpusSummary is a simple method to get or set the summary slot in kRp.corpus objects directly.

Value

An object of the same class as object.

Examples

# use readCorpus() to create an object of class kRp.corpus
# code is only run when the english language package can be loaded
if(require("koRpus.lang.en", quietly = TRUE)){
  myCorpus <- readCorpus(
    dir=file.path(
      path.package("tm.plugin.koRpus"), "examples", "corpus", "Edwards"
    ),
    hierarchy=list(
      Source=c(
        Wikipedia_prev="Wikipedia (old)",
        Wikipedia_new="Wikipedia (new)"
      )
    ),
    # use tokenize() so examples run without a TreeTagger installation
    tagger="tokenize",
    lang="en"
  )

  # calculate readability, but prevent a summary table from being added
  myCorpus <- readability(myCorpus, summary=FALSE)
  corpusSummary(myCorpus)

  # add summaries
  myCorpus <- summary(myCorpus)
  corpusSummary(myCorpus)
} else {}

[Package tm.plugin.koRpus version 0.4-2 Index]