merge.codelist {CALIBERcodelists}R Documentation

Merge two codelists

Description

Merge two codelists, overwriting categories and metadata using the second codelist.

Usage

## S3 method for class 'codelist'
merge(x, y = NULL, ...)

Arguments

x

a codelist

y

a codelist from the source dictionary as x. If NULL, it is extracted from the codelist under construction in the master dictionary.

...

not used

Value

A codelist containing all terms in x and y, with merged metadata. Priority is always given to y if any information differs between the codelists.

Note

The timestamp of the resultant codelist is the time when the function was run.

See Also

codelist, convert, compare

Examples

setdictionary('icd10') 
assigncat(2, 'MI|Myocardial infarction', termhas('myocardial infarction'))
setMetadata(Name='mi')
mi <- as.codelist()

setdictionary('icd10') 
chd <- as.codelist(codematch('I2[012345]', 'icd10')) 
# select codes mapping to ICD-10 CHD
addCategory(1, 'Coronary heart disease', codelist=chd)
setattr(chd, 'Name', 'chd')

# Merge the codelists, with priority for CHD
merge(mi, chd)
# Merge the codelists, giving priority to MI
merge(chd, mi)

[Package CALIBERcodelists version 0.2-11 Index]