Get package and EML

Before we look more in depth at EML, we first need to load your data package into R. After setting your node, use the following commands to load the package:

rm_pid <- "your_resource_map_pid"

pkg <- get_package(adc_test,
                   rm_pid,
                   file_names = TRUE)

Keeping track of PIDs

In all subsequent sections, if they ask for the pid of the metadata, reasource map or data you can refer to the object from get_package().

For example, if you assigned the value from get_package() as above as pkg then you can refer to the following by using the corresponding commands:

metadata_pid <-  pkg$metadata
data_pid <-  pkg$data
resource_pid <-  pkg$resource_map

After loading the package, you can also load the EML file into R using the following command:

doc <- read_eml(getObject(adc_test, pkg$metadata))

Note that we named the object doc. This is a good generic name to use for EML documents. The generic name eml should not be used - as the EML package ships with an eml function, which can cause namespace issues in your environment if you have an object also called eml.

Tip to always have the most recent resource map.

When editing data packages, you always want to be working with the most recent update. To ensure you have the most recent resource map, you can use the following commands:

rm_pid_original <- "your_original_resource_map_pid"
all_rm_versions <- get_all_versions(adc_test, rm_pid_original)
rm_pid <- all_rm_versions[length(all_rm_versions)]
print(rm_pid)