knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of metadatar is to help produce minimum metadata files to document datasets in simple formats that can form building blocks of more complex metadata formats (eg. EML, rdf).
You can install the developent version of metadatar from GitHub with:
#install.packages("devtools") devtools::install_github("annakrystalli/metadatar")
This is a basic example which shows you how to create a metadata table for the gapminder dataset
library(gapminder) library(metadatar) str(gapminder)
meta_shell <- mt_create_meta_shell(gapminder) knitr::kable(meta_shell)
I've focused on recognized column headers to make it easier to create an EML object down the line and on the core columns required but additional ones can be added.
"numeric"
, "character"
, "factor"
, "ordered"
,
or "Date"
, case sensitive)columnClasses
dependant attributesnumeric
(ratio or interval) data:character
(textDomain) data: For dateTime
data:
11-03-2001
formatString would be "DD-MM-YYYY"
I use the columns code
and levels
to store information on factors. I use ";"
to separate code and level descriptions. These can be extracted by metadatar
function mt_extract_attr_factors()
later on.
meta_df <- readr::read_csv(system.file("extdata", "gapminder_meta.csv", package="metadatar"))
knitr::kable(meta_df)
mt_extract_factors_tbl(meta_df)
Create more descriptive variable labels for plot axes/titles or tables
mt_label(meta_df, var = "gdpPercap")
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.