createDataPackage | R Documentation |
Upload all members of a DataPackage to DataONE.
createDataPackage(x, dataPackage, ...) ## S4 method for signature 'D1Client,DataPackage' createDataPackage(x, dataPackage, ...)
x |
A D1Client instance. |
dataPackage |
The DataPackage instance to be submitted to DataONE for creation. |
... |
Additional arguments |
The identifier of the uploaded package.
D1Client
class description.
## Not run: library(dataone) testdf <- data.frame(x=1:10,y=11:20) csvfile <- tempfile(pattern = "file", tmpdir = tempdir(), fileext = ".csv") write.csv(testdf, csvfile, row.names=FALSE) d1c <- D1Client("STAGING", "urn:node:mnStageUCSB2") dp <- new("DataPackage") emlFile <- system.file("extdata/strix-pacific-northwest.xml", package="dataone") emlChar <- readLines(emlFile) emlRaw <- charToRaw(paste(emlChar, collapse="\n")) emlId <- sprintf("urn:uuid:%s", UUIDgenerate()) metadataObj <- new("D1Object", id=emlId, format="eml://ecoinformatics.org/eml-2.1.1", data=emlRaw, mnNodeId=getMNodeId(d1c)) sdf <- read.csv(csvfile) stf <- charToRaw(convert.csv(d1c, sdf)) sciId <- sprintf("urn:uuid:%s", UUIDgenerate()) sciObj <- new("D1Object", id=sciId, format="text/csv", data=stf, mnNodeId=getMNodeId(d1c)) dp <- addMember(dp, do=sciObj, mo=metadataObj) expect_true(is.element(sciObj@dataObject@sysmeta@identifier, getIdentifiers(dp))) resourceMapId <- createDataPackage(d1c, dp, replicate=TRUE, public=TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.