xget: Get named item when unsure of name

Description Usage Arguments Value Examples

View source: R/utils.R

Description

If a user gives you a named vector or list and there are a few possibilities for the item you want to get, list the possible names in order, using integers for indices.

Usage

1
xget(x, ..., .default = NULL)

Arguments

x

named vector or list

...

possible names in x in priority order

.default

default value if no names found

Value

list or vector item

Examples

1
2
3
4
x <- c(h = 100, w = 200)

width <- xget(x, "width", "w", 1)
height <- xget(x, "height", "h", 2)

facelab/webmorph documentation built on April 11, 2021, 6:34 a.m.