inst/doc/data-package.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## -----------------------------------------------------------------------------
library(frictionless)
file <- system.file("extdata", "v1", "datapackage.json", package = "frictionless")
package <- read_package(file)

## -----------------------------------------------------------------------------
package

## -----------------------------------------------------------------------------
attributes(package)

## -----------------------------------------------------------------------------
# From scratch
create_package()

# From an existing package
create_package(package)

## ----message = FALSE----------------------------------------------------------
library(dplyr) # Or library(magrittr)
my_package <-
  create_package() %>%
  add_resource(resource_name = "iris", data = iris) %>%
  append(c("title" = "my_package"), after = 0) %>%
  create_package() # To add the datapackage class again
my_package

## -----------------------------------------------------------------------------
package <- example_package()
package$id <- "https://doi.org/10.5281/zenodo.10053702/"
package

Try the frictionless package in your browser

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

frictionless documentation built on June 8, 2025, 10:38 a.m.