Add children to an existing parent

A new package is published with a DOI and needs to be nested underneath a pre-existing parent. Nest the new child using the child_pids argument in publish_update().

resource_map_child_new <- "some_child_resource_map_pid"
pkg_parent <- get_package(mn, 'resource_map_parent')

publish_update(mn,
               resource_map_pid = pkg_parent$resource_map,
               metadata_pid = pkg_parent$metadata,
               data_pids = pkg_parent$data_pids,  # parents usually don't contain data, but better to be safe
               child_pids = c(pkg_parent$child_packages, 
                              resource_map_child_new))
# include the resource map PIDs of ALL the childs* in the `child_pids` argument, otherwise the nesting relationships between any omitted childs and the parent will be deleted

Check through all arguments carefully before you publish to production! Do you need to update the metadata? Does the parent include data objects? Does the parent have a parent?

Parents can be tricky to fix and work with (especially if they have serial identifiers (SIDs)), so if you’re not sure how something works, try it on a test node.