R/internal_name_by_id.R

Defines functions get_by_id name_by_id_or_label name_by_id

## Helper functions 
name_by_id <- function(x)
  unname(sapply(x, function(i) if(length(i@id)>0) i@id else NULL))
name_by_id_or_label <- function(x)
  unname(sapply(x, function(i) if(length(i@label)>0) i@label else i@id))

get_by_id <- function(x, id){
  ids <- sapply(x, function(i) i@id)
  m <- match(id, ids)
  x[[m]]
}

Try the RNeXML package in your browser

Any scripts or data that you put into this service are public.

RNeXML documentation built on Feb. 16, 2023, 6:56 p.m.