merge.codelist: Merge two codelists

Description Usage Arguments Value Note See Also Examples

View source: R/merge.R

Description

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

Usage

1
2
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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)

CALIBERcodelists documentation built on Feb. 28, 2020, 3:01 a.m.