# NOT RUN {
## Load an example thesaurus:
thesaurus <- ReadThesaurus(system.file("extdata", "taxonThesaurus.csv",
package="zoolog"))
## with categories
names(thesaurus) # "bos taurus" "ovis aries" "sus domesticus"
## Add names to several categories:
thesaurusExtended <- AddToThesaurus(thesaurus,
c("Kuh", "Schwein"),
c("bos taurus","sus domesticus"))
## This adds the name "Kuh" to the category "bos taurus" and
## the name "Schwein" to the category "sus domesticus".
## Generate a new thesaurus and populate it with two categories
## ("red" and "blue"):
thesaurusNew <- NewThesaurus()
thesaurusNew <- AddToThesaurus(thesaurusNew,
c("scarlet", "vermilion", "ruby", "cherry",
"carmine", "wine"),
"red")
thesaurusNew
thesaurusNew <- AddToThesaurus(thesaurusNew,
c("sky blue", "azure", "sapphire", "cerulean",
"navy", "lapis lazuli", "indigo", "cyan"),
"blue")
thesaurusNew
## Attempt to generate an ambiguous thesaurus
try(AddToThesaurus(thesaurusNew, "scarlet", "blue"))
## Remove repeated names in the same category:
thesaurusWithRepetitions <- AddToThesaurus(thesaurusNew,
c("scarlet", "ruby"), "red")
thesaurusWithRepetitions
RemoveRepeatedNames(thesaurusWithRepetitions)
# }
Run the code above in your browser using DataLab