knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(readr) library(fertile)
make
is hard and maybe unnecessarygoodpractice
/R CMD check
for data analysis projects"I'm fiddling with pineapple coconut cake recipes,... but I want someone else to be able to follow my steps."
Logs your actions
log_clear() library(fs) read_csv("data.csv") read_csv("../tests/testthat/data/data.csv") log_report()
Checks paths
readr::read_csv("../fertile/tests/testthat/data/data.csv") fertile::read_csv("../fertile/tests/testthat/data/data.csv") read_csv(tempfile()) write_csv(data.frame(a = 1), file = tempfile()) write_csv(data.frame(a = 1), file = "temp_data.csv") log_report()
Prevents you from doing bad things
setwd("vignettes")
Works by shimming many I/O functions
?shims
"I've baked a pineapple cococnut cake. What was my recipe?"
unzip(system.file("extdata/project_noob.zip", package = "fertile"), exdir = "../tests/testthat")
project_noob <- here::here("tests", "testthat", "project_noob") fs::dir_info(project_noob)
Test it
proj_test(project_noob)
unzip(system.file("extdata/project_miceps.zip", package = "fertile"), exdir = "../tests/testthat")
project_miceps <- here::here("tests", "testthat", "project_miceps") fs::dir_info(project_miceps)
x <- proj_analyze(project_miceps) x
proj_suggest_moves(x$suggestions) proj_move_files(x$suggestions) fs::dir_info(project_miceps)
fs::dir_delete(project_noob) fs::dir_delete(project_miceps)
R CMD check
style checklist of potential problemsmake
-inspired build chainAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.