Learn R Programming

polmineR (version 0.7.4)

resetRegistry: Reload using new CORPUS_REGISTRY.

Description

A utility function to reset the environment variable CORPUS_REGISTRY. That may be necessary if you want use a CWB corpus that is not stored in the usual place. In particular, resetting the environment variable is required if you want to use a corpus delivered in a R package,

Usage

resetRegistry(registryDir = getOption("polmineR.defaultRegistry"),
  verbose = TRUE)

Arguments

registryDir

path to the registry directory to be used

verbose

logical, whether to be verbose

Value

the registry directory used before resetting CORPUS_REGISTRY

Details

Resetting the CORPUS_REGISTRY environment variable is achieved by unloading and reloading the C library 'rcqp' that is the backend for the rcqp package. It may not be the most artful way to do things, but it works.

To get the path to a package that contains a CWB corpus, use system.file.

Examples

Run this code
# NOT RUN {
sampleCorpusPkgDir <- system.file(package="polmineR.sampleCorpus")
sampleCorpusRegistryDir <- file.path(sampleCorpusPkgDir, "extdata", "cwb", "registry")
oldRegistryDir <- resetRegistry(sampleCorpusRegistryDir)
sampleCorpusPartition <- partition("PLPRBTTXT", text_speaker = "Volker Kauder")
resetRegistry(oldRegistryDir)
# }

Run the code above in your browser using DataLab