copy_package: Copy packages between DataONE Member Nodes with new...

View source: R/clone_package.R

copy_packageR Documentation

Copy packages between DataONE Member Nodes with new identifiers

Description

This function is a convenience wrapper around clone_package() that copies a package rather than cloning it. The distinction is that new PIDs will always be generated, and the system metadata will reflect a stand-alone package rather than a clone. This function copies a data package from one DataONE Member Node to another, with new identifiers This can also be used to restore an older version of a package to a Member Node, provided that the user subsequently obsoletes the version of the package that they used to create the copy using obsolete_package().

Usage

copy_package(
  resource_map_pid,
  from,
  to,
  public = FALSE,
  clone_children = FALSE
)

Arguments

resource_map_pid

(character) Object pid

from

(D1Client) D1Client to clone package from. (Token must be set for this node)

to

(D1Client) D1Client to clone package to. (Token must be set for this node)

public

(logical) Optional. Will set public read access. Defaults to FALSE.

clone_children

(logical) Optional. Will clone all children recursively if TRUE. Defaults to FALSE.

Author(s)

Dominic Mullen, dmullen17@gmail.com

See Also

clone_package() obsolete_package()

Examples

## Not run: 
# First set up the member nodes we're copying between
# (in this example they are the same but could be different)
to <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")
from <- dataone::D1Client("STAGING", "urn:node:mnTestARCTIC")

# Choose a package to copy (here a new one is created)
package <- arcticdatautils::create_dummy_package(to@mn)

copied_package <- clone_package(resource_map_pid = package$resource_map,
                                from = from,
                                to = to)

## End(Not run)

NCEAS/datamgmt documentation built on June 5, 2023, 6:14 a.m.