SNOMED <- sampleSNOMED()
original_terms <- c('Systolic heart failure', 'Is a',
'Heart failure with reduced ejection fraction',
'Acute kidney injury due to circulatory failure (disorder)')
# Note in this example 'Is a' has no parents in ancestors,
# and acute kidney failure has two parents in ancestors
# so neither of the parents will be chosen.
# Also test out inclusion of duplicate concepts.
ancestors <- simplify(c(as.SNOMEDconcept(original_terms),
as.SNOMEDconcept(original_terms)[3:4]),
as.SNOMEDconcept(c('Heart failure', 'Acute heart failure',
'Cardiorenal syndrome (disorder)')))
print(cbind(original_terms, description(ancestors$ancestorId)$term))
Run the code above in your browser using DataLab