get.h: Get a Value in a Hash (a hashed environment)

Description Usage Arguments Value Author(s) Examples

Description

This function retrieves the value for a key from a hash.

Usage

1
get.h(key, hash, default=NULL)

Arguments

key

A key for the hash, which will be cast into as.character().

hash

An R environment but for purposes here a hash.

default

A default return value in case the key is not available in the hash.

Value

This function returns the value or NULL if it does not exist. The function does not return a logical TRUE or FALSE because such a practice could be potentially confusing in some circumstances and lead to unexpected results of dependent code.

Author(s)

W.H. Asquith, Spring 2009

Examples

1
2
3
4
my.new.hash <- new.h()
set.h("author",  "william", my.new.hash)
set.h("keyword", "hail", my.new.hash)
get.h("publisher", my.new.hash)

wasquith-usgs/rash documentation built on May 29, 2019, 10:31 a.m.