Open peterdesmet opened 2 years ago
The suggested datacite_to_eml()
function is now documented at https://inbo.github.io/movepub/reference/datacite_to_eml.html. I think the EML package would be a better home for it.
As another convenience method to template an EML record from existing metadata, this seems useful to me and I would support its inclusion. @cboettig woiuld you have any objections? If not, maybe @peterdesmet could submit a PR?
:+1: yeah seems like this would be helpful! PRs welcome!
Cool, I'll see when I have some time for that. The function relies quite a lot on the purrr
package. Is it fine if this is added as a dependency?
For the packages I maintain, I try to keep dependencies to a minimum, especially for large, packages or packages that entrain a complex ecosystem, as they usually cause maintenance headaches down the road. We spend a fair number of cycles just treading water on package dependencies trying to keep packages on CRAN. Backwards incompatible changes or a package being supplanted by a "newer" version (as is common for RStudio packages) has caused a lot of churn for us. That said, if you really need it, then that is what they are there for. But keep in mind that each dependency is a potential future upgrade problem.
I share your sentiment. I'll see if I can replace my three uses of purrr::map_chr()
and two uses of purrr::map()
with a base R alternative, if it remains readable (code at https://github.com/inbo/movepub/blob/main/R/datacite_to_eml.R#L26-L49).
map
is essentially lapply
, and map_chr
is essentially vapply
with a template type. e.g.
keywords <- purrr::map_chr(metadata$subjects, "subject")
## is the same as
keywords <- vapply(metadata$subjects, `[[`, character(1L), "subject")
(yes, [[
is a the familiar sub-setting function, recall in R everything is a function). (Not tested)
That said, purrr
is a light dependency compared to some things EML already pulls in....
👋 I have written a function that converts DataCite metadata to EML, with the DOI as the parameter. I'm planning to use this for at least 2 packages and was wondering if this function would be a good fit to be added to the
EML
package?Context
I'm in the process of publishing bird tracking datasets that I already published on Zenodo to GBIF, to open them up to a wider audience. One of the steps in the process is converting the dataset metadata to EML, which can then be uploaded to a GBIF IPT for publication. I don't want to do this manually, which is why I wrote a function. To make it more generic than Zenodo, I'm pulling the metadata from the DataCite.org API (rather than the Zenodo API), where all research repositories push metadata to if they want to mint a DOI.
Functionality
Created on 2022-05-03 by the reprex package (v2.0.1)