ThesaurusReaderWriter function

Thesaurus Readers and Writers

Thesaurus Readers and Writers

Functions to read and write thesauri and thesaurus sets.

ReadThesaurus( file, caseSensitive = FALSE, accentSensitive = FALSE, punctuationSensitive = FALSE ) ReadThesaurusSet(file) WriteThesaurus(thesaurus, file) WriteThesaurusSet(thesaurusSet, file)

Arguments

  • file: Name of a file.
  • caseSensitive, accentSensitive, punctuationSensitive: Logical. They set the case, accent, and punctuation sensitivity (FALSE by default) of the thesaurus.
  • thesaurus: A thesaurus object.
  • thesaurusSet: A thesaurus set.

Returns

WriteThesaurus and WriteThesaurusSet create or overwrite the corresponding files. No value is returned.

ReadThesaurus and ReadThesaurusSet return the read thesaurus or thesaurusSet, respectively.

Examples

## Read a thesaurus for taxa: thesaurusFile <- system.file("extdata", "taxonThesaurus.csv", package="zoolog") thesaurus <- ReadThesaurus(thesaurusFile) ## The attributes of the thesaurus include the fields 'caseSensitive', ## 'accentSensitive', and 'punctuationSensitive', all FALSE by default. attributes(thesaurus) ## Any of them can be set by the user if desired: thesaurus2 <- ReadThesaurus(thesaurusFile, accentSensitive = TRUE) attributes(thesaurus2) ## Write the thesarus to a file: fileExample <- file.path(tempdir(), "thesaurusExample.csv") WriteThesaurus(thesaurus, fileExample) ## Replace tempdir() for your preferred local path if you want to easily ## examine the written file. ## Read a thesaurus set: thesaurusSetFile <- system.file("extdata", "zoologThesaurusSet.csv", package="zoolog") thesaurusSet <- ReadThesaurusSet(thesaurusSetFile) ## The attributes of the thesaurus set include information of the constituent ## thesauri: names, source file names, and their mode of application on datasets. attributes(thesaurusSet) ## The attributes of each thesaurus are also set by 'ReadThesaurusSet'. attributes(thesaurusSet$measure) ## Write the thesaurus set to a file: fileSetExample <- file.path(tempdir(), "thesaurusSetExample.csv") WriteThesaurusSet(thesaurusSet, fileSetExample) ## It writes the thesaurus-set main data frame and each of the included ## thesaurus files. ## Again, replace tempdir() for your preferred local path if you want to ## easily examine the written files.

See Also

zoologThesaurus for a description of the thesaurus and thesaurus set structure,

ThesaurusManagement, StandardizeNomenclature