Opens dataspice's editor for one of the four files that describe the data
deposit, in data/metadata/: the variables ("attributes": their
description and units), the dataset itself ("biblio": description,
temporal and geographic coverage), the people ("creators") or the files
("access": the name of each is its file name without the extension,
to change if you like). Save in the editor and close it.
sync_metadata() has already filled in what the project knows – title,
keywords, the authors with their affiliations, email and ORCID, variable
names – so what is left is what no machine can guess.
Usage
edit_metadata(
what = c("attributes", "biblio", "creators", "access", "write"),
path = NULL
)Arguments
- what
Which file to edit:
"attributes"(the default),"biblio","creators"or"access"; or"write"to compile them.- path
The project, or any folder inside it. Left out, the one
set_paper()named; with none named, this stops before writing: it writes into the project, and easypaper never takes the working directory for it.
Details
what = "write" opens nothing: it compiles the four files into
data/metadata/dataspice.json, the machine-readable description, and
writes data/metadata/index_metadata.html, a page to read it. The area
the data cover, when biblio.csv gives its coordinates, is drawn on that
page as a map inside it, which opens offline: it needs sf, maps and
base64enc, and without them the page has no map, and says so: it never
loads one from the internet. You need it
only to look at them: make_submission() and make_preprint() compile
them again before they build the data compendium, which carries both.
See also
sync_metadata(), and https://docs.ropensci.org/dataspice/ for
what each field means.
Examples
dir <- file.path(tempdir(), "my_paper")
create_paper(dir, git = FALSE)
#> Project created: /tmp/Rtmp92gqjt/my_paper
#> 1. open my_paper.Rproj
#> 2. library(easypaper)
#> 3. set_paper(".") # the project to work on, once a session
#> 4. render_html() # see ?render for every command
write.csv(head(iris), file.path(dir, "data", "iris.csv"), row.names = FALSE)
edit_metadata("write", path = dir) # dataspice.json and its web page
#> Written: /tmp/Rtmp92gqjt/my_paper/data/metadata/dataspice.json
#> /tmp/Rtmp92gqjt/my_paper/data/metadata/index_metadata.html
list.files(file.path(dir, "data", "metadata"))
#> [1] "access.csv" "attributes.csv" "biblio.csv"
#> [4] "creators.csv" "dataspice.json" "index_metadata.html"
# The editors open in an interactive session.
if (interactive()) {
edit_metadata("attributes", path = dir)
edit_metadata("biblio", path = dir)
}
unlink(dir, recursive = TRUE)
