Get and set which dictionary or dictionaries to use

Description

The first step in the generation of any codelist is to call the setdictionary function in order to specify which dictionaries are to be used for the codelist, and to blank the categories. The dictionary names can be supplied in a vector or as three separate arguments. The function getdictionary returns the dictionary or dictionaries in use. This function is not used to specify the dictionaries to use when creating a selection; use dictis instead.

To start off with an existing codelist and modify it using the master dictionary (e.g. to add new terms). This updates blank entries in the master category table and other metadata in META but does not over-write any information that is there already.

Usage

1
2
3
setdictionary(dictName1 = NULL, dictName2 = NULL, dictName3 = NULL,
    dictName4 = NULL, reset = TRUE)
getdictionary()

Arguments

dictName1

Either a codelist or a dictionary name, one of "icd9", "icd10", "opcs" or "read", or a vector of two or more of these dictionary names, or leave empty to clear the categories but not alter which dictionaries are in use.

dictName2

Either a codelist or a dictionary name, one of "icd9", "icd10", "opcs" or "read".

dictName3

Either a codelist or a dictionary name, one of "icd9", "icd10", "opcs" or "read".

dictName4

Either a codelist or a dictionary name, one of "icd9", "icd10", "opcs" or "read".

reset

TRUE or FALSE, whether to reset the categories in the master dictionary

Value

setdictionary returns the selected dictionaries, invisibly. It also displays a message stating which dictionaries are in use and that the categories have been cleared, and whether the terms in the dictionary have been initialised using another codelist.

getdictionary returns a character vector for the selected dictionaries.

Note

setdictionary should only be used to set which dictionaries are in use for an entire work session. Selection objects can contain terms in all dictionaries but only the terms in dictionaries in use (according to getdictionary) are visible. To limit the dictionary for a particular selection, use dictis with a Boolean operator e.g. termhas('angina') %AND% dictis('read', 'icd10')

See Also

Master dictionary: CALIBER_DICT

Metadata for master dictionary: META

Assigning categories in master dictionary: assigncat

Selecting terms to assign to a category: codematch, dictis, explode, termhas

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## To clear categories but not alter which dictionaries are selected
setdictionary()

## To select one, two or three dictionaries to use for codelist generation
setdictionary('icd10')
setdictionary('read', 'opcs')
setdictionary('icd10', 'read', 'opcs')

## To find out which dictionaries are selected
getdictionary()

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.