The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
This developer-focused package provides R representations of DDI Codebook 2.5 elements to safely construct fully-validated XML while still being flexible. There are 351 elements in the codebook schema, and while it is the intention of the package to ultimately cover most (if not all) of these, rddi also provides safe node creation tools to quickly create missing elements of the schema.
Install the latest stable version from CRAN:
install.packages("rddi")
Install the development from this repository with:
# install.packages("devtools")
::install_github("nyuglobalties/rddi") devtools
Building components is quick and simple:
library(rddi)
library(magrittr)
<- ddi_citation(ddi_titlStmt(ddi_titl("Study Title")))
main_citation
ddi_codeBook(ddi_stdyDscr(main_citation)) %>%
as_xml_string() %>%
cat()
#> <?xml version="1.0" encoding="UTF-8"?>
#> <codeBook xmlns="ddi:codebook:2_5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://www.ddialliance.org/Specification/DDI-Codebook/2.5/XMLSchema/codebook.xsd">
#> <stdyDscr>
#> <citation>
#> <titlStmt>
#> <titl>Study Title</titl>
#> </titlStmt>
#> </citation>
#> </stdyDscr>
#> </codeBook>
Assert expected or required elements:
tryCatch(
ddi_codeBook(),
error = function(e) {
print(e$message)
}
)#> No children specified when some are required: [stdyDscr]
tryCatch(
ddi_citation(ddi_titlStmt(ddi_titl("Oops")), ddi_dataDscr()),
error = function(e) {
print(e$message)
}
)#> 'dataDscr' is not an acceptable child element for citation.
#> These are the allowed children: [titlStmt, rspStmt, prodStmt, distStmt, serStmt, verStmt, biblCit, holdings, notes]
Validate your work against the DDI Codebook 2.5 schema:
ddi_codeBook(ddi_stdyDscr(main_citation)) %>%
validate_codebook()
#> [1] TRUE
#> attr(,"errors")
#> character(0)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.