Dictionaries are a concept of types modelled after R environments. Dictionaries are containers of R objects that:

  • Contain uniquely named objects.

  • Can only be indexed by name. They must implement the extracting operators $ and [[. The latter returns an error when indexed by position because dictionaries are not vectors (they are unordered).

  • Report a clear error message when asked to extract a name that does not exist. This error message can be customised with the lookup_msg constructor argument.

as_dictionary(x, lookup_msg = NULL, read_only = FALSE)




An object for which you want to find associated data.


An error message when your data source is accessed inappropriately (by position rather than name).


Whether users can replace elements of the dictionary.


Dictionaries are used within the tidy evaluation framework for creating pronouns that can be explicitly referred to from captured code. See eval_tidy().