-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
142 lines (109 loc) · 5.04 KB
/
README.Rmd
File metadata and controls
142 lines (109 loc) · 5.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = file.path("man", "figures", "readme-"),
out.width = "80%",
dpi = 300
)
```
<!-- badges: start -->

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

[](https://doi.org/10.5281/zenodo.15190796)
<!-- badges: end -->
# Scripts used to create the b3data frictionless data package
[Langeraert, Ward](https://orcid.org/0000-0002-5900-8109)[^aut][^cre][^INBO]
[Van Daele, Toon](https://orcid.org/0000-0002-1362-853X)[^aut][^INBO]
Research Institute for Nature and Forest (INBO)[^cph]
European Union's Horizon Europe Research and Innovation Programme (ID No 101059592)[^fnd]
[^cph]: copyright holder
[^fnd]: funder
[^aut]: author
[^cre]: contact person
[^INBO]: Research Institute for Nature and Forest (INBO), Herman Teirlinckgebouw, Havenlaan 88 PO Box 73, B-1000 Brussels, Belgium
**keywords**: data package; b3verse; frictionless; data cubes
<!-- community: b3 -->
<!-- community: inbo -->
<!-- description: start -->
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).
<!-- description: end -->
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, echo=FALSE}
# nolint start
```
```{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
```
### 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)
```
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)
```
```{r, echo=FALSE}
# nolint end
```
## 📁 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
```