knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(dplyr) # For %>%
Frictionless is an R package to read and write Frictionless Data Packages. A Data Package is a simple container format and standard to describe and package a collection of (tabular) data. It is typically used to publish FAIR and open datasets.
To get started, see:
Frictionless currently implements Data Package v1. Our goal is to support Data Package v2 as well.
Install the latest released version from CRAN:
install.packages("frictionless")
Or the development version from GitHub or R-universe:
# install.packages("devtools") devtools::install_github("frictionlessdata/frictionless-r") # Or rOpenSci R-universe install.packages("frictionless", repos = "https://ropensci.r-universe.dev")
With frictionless you can read data from a Data Package (local or remote) into your R environment. Here we read bird GPS tracking data from a Data Package published on Zenodo:
library(frictionless) # Read the datapackage.json file # This gives you access to all Data Resources of the Data Package without # reading them, which is convenient and fast. package <- read_package("https://zenodo.org/records/10053702/files/datapackage.json") package # List resources resources(package) # Read data from the resource "gps" # This will return a single data frame, even though the data are split over # multiple zipped CSV files. read_resource(package, "gps")
You can also create your own Data Package, add data and write it to disk:
# Create a Data Package and add the "iris" data frame as a resource my_package <- create_package() %>% add_resource(resource_name = "iris", data = iris) my_package # Write the Data Package to disk my_package %>% write_package("my_directory")
unlink("my_directory", recursive = TRUE)
For more functionality, see get started or the function reference.
datapackage.r is an alternative R package to work with Data Packages. It has an object-oriented design and offers validation.
frictionless on the other hand allows you to quickly read and write Data Packages to and from data frames, getting out of the way for the rest of your analysis. It is designed to be lightweight, follows tidyverse principles and supports piping. Its validation functionality is limited to what is needed for reading and writing, see frictionless-py for extensive validation.
citation("frictionless")
.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.