Learn R Programming

tm.plugin.koRpus (version 0.4-2)

freq.analysis,kRp.corpus-method: Apply freq.analysis() to all texts in kRp.corpus objects

Description

This method calls freq.analysis on all tagged text objects inside the given txt.file object.

Usage

# S4 method for kRp.corpus
freq.analysis(txt.file, ...)

Arguments

txt.file

An object of class kRp.corpus.

...

options to pass through to freq.analysis.

Value

An object of the same class as txt.file.

Details

If corp.freq was not specified but a valid object of class kRp.corp.freq is found in the freq slot of txt.file, it is used automatically. That is the case if you called read.corp.custom on the object previously.

Examples

Run this code
# NOT RUN {
# 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"
  )

  myCorpus <- read.corp.custom(myCorpus)
  myCorpus <- freq.analysis(myCorpus)
  corpusFreq(myCorpus)
} else {}
# }

Run the code above in your browser using DataLab