#' Get Contacts
#'
#' Generates a table of contacts for individuals and organizations associated
#' with a set of metadata records. Primarily used within other functions.
#'
#' @param data Any number of mdJSON metadata records that have been flattened
#' into a tidy tibble
#'
#' @return A tibble containing all contacts found within the metadata records,
#' including their contactIds, names, and email addresses.
#' @export
get_contacts <- function(data) {
# Unnest data in the "Contacts" field and make it its own table.
# "Contacts" is a top-level mdJSON property that holds all contacts in each
# mdJSON record.
data %>%
tidyr::unnest("contact") %>%
tidyr::unnest("contact") %>%
dplyr::select("contactId",
"name",
"electronicMailAddress") %>%
# Get rid of duplicate entries
dplyr::distinct()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.