-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathREADME.Rmd
More file actions
152 lines (119 loc) Ā· 4.05 KB
/
README.Rmd
File metadata and controls
152 lines (119 loc) Ā· 4.05 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
143
144
145
146
147
148
149
150
151
152
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rocrateR: Tools for Creating and Manipulating RO-Crates <img src="man/figures/logo.png" alt="logo" align="right" height=200px style="float:right; height:200px;"/>
<!-- badges: start -->
[](https://CRAN.R-project.org/package=rocrateR)
[](https://github.com/ResearchObject/ro-crate-r/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/ResearchObject/ro-crate-r)

<!-- badges: end -->
`{rocrateR}` provides a native R interface for creating, manipulating, validating and packaging RO-Crates.
RO-Crate is a lightweight approach to packaging research data with structured metadata using JSON-LD.
## Installation
You can install the released version of `{rocrateR}` from [CRAN](https://cran.r-project.org/package=rocrateR) with:
``` r
install.packages("rocrateR")
```
And the development version from [GitHub](https://github.com/ResearchObject/ro-crate-r/) with:
``` r
# install.packages("pak")
pak::pak("ResearchObject/ro-crate-r@dev")
```
## Quick Start
```{r, eval = FALSE}
# create a crate
crate <- rocrateR::rocrate()
crate <- crate |>
# add a dataset entity
rocrateR::add_dataset("iris.csv", iris) |>
# add workflow entity
rocrateR::add_workflow(
file_id = "analysis.R",
name = "Data analysis pipeline",
content = c(
"data <- read.csv('iris.csv')",
"summary(data)"
)
) |>
# add software entity
rocrateR::add_software("R", version = R.version.string)
# write to disk
path_to_rocrate_bag <- rocrateR::bag_rocrate(crate, path = "./my_roc")
path_to_rocrate_bag_contents <- path_to_rocrate_bag |>
rocrateR::unbag_rocrate(output = "ROC")
```
```{r, echo = FALSE}
# create a crate
crate <- rocrateR::rocrate()
crate <- crate |>
# add a dataset entity
rocrateR::add_dataset("iris.csv", iris) |>
# add workflow entity
rocrateR::add_workflow(
file_id = "analysis.R",
name = "Data analysis pipeline",
content = c(
"data <- read.csv('iris.csv')",
"summary(data)"
)
) |>
# add software entity
rocrateR::add_software("R", version = R.version.string)
# write to disk
tmp_dir <- "./my_roc"
dir.create(tmp_dir, showWarnings = FALSE, recursive = TRUE)
suppressMessages(
path_to_rocrate_bag <- rocrateR::bag_rocrate(crate, path = tmp_dir)
)
# extract files in temporary directory
suppressMessages(
path_to_rocrate_bag_contents <- path_to_rocrate_bag |>
rocrateR::unbag_rocrate(output = file.path(tmp_dir, "ROC"))
)
# create tree with the files
withr::with_dir(
dirname(path_to_rocrate_bag_contents),
fs::dir_tree(basename(path_to_rocrate_bag_contents))
)
unlink(tmp_dir, recursive = TRUE)
```
## What You Can Do
* š¦ Create RO-Crates from projects or folders
* š Add datasets, software, workflows, notebooks, authors
* āļø Edit and enrich metadata
* š Inspect crate contents
* ā
Validate structure and metadata
* š§³ Create RO-Crate Bags for preservation
## Typical Workflow
```{r, eval = FALSE}
roc_bag_path <- rocrateR::crate_project() |>
rocrateR::add_author("Alice Smith") |>
rocrateR::add_dataset("data/raw.csv") |>
rocrateR::add_software("analysis.R") |>
rocrateR::bag_rocrate(path = ".")
```
## Validation
```{r, eval = FALSE}
rocrateR::validate_rocrate(roc_bag_path)
```
## Learn More
For further details, see the following vignette:
```{r, eval = FALSE}
vignette("getting-started-with-rocrateR")
```
## Why rocrateR?
- Native R interface to RO-Crate
- No external system dependencies
- Supports BagIt packaging (RFC 8493)
- Structural validation tools
- Designed for reproducible research workflows