Skip to content

Commit 32b0d7f

Browse files
committed
Update readme to fix http URL
1 parent a139274 commit 32b0d7f

File tree

2 files changed

+67
-47
lines changed

2 files changed

+67
-47
lines changed

README.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The goal of `dataspice` is to make it easier for researchers to create basic, li
2828
- Create a helpful dataset README webpage for your data similar to how [pkgdown](https://pkgdown.r-lib.org/) creates websites for R packages.
2929
- Produce more complex metadata formats for richer description of your datasets and to aid dataset discovery.
3030

31-
Metadata fields are based on [Schema.org/Dataset](http://schema.org/Dataset) and other [metadata standards](https://github.com/ropenscilabs/dataspice#resources) and represent a lowest common denominator which means converting between formats should be relatively straightforward.
31+
Metadata fields are based on [Schema.org/Dataset](https://schema.org/Dataset) and other [metadata standards](https://github.com/ropenscilabs/dataspice#resources) and represent a lowest common denominator which means converting between formats should be relatively straightforward.
3232

3333
## Example
3434

README.md

+66-46
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ then be used to:
2020
datasets and to aid dataset discovery.
2121

2222
Metadata fields are based on
23-
[Schema.org/Dataset](http://schema.org/Dataset) and other [metadata
23+
[Schema.org/Dataset](https://schema.org/Dataset) and other [metadata
2424
standards](https://github.com/ropenscilabs/dataspice#resources) and
2525
represent a lowest common denominator which means converting between
2626
formats should be relatively straightforward.
@@ -40,16 +40,20 @@ Installation
4040
You can install the development version from
4141
[GitHub](https://github.com/) with:
4242

43-
# install.packages("devtools")
44-
devtools::install_github("ropenscilabs/dataspice")
43+
``` r
44+
# install.packages("devtools")
45+
devtools::install_github("ropenscilabs/dataspice")
46+
```
4547

4648
Workflow
4749
--------
4850

49-
create_spice()
50-
# Then fill in template CSV files, more on this below
51-
write_spice()
52-
build_site() # Optional
51+
``` r
52+
create_spice()
53+
# Then fill in template CSV files, more on this below
54+
write_spice()
55+
build_site() # Optional
56+
```
5357

5458
![worfklowdiagram](man/figures/dataspice_workflow.png)
5559

@@ -87,21 +91,27 @@ the associated helper function and/or
8791
To see an example of how `prep_attributes()` works, load the data files
8892
that ship with the package:
8993

90-
data_files <- list.files(system.file("example-dataset/", package = "dataspice"),
91-
pattern = ".csv",
92-
full.names = TRUE)
94+
``` r
95+
data_files <- list.files(system.file("example-dataset/", package = "dataspice"),
96+
pattern = ".csv",
97+
full.names = TRUE)
98+
```
9399

94100
This function assumes that the metadata templates are in a folder called
95101
`metadata` within a `data` folder.
96102

97-
attributes_path <- file.path("data", "metadata", "attributes.csv")
103+
``` r
104+
attributes_path <- file.path("data", "metadata", "attributes.csv")
105+
```
98106

99107
Using `purrr::map()`, this function can be applied over multiple files
100108
to populate the header names
101109

102-
data_files %>%
103-
purrr::map(~ prep_attributes(.x, attributes_path),
104-
attributes_path = attributes_path)
110+
``` r
111+
data_files %>%
112+
purrr::map(~ prep_attributes(.x, attributes_path),
113+
attributes_path = attributes_path)
114+
```
105115

106116
The output of `prep_attributes()` has the first two columns filled out:
107117

@@ -260,10 +270,10 @@ temporal coverage
260270

261271
`creators.csv` has one row for each of the dataset authors
262272

263-
| id | name | affiliation | email |
264-
|:----|:---------------|:------------------------------------------------------|:-------------------------------------------------------------------------------|
265-
| NA | Jeanette Clark | National Center for Ecological Analysis and Synthesis | <a href="mailto:[email protected]" class="email">[email protected]</a> |
266-
| NA | Rich,Brenner | Alaska Department of Fish and Game | richard.brenner.alaska.gov |
273+
| id | name | affiliation | email |
274+
|:----|:---------------|:------------------------------------------------------|:---------------------------|
275+
| NA | Jeanette Clark | National Center for Ecological Analysis and Synthesis | <[email protected]> |
276+
| NA | Rich,Brenner | Alaska Department of Fish and Game | richard.brenner.alaska.gov |
267277

268278
### Save JSON-LD file
269279

@@ -297,34 +307,38 @@ compatibility with terms from [Schema.org](https://schema.org). However,
297307
`dataspice` will do its best to convert your `dataspice` metadata to
298308
EML:
299309

300-
library(dataspice)
310+
``` r
311+
library(dataspice)
301312

302-
# Load an example dataspice JSON that comes installed with the package
303-
spice <- system.file(
304-
"examples", "annual-escapement.json",
305-
package = "dataspice")
313+
# Load an example dataspice JSON that comes installed with the package
314+
spice <- system.file(
315+
"examples", "annual-escapement.json",
316+
package = "dataspice")
306317

307-
# Convert it to EML
308-
eml_doc <- spice_to_eml(spice)
309-
#> Warning: variableMeasured not crosswalked to EML because we don't have enough
310-
#> information. Use `crosswalk_variables` to create the start of an EML attributes
311-
#> table. See ?crosswalk_variables for help.
312-
#> You might want to run EML::eml_validate on the result at this point and fix what validations errors are produced.You will commonly need to set `packageId`, `system`, and provide `attributeList` elements for each `dataTable`.
318+
# Convert it to EML
319+
eml_doc <- spice_to_eml(spice)
320+
#> Warning: variableMeasured not crosswalked to EML because we don't have enough
321+
#> information. Use `crosswalk_variables` to create the start of an EML attributes
322+
#> table. See ?crosswalk_variables for help.
323+
#> You might want to run EML::eml_validate on the result at this point and fix what validations errors are produced.You will commonly need to set `packageId`, `system`, and provide `attributeList` elements for each `dataTable`.
324+
```
313325

314326
You may receive warnings depending on which `dataspice` fields you
315327
filled in and this process will very likely produce an invalid EML
316328
record which is totally fine:
317329

318-
library(EML)
330+
``` r
331+
library(EML)
319332

320-
eml_validate(eml_doc)
321-
#> [1] FALSE
322-
#> attr(,"errors")
323-
#> [1] "Element '{https://eml.ecoinformatics.org/eml-2.2.0}eml': The attribute 'packageId' is required but missing."
324-
#> [2] "Element '{https://eml.ecoinformatics.org/eml-2.2.0}eml': The attribute 'system' is required but missing."
325-
#> [3] "Element 'dataTable': Missing child element(s). Expected is one of ( physical, coverage, methods, additionalInfo, annotation, attributeList )."
326-
#> [4] "Element 'dataTable': Missing child element(s). Expected is one of ( physical, coverage, methods, additionalInfo, annotation, attributeList )."
327-
#> [5] "Element 'dataTable': Missing child element(s). Expected is one of ( physical, coverage, methods, additionalInfo, annotation, attributeList )."
333+
eml_validate(eml_doc)
334+
#> [1] FALSE
335+
#> attr(,"errors")
336+
#> [1] "Element '{https://eml.ecoinformatics.org/eml-2.2.0}eml': The attribute 'packageId' is required but missing."
337+
#> [2] "Element '{https://eml.ecoinformatics.org/eml-2.2.0}eml': The attribute 'system' is required but missing."
338+
#> [3] "Element 'dataTable': Missing child element(s). Expected is one of ( physical, coverage, methods, additionalInfo, annotation, attributeList )."
339+
#> [4] "Element 'dataTable': Missing child element(s). Expected is one of ( physical, coverage, methods, additionalInfo, annotation, attributeList )."
340+
#> [5] "Element 'dataTable': Missing child element(s). Expected is one of ( physical, coverage, methods, additionalInfo, annotation, attributeList )."
341+
```
328342

329343
This is because some fields in `dataspice` store information in
330344
different structures and because EML requires many fields that
@@ -336,23 +350,29 @@ package](https://github.com/ropensci/eml).
336350

337351
Once you’re done, you can write out an EML XML file:
338352

339-
out_path <- tempfile()
340-
write_eml(eml_doc, out_path)
341-
#> NULL
353+
``` r
354+
out_path <- tempfile()
355+
write_eml(eml_doc, out_path)
356+
#> NULL
357+
```
342358

343359
### Convert from EML
344360

345361
Like converting `dataspice` to EML, we can convert an existing EML
346362
record to a set of `dataspice` metadata tables which we can then work
347363
from within `dataspice`:
348364

349-
library(EML)
365+
``` r
366+
library(EML)
350367

351-
eml_path <- system.file("example-dataset/broodTable_metadata.xml", package = "dataspice")
352-
eml <- read_eml(eml_path)
368+
eml_path <- system.file("example-dataset/broodTable_metadata.xml", package = "dataspice")
369+
eml <- read_eml(eml_path)
370+
```
353371

354-
# Creates four CSVs files in the `data/metadata` directory
355-
my_spice <- eml_to_spice(eml, "data/metadata")
372+
``` r
373+
# Creates four CSVs files in the `data/metadata` directory
374+
my_spice <- eml_to_spice(eml, "data/metadata")
375+
```
356376

357377
Resources
358378
---------

0 commit comments

Comments
 (0)