library(knitr)
library(datadict)
opts_chunk$set(comment = "#>", error = FALSE, tidy = FALSE)
opts_chunk$set(fig.width = 3.5, fig.height = 2.5, dpi = 100)
library(dplyr) 
csv <- 
'"name_col", "units", "name_long", "description"
"Sepal.Length", "cm", "sepal length", "length of the sepal"
"Sepal.Width", "cm", "sepal width", "width of the sepal"
"Petal.Length", "cm", "petal length", "length of the petal"
"Petal.Width", "cm", "petal width", "width of the petal"
"Species", "", "species", "species of the flower"'

iris_dict_csv <- 
  csv %>% textConnection() %>% 
    read.csv(stringsAsFactors = FALSE, strip.white = TRUE) %>% 
  make_entries_dict(iris)

iris_dict_data <- make_entries_data(iris)

iris_dict <- left_join(iris_dict_data, iris_dict_csv, by = "name_col")


ijlyttle/datadict documentation built on May 18, 2019, 3:41 a.m.