#' @title Dictionary to a list
#' @description Reused the \code{values} method from \code{dict}.
#' @param x Dictionary.
#' @param ... Additional arguments.
#' @return List of values in \code{x}.
#' @seealso dict
as.list.dict <- function(x, ...) {
x$values()
}
#' @title Generic for casting various types to dict.
#' @param x Input object.
as.dict <- function(x) {
UseMethod("as.dict")
}
#' @title Default as.dict
#' @description Error handling is done in \code{dict()} so we
#' reuse it here.
#' @param x General input (but only several types can be converted to a \code{dict}).
#' @return Dictionary constructed from \code{x} (or error if input is of wrong type).
#' @seealso dict
as.dict.default <- function(x) {
dict(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.