Skip to contents

These functions traverse the relationship graph to find attributes for codes or codes that have specific attributes.

Usage

ATTRIBUTES_FOR(
  ...,
  type = getOption("codeminer.code_type"),
  lookup_version = getOption("codeminer.lookup_version", default = "latest"),
  relationship_version = getOption("codeminer.relationship_version", default = "latest"),
  relationship_types = NULL,
  preferred_description_only = TRUE,
  max_nodes = getOption("codeminer.max_traversal_nodes", default = 20000L),
  col_filters = "default"
)

HAS_ATTRIBUTES(
  ...,
  type = getOption("codeminer.code_type"),
  lookup_version = getOption("codeminer.lookup_version", default = "latest"),
  relationship_version = getOption("codeminer.relationship_version", default = "latest"),
  relationship_types = NULL,
  preferred_description_only = TRUE,
  max_nodes = getOption("codeminer.max_traversal_nodes", default = 20000L),
  col_filters = "default"
)

Arguments

...

Codes to start from. Supports flexible input like CODES().

type

Code type (character).

lookup_version

Lookup table version (character).

relationship_version

Relationship table version (character).

relationship_types

Relationship types to filter by. Can be a character vector, a codeminer_codelist (e.g. from CODES()), or a data frame with a code column. Supports <<description>> comments. If NULL (default), all relationship types are included.

preferred_description_only

Logical. If TRUE, return only preferred descriptions.

max_nodes

Integer. Ceiling on the number of codes the traversal can accumulate before aborting (checked after each generation of the traversal, before the next one runs). Defaults to getOption("codeminer.max_traversal_nodes", default = 20000).

col_filters

Column filters to apply. See CODES() for details.

Value

A data frame of codes and descriptions

Details

  • ATTRIBUTES_FOR() returns attribute codes for the supplied codes

  • HAS_ATTRIBUTES() returns codes that have the specified attribute codes

See also

Other Code relationships: parent_child_retrieval, relationship_types

Examples

create_dummy_database()
#> ✔ Dummy database ready to use!
#> ℹ To reconnect to your previous database:
#>   `Sys.setenv(CODEMINER_DB_PATH = "/tmp/Rtmp2UzWkJ/file1c05771011e9")`
#>   `codeminer_connect()`
# ATTRIBUTES_FOR returns attributes for codes
# HAS_ATTRIBUTES returns codes that have the specified attributes