x: The MNode instance on which the object will be created
...: (Not yet used.)
pid: The identifier of the object to be created
file: the absolute file location of the object to be uploaded
sysmeta: a SystemMetadata instance describing properties of the object
dataobj: a raw object to use for the upload, instead of the contents of the file argument.
Returns
a character containing the identifier that was created.
Details
In the version 2.0 library and higher, this operation can utilize an 'dataone_token' option to provide credentials for write operations in DataONE. The authentication token is obtained from DataONE (see your profile on https://search.dataone.org). See the vignette("dataone-overview") for details. Alternatively, the version 1.0 approach of using an X.509 certificate in a default location of the file system can also be used. This certificate provides authentication credentials from CILogon https://cilogon.org/?skin=DataONE. See vignette("dataone-overview") for details.
Examples
## Not run:# Create an object in the DataONE "STAGING" environmentlibrary(dataone)library(uuid)library(digest)library(datapack)cn <- CNode("STAGING")mn <- getMNode(cn,"urn:node:mnStageUCSB2")# Have Dataone create an identifier for you (requires authentication)\dontrun{newid <- generateIdentifier(mn,"UUID")}# Create an identifier manuallynewid <- paste("urn:uuid:", UUIDgenerate(), sep="")testdf <- data.frame(x=1:10,y=11:20)csvfile <- paste(tempfile(),".csv", sep="")write.csv(testdf, csvfile, row.names=FALSE)format <-"text/csv"size <- file.info(csvfile)$size
sha256 <- digest(csvfile, algo="sha256", serialize=FALSE, file=TRUE)sysmeta <- new("SystemMetadata", identifier=newid, formatId=format, size=size, checksum=sha256)sysmeta <- addAccessRule(sysmeta,"public","read")# Upload the data to DataONE (requires authentication)\dontrun{createObject(mn, newid, csvfile, sysmeta)}## End(Not run)