get_concept: Get a concept in an ontology

View source: R/get_concept.R

get_conceptR Documentation

Get a concept in an ontology

Description

Get a concept in an ontology

Usage

get_concept(..., external = FALSE, matches = FALSE, ontology = NULL)

Arguments

...

combination of column name and value to filter that column by.

external

logical(1)
whether or not to return merely the table of external concepts.

matches

logical(1)
whether or not to include external concepts as label instead of id in the match columns of the harmonised concepts; this allows querying the external concepts in the harmonised concepts (only if external = FALSE).

ontology

ontology(1)
either a path where the ontology is stored, or an already loaded ontology.

Value

A table of a subset of the ontology according to the values in ...

Examples

ontoDir <- system.file("extdata", "crops.rds", package = "ontologics")
onto <- load_ontology(path = ontoDir)

# exact matches from a loaded ontology ...
get_concept(label = "FODDER CROPS", ontology = onto)

# ... or a path
get_concept(label = c("FODDER CROPS", "CEREALS"), ontology = ontoDir)

# ignore querries that would not be valid in filter()
get_concept(label != 'Bioenergy woody' & has_broader == '.01', ontology = onto)

# extract concepts based on regular expressions
library(stringr)
get_concept(str_detect(label, "crop") & str_detect(id, ".03$"), ontology = ontoDir)


ontologics documentation built on April 4, 2025, 12:39 a.m.