R/print_dataresource.R

Defines functions print.dataresource

#' @export
print.dataresource <- function(x, properties = NA, ...) {
  printdescription(x)
  if (length(properties) == 1 && is.na(properties)) properties <- dpproperties(x)
  properties  <- setdiff(properties, c("name", "title", "description"))
  toprint <- intersect(names(x), properties)
  toprint <- x[toprint]
  if ("schema" %in% names(toprint)) class(toprint[["schema"]]) <- "tableschema"
  if (length(toprint)) {
    cat("\nSelected properties:\n")
    utils::str(toprint, max.level=1, give.attr=FALSE, no.list = TRUE, 
      comp.str="", indent.str="", give.head = FALSE)
  }
}
djvanderlaan/datapackage documentation built on March 18, 2024, 4:57 p.m.