#' Turn a hash into a data.frame
#'
#' Transform a hash into a nrowx2 data.frame
#'
#' @param x hash
#' @param key string; name for the column of keys (Default: "key").
#' @param value string; name for the column of values (Default: "value")
#' @param ... additional arguments to [values()]
#'
#' @return
#' a data.frame with as many row as elements in `x` and two columns one for the
#' keys (always character) and value a list column
#'
#'
#' @examples
#'
#' h <- hash( a=1, b=1:2, c=1:3)
#' as.data.frame(h)
#'
#' @export
as.data.frame.hash <- function(x, ..., key="key", value="value" ) {
df <- as.data.frame( list( keys(x) ), col.names=key )
df[[value]] <- values(x)
df
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.