createDataPackage: Create a DataPackage on a DataONE Member Node

createDataPackageR Documentation

Create a DataPackage on a DataONE Member Node

Description

Upload all members of a DataPackage to DataONE.

Usage

createDataPackage(x, dataPackage, ...)

## S4 method for signature 'D1Client,DataPackage'
createDataPackage(x, dataPackage, ...)

Arguments

x

A D1Client instance.

dataPackage

The DataPackage instance to be submitted to DataONE for creation.

...

Additional arguments

Value

The identifier of the uploaded package.

See Also

D1Client class description.

Examples

## 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)

dataone documentation built on June 11, 2022, 1:06 a.m.