https://github.com/b-cubed-eu/b3data-scripts
Scripts used to create the frictionless b3data data package
https://github.com/b-cubed-eu/b3data-scripts
b3verse data-cubes data-package frictionless
Last synced: 10 months ago
JSON representation
Scripts used to create the frictionless b3data data package
- Host: GitHub
- URL: https://github.com/b-cubed-eu/b3data-scripts
- Owner: b-cubed-eu
- License: mit
- Created: 2025-04-08T11:17:53.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-08T12:20:15.000Z (about 1 year ago)
- Last Synced: 2025-04-08T12:28:55.024Z (about 1 year ago)
- Topics: b3verse, data-cubes, data-package, frictionless
- Language: R
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
README

[](https://github.com/b-cubed-eu/b3data-scripts/releases)
[](https://www.repostatus.org/#wip)

[](https://doi.org/10.5281/zenodo.15190796)
# Scripts used to create the b3data frictionless data package
[Langeraert, Ward](https://orcid.org/0000-0002-5900-8109)[^1][^2][^3]
[Van Daele, Toon](https://orcid.org/0000-0002-1362-853X)[^4][^5]
Research Institute for Nature and Forest (INBO)[^6] European Union’s
Horizon Europe Research and Innovation Programme (ID No 101059592)[^7]
**keywords**: data package; b3verse; frictionless; data cubes
This repository contains scripts to create the b3data
[frictionless](https://docs.ropensci.org/frictionless/) data package.
This data package includes data resources used across the
[b3verse](https://docs.b-cubed.eu/guides/b3verse/) and is published on
[Zenodo](https://doi.org/10.5281/zenodo.15181097).
This code is developed in context of **T5.5** of the [B-Cubed
project](https://b-cubed.eu/).
## Order of execution
Follow the steps below to run the scripts in a logical order.
**1.** `create_b3data_package.Rmd`
- creates the data package
- adds tabular resources
- writes data package
**2.** `add_spatial_resources.Rmd`
- loads data package
- adds spatial resources
- writes data package
## 📦 The `b3data` data package
- **Name**: `b3data`
- **Published at**:
[](https://doi.org/10.5281/zenodo.15181097)
- **Used in**: [b3verse](https://docs.b-cubed.eu/guides/b3verse/)
- **Importable in R via**:
[frictionless](https://docs.ropensci.org/frictionless/) R package
Resources can be imported in R like this:
### Step 1 — Load the frictionless R package
``` r
# install.packages("frictionless")
library(frictionless)
```
### Step 2 — Read the package descriptor from Zenodo
The content of the data package can be consulted using `read_package()`.
``` r
b3data_package <- read_package("https://zenodo.org/records/15211029/files/datapackage.json")
b3data_package
#> A Data Package with 2 resources:
#> • bird_cube_belgium_mgrs10
#> • mgrs10_refgrid_belgium
#> For more information, see .
#> Use `unclass()` to print the Data Package as a list.
```
### Step 3 — Import a resource (dataset)
Tabular datasets can be loaded using `read_resource()`.
``` r
bird_cube_belgium <- read_resource(b3data_package, "bird_cube_belgium_mgrs10")
head(bird_cube_belgium)
#> # A tibble: 6 × 8
#> year mgrscode specieskey species family n mincoordinateuncerta…¹
#>
#> 1 2000 31UDS65 2473958 Perdix perdix Phasi… 1 3536
#> 2 2000 31UDS65 2474156 Coturnix coturn… Phasi… 1 3536
#> 3 2000 31UDS65 2474377 Fulica atra Ralli… 5 1000
#> 4 2000 31UDS65 2475443 Merops apiaster Merop… 6 1000
#> 5 2000 31UDS65 2480242 Vanellus vanell… Chara… 1 3536
#> 6 2000 31UDS65 2480637 Accipiter nisus Accip… 1 3536
#> # ℹ abbreviated name: ¹mincoordinateuncertaintyinmeters
#> # ℹ 1 more variable: familycount
```
For non-tabular resources (e.g. spatial or raster data), use packages
like `sf` or `terra` directly.
``` r
mgrs10_belgium <- sf::st_read(
"https://zenodo.org/records/15211029/files/mgrs10_refgrid_belgium.gpkg",
quiet = TRUE)
head(mgrs10_belgium)
#> Simple feature collection with 6 features and 1 field
#> Geometry type: POLYGON
#> Dimension: XY
#> Bounding box: xmin: 460000.1 ymin: 5620000 xmax: 480000.1 ymax: 5670000
#> Projected CRS: WGS 84 / UTM zone 31N
#> mgrscode geom
#> 1 31UDS65 POLYGON ((470000.1 5651000,...
#> 2 31UDS66 POLYGON ((470000.1 5661000,...
#> 3 31UDS72 POLYGON ((480000 5621000, 4...
#> 4 31UDS73 POLYGON ((480000.1 5631000,...
#> 5 31UDS74 POLYGON ((480000.1 5641000,...
#> 6 31UDS75 POLYGON ((480000.1 5651000,...
```
## 📁 Repository structure
├── source ├ R markdown files
│ └── R ├ R scripts
├── data
│ ├── raw ├ create this folder and store raw data
│ ├── processed ├ store processed data
│ └── b3data_package ├ b3data frictionless data package
├── checklist.yml ├ options checklist package (https://github.com/inbo/checklist)
├── organisation.yml ├ organisation info (https://inbo.github.io/checklist/articles/organisation.html)
├── inst
│ └── en_gb.dic ├ dictionary with words that should not be checked by the checklist package
├── .github │
│ ├── workflows │
│ │ └── checklist_project.yml ├ GitHub action settings
│ ├── CODE_OF_CONDUCT.md │
│ └── CONTRIBUTING.md │
├── b3data-scripts.Rproj ├ R project
├── README.md ├ project description
├── LICENSE.md ├ license
├── CITATION.cff ├ citation info
├── .zenodo.json ├ zenodo metadata
└── .gitignore ├ files to ignore
[^1]: author
[^2]: contact person
[^3]: Research Institute for Nature and Forest (INBO), Herman
Teirlinckgebouw, Havenlaan 88 PO Box 73, B-1000 Brussels, Belgium
[^4]: author
[^5]: Research Institute for Nature and Forest (INBO), Herman
Teirlinckgebouw, Havenlaan 88 PO Box 73, B-1000 Brussels, Belgium
[^6]: copyright holder
[^7]: funder