getNamedElement: Extract the value in a vector by name

Description Usage Arguments Value Author(s) Examples

View source: R/misc.R

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

1

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

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

Example output

Attaching package: 'KEGGgraph'

The following object is masked from 'package:graphics':

    plot

[1] "Bremen"
[1] NA

KEGGgraph documentation built on Nov. 8, 2020, 5:42 p.m.