categories: Get and set categories table for the master dictionary

Description Usage Arguments Details Value See Also Examples

Description

These functions retrieve or save the categories table to/from the META table (which is inside the CALIBERcodelists namespace), or retrieve the categories table from a codelist.

Usage

1
2
3
4
5
6
retrieveCategories(codelist = NULL)
saveCategories(numbers, shortnames = NULL, descriptions = NULL,
    cattable = NULL, codelist = NULL)
addCategory(number, shortname, description = "",
    codelist = NULL)
removeUnusedCategories(codelist = NULL)

Arguments

codelist

codelist to retrieve categories from, or save/retrieve to/from META if NULL.

numbers

integer vector of category numbers for the entire categories table

shortnames

character vector of short category descriptions for the entire categories table

descriptions

character vector of full category descriptions for the entire categories table

cattable

a data.table containing the new categories table with columns: category, shortname, description (i.e. in the same format as returned by retrieve_categories)

number

a single new category number

shortname

character vector of a new category shortname to add

description

character vector of a new full category description to add

Details

saveCategories saves the categories to META, in the form of three strings which are elements in the 'value' column alongside the 'item' entries: category, shortname and description (see META).

removeUnusedCategories removes unused category levels from a codelist, or from META if no codelist is given.

Value

retrieveCategories returns a data.table containing the category numbers, shortnames and descriptions. saveCategories invisibly returns the subset of META containing the category table. removeUnusedCategories invisibly returns the modified codelist or the subset of META containing the category table.

See Also

as.codelist, assigncat

Examples

1
2
3
4
5
retrieveCategories()

saveCategories(numbers=c(1, 2),
	shortnames=c('SA', 'UA'),
	descriptions=c('Stable angina', 'Unstable angina'))


Search within the CALIBERcodelists package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.