merge.codelist {CALIBERcodelists} | R Documentation |
Merge two codelists, overwriting categories and metadata using the second codelist.
## S3 method for class 'codelist' merge(x, y = NULL, ...)
x |
a codelist |
y |
a codelist from the source dictionary as |
... |
not used |
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.
The timestamp of the resultant codelist is the time when the function was run.
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)