vignettes/dataset-single.Rmd
dataset-single.Rmd
This vignette aims to showcase a use case using the 2 main functions of metajam
- download_d1_data
and read_d1_files
to download one dataset from the Arctic Data Center data repository.
As example, we are using permafrost data from the Polaris Project 2017: Sarah Ludwig, Robert M Holmes, Susan Natali, Paul Mann, John Schade, et al. 2018. Polaris Project 2017: Permafrost carbon and nitrogen, Yukon-Kuskokwim Delta, Alaska. Arctic Data Center. doi:10.18739/A2KK3F.
# Directory to save the data set
path_folder <- "Data_polaris"
# URL to download the dataset from DataONE
data_url <- "https://arcticdata.io/metacat/d1/mn/v2/object/urn%3Auuid%3Aec704da8-f174-49db-b993-bae479cdc5d9"
# Create the local directory to download the datasets
dir.create(path_folder, showWarnings = FALSE)
# Download the dataset and associated metdata
data_folder <- metajam::download_d1_data(data_url, path_folder)
# data_folder
# "Data_polaris/doi_10.18739_A2KK3F__Polaris_2017_Permafrost"
At this point, you should have the data and the metadata downloaded inside your main directory; Data_polaris
in this example. metajam
organize the files as follow:
my_data.csv
__full_metadata.xml
: my_data__full_metadata.xml
__summary_metadata.csv
: my_data__summary_metadata.csv
__attribute_metadata.csv
: my_data__attribute_metadata.csv
__attribute_factor_metadata.csv
: my_data__attribute_factor_metadata.csv
# Read all the datasets and their associated metadata in as a named list
polaris17_permafrost <- metajam::read_d1_files(data_folder)
You have now loaded in your R environment one named list object that contains the data polaris17_permafrost$data
, the general (summary) metadata polaris17_permafrost$summary_metadata
- such as title, creators, dates, locations - and the attribute level metadata information polaris17_permafrost$attribute_metadata
, allowing user to get more information, such as units and definitions of your attributes.