-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathminimal-edi-package.Rmd
66 lines (53 loc) · 1.75 KB
/
minimal-edi-package.Rmd
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
---
title: "Minimal EDI package generated using EMLassemblyline and ediutilities"
author: "Joe Futrelle"
date: "2022-01-24"
output: html_notebook
---
Libraries used
```{r}
# two of the required packages are installed from GitHub
# library(remotes)
# remotes::install_github("EDIorg/EMLassemblyline")
# remotes::install_github("WHOIGit/ediutilities")
library(EMLassemblyline)
library(ediutilities)
library(here)
library(lubridate)
library(pander)
```
Read example data table
```{r}
data_table <- read.csv(here('nes-lter-minimal.csv'))
data_table$date = ymd_hms(data_table$date)
```
Generate basic summary of data table
```{r}
# Just for inspecting the summary: change all character columns to factor
DF <- data_table
DF[sapply(DF, is.character)] <- lapply(DF[sapply(DF, is.character)], as.factor)
pander::pander(summary(DF))
```
Read the Excel metadata template and generate text templates used by
EMLassemblyline
```{r}
excel_to_template(here('nes-lter-minimal-info'), 'nes-lter-minimal', rights='CC0')
```
Generate the package and insert the parent project node into the resulting EML
```{r}
# use a dummy package ID
pkg_id <- 'knb-lter-nes.999.1'
make_eml(here(),
dataset.title='Demonstration of minimal EDI package',
data.table='nes-lter-minimal.csv',
data.table.description='Example NES-LTER data',
data.table.name = 'Subset of NES-LTER nutrient data',
temporal.coverage = temporal_coverage(data_table$date),
geographic.description = "NES-LTER Transect",
geographic.coordinates = geographic_coordinates(data_table$latitude, data_table$longitude),
maintenance.description = "ongoing",
user.id = "NES",
user.domain = "LTER",
package.id = pkg_id)
project_insert(pkg_id)
```