SNOMEDcodelist: Convert a data.frame to a SNOMEDcodelist object

View source: R/SNOMEDcodelist.R

SNOMEDcodelistR Documentation

Convert a data.frame to a SNOMEDcodelist object

Description

SNOMEDcodelist is an S3 class for lists of SNOMED CT concepts. It consists of conceptId and include_desc columns. The option to include descendants allows the creation of more succinct SNOMED codelists.

Usage

SNOMEDcodelist(
  x,
  include_desc = FALSE,
  format = c("simple", "tree", "exptree"),
  codelist_name = NULL,
  version = NULL,
  author = NULL,
  date = NULL,
  SNOMED = getSNOMED(),
  show_excluded_descendants = FALSE
)

as.SNOMEDcodelist(x, ...)

Arguments

x

vector of SNOMED CT concept IDs, something which can be coerced to a SNOMEDconcept object, or a data.frame with a column 'conceptId' containing SNOMED CT concept concept IDs in integer64 or text format and optional column 'include_desc' (Boolean) stating whether descendants of the term should be included.

include_desc

Boolean vector stating whether descendants are included, recycled if necessary. Default = FALSE. Ignored if x contains a column 'include_desc'

format

Whether the codelist is expressed as a simple enumeration of concepts ('simple'), as a set of concept hierarchies ('tree'), or concept hierarchies showing all descendant terms ('exptree'). Codelists can be converted between the formats, but the result of conversion may depend on the SNOMED CT dictionary being used.

codelist_name

Name of the codelist (character vector of length 1)

version

Version of the codelist (character vector of length 1)

author

Author of the codelist (character vector of length 1)

date

Date attributed to the codelist (character vector of length 1)

SNOMED

environment containing a SNOMED dictionary

show_excluded_descendants

Whether to show excluded descendants alongside the codes included in the codelist (for a 'tree' or 'exptree' format codelist).

...

other arguments to pass to SNOMEDcodelist

Details

Input is a data.frame or data.table with column names 'conceptId' and optionally 'include_desc', which is FALSE by default, but if TRUE then the codelist automatically includes all active descendants of that concept.

If the codelist is intended to contain inactive concepts, it can only exist in the 'simple' format. Inactive concepts will be lost if the codelist is converted between formats.

as.SNOMEDcodelist converts its argument into a SNOMEDcodelist but leaves it unchanged if it is already a SNOMEDcodelist.

Value

An object of class 'SNOMEDcodelist'

See Also

htmlCodelistHierarchy

Other SNOMEDcodelist functions: addInactiveConcepts(), expandSNOMED(), export(), is.SNOMEDcodelist(), print.SNOMEDcodelist()

Other SNOMEDcodelist functions: addInactiveConcepts(), expandSNOMED(), export(), is.SNOMEDcodelist(), print.SNOMEDcodelist()

Examples

SNOMED <- sampleSNOMED()

my_concepts <- SNOMEDconcept('Heart failure')
SNOMEDcodelist(my_concepts)
SNOMEDcodelist(data.frame(conceptId = my_concepts))
as.SNOMEDcodelist(data.frame(conceptId = my_concepts,
  include_desc = TRUE))

anoopshah/Rdiagnosislist documentation built on April 21, 2023, 11:49 p.m.