getNamedElement: Extract the value in a vector by name

View source: R/misc.R

getNamedElementR Documentation

Extract the value in a vector by name

Description

The function extracts the value(s) in a named vector by given name(s), in case no element is found with the given name, NA will be returned

Usage

getNamedElement(vector, name)

Arguments

vector

A named vector of any data type

name

Wanted name

Value

The elements with the given name, 'NA' in case no one was found

Author(s)

Jitao David Zhang mailto:jitao_david.zhang@roche.com

Examples

vec <- c(first="Hamburg", second="Hoffenheim",third="Bremen")
getNamedElement(vec, "third")
getNamedElement(vec, "last")

Accio/KEGGgraph documentation built on Jan. 13, 2023, 1:03 p.m.