Learn R Programming

Dict (version 0.6)

make_dict: Create a new dictionary from a list or vector of keys and values

Description

Create a new dictionary from separate keys and values.

Usage

make_dict(keys, values, default = NULL, strict = FALSE)

Arguments

keys
a vector of character keys
values
a vector or list of values to be associated to the corresponding keys
default
a default value for the dictionary (see default_dict)
strict
whether the dictionary should be strict and raise an exception when a non-existing key is accessed (see strict_dict)

Value

a new dictionary

Examples

Run this code
employee <- make_dict(c('name', 'age'), list('John', 60))

Run the code above in your browser using DataLab