R/emld-methods.R

Defines functions print.emld

#' @importFrom yaml as.yaml
#' @importFrom jsonlite toJSON
#' @export
print.emld <- function(x, ...){
  x[["@context"]] <- NULL # context just adds clutter to display
  x[["@type"]] <- NULL
  style <- getOption("emld_print", "yaml")
  #cat("EML as an emld object:\n\n\n")
  switch(style,
         "yaml" = cat(yaml::as.yaml(x)),
         "json" = cat(jsonlite::toJSON(x, auto_unbox = TRUE, pretty = TRUE))
  )
}

Try the emld package in your browser

Any scripts or data that you put into this service are public.

emld documentation built on Oct. 23, 2020, 7:45 p.m.