append.dictionary: Appendix Dictionary

Description Usage Arguments Details Author(s) See Also Examples

View source: R/append.dictionary.R

Description

A function designed to create post-hoc dictionaries in the SemNetDictionaries package. This allows for new semantic categories or word lists to be saved for future use (i.e., your own personal dictionary). Dictionaries created using this function can either be saved as an R object to your global environment or as a .rds file on your current computer. Open-source community-derived dictionaries can be uploaded to and downloaded from https://github.com/AlexChristensen/SemNetDictionaries

Usage

1
2
3
4
5
6
7
8
append.dictionary(
  ...,
  dictionary.name = "appendix",
  save.location = c("envir", "wd", "choose", "path"),
  path = NULL,
  textcleaner = FALSE,
  package = FALSE
)

Arguments

...

Character vector. A vector of words to create or add to a dictionary

dictionary.name

Character. Name of dictionary to create or add words to. Defaults to "appendix". Input a name to create or add to an existing dictionary. This function with automatically name files with the "*.dictionary.rds" suffix

save.location

Character. A choice for where to store appendix dictionary. Defaults to "envir".

  • "envir": Returns dictionary as a vector object to R's global environment

  • "wd": Saves dictionary to working directory. Useful for storing dictionaries alongside projects

  • "choose": User chooses a directory for more permanent storage. This will allow you to use this dictionary in the future

  • "path": User specifies a path to a directory if it is already known. This will allow direct updates to the directory and bypass the prompts in the save/update menus. This will also allow you to use this dictionary in the future

path

Character. A path to an existing directory. Only necessary for save.location = "path"

textcleaner

Boolean. Argument for skipping asking to save the dictionary twice. Defaults to FALSE. If TRUE, then asking to save the dictionary will be skipped.

package

Boolean. Argument not meant for user use. Allows me to update the package's dictionaries efficiently

Details

Appendix dictionaries are useful for storing spelling definitions that are not available in the SemNetDictionaries package. This function enables the storage of personalized dictionaries, which can be used in combination with other dictionaries to facilitate the cleaning of text data.

Dictionaries are either stored in R's global environment, where they will be deleted once R is closed (unless you save them), or in a directory you choose. A menu will pop-up asking whether you would like to save or update your dictionary. You have two options:

To save your dictionary file, you can either:

Note that save.location = "choose" and save.location = "path" will automatically update your dictionary if there is a file with the same name enter into the dictionary.name argument.

To find where your dictionaries are stored, use the find.dictionaries function. These dictionaries are only stored on your private computer and must either be publicly shared or transferred to other computers in order to use them elsewhere. If you would like to share a dictionary for others to use, then please submit a pull request or post an issue with your dictionary on my GitHub: AlexChristensen/SemNetDictionaries.

Author(s)

Alexander Christensen <alexpaulchristensen@gmail.com>

See Also

find.dictionaries to find where dictionaries are stored, dictionaries to identify dictionaries in SemNetDictionaries

Examples

1
2
# Create a dictionary
new.dictionary <- append.dictionary(c("words","are","fun"), save.location = "envir")

AlexChristensen/SemNetDictionaries documentation built on Feb. 15, 2022, 2:30 p.m.