This repo is dormant and will not developed further. With the advent of targets, drake has largely been superceded. Similar examples of targets can be found here: https://docs.ropensci.org/targets/#example-projects.
remotes::install_deps(dependencies = TRUE, build = FALSE)
The goal of drake-example is to provide a template repo for using the drake package for R workflows. The repo is also tries to utilize R compendiums to manage dependencies and enables the suite package management tools. Here is the current directory of files for this type of project:
.
+-- code
| +-- 01-data
| | +-- data.R
| | \-- merging.R
| +-- 02-cleaning
| | \-- remove_na.R
| +-- 03-model
| | \-- model.R
| +-- generate_data.R
| \-- setup.R
+-- CODE_OF_CONDUCT.md
+-- COMPLIANCE.yaml
+-- CONTRIBUTING.md
+-- data-raw
| +-- birth-year.csv
| +-- names.csv
| +-- other-traits.csv
| +-- physical-traits.csv
| \-- place-characteristics.csv
+-- DESCRIPTION
+-- drake-example.Rproj
+-- exec_drake.R
+-- LICENSE
+-- NAMESPACE
+-- out
| \-- report.html
+-- R
| \-- functions.R
+-- README.md
+-- README.Rmd
+-- report.Rmd
\-- _drake.R
Fake data are created and stored in the data-raw
directory. Here we
are using the starwars
data from the dplyr
package.
- Store re-useable functions in the
R/
directories.devtools::load_all()
makes them available during your R session like a package. - Write analysis code in the
code/
directory as normal R code. - Use
drake::code_to_plan()
to bring those R scripts into your drake plan as targets. The plan and the targets are stored in_drake.R
. For many of its processes,drake
will automatically look for that_drake.R
file. - The
exec_drake.R
and theDESCRIPTION
files are the main control files for the project. The most important element of this script is thedrake::make()
ordrake::r_make
functions. This file also sources all other required files.
This example draws from the following amazing resources:
- https://books.ropensci.org/drake/
- https://github.com/pat-s/pathogen-modeling
- https://github.com/benmarwick/rrtools
- https://supervised-ml-course.netlify.com/
To report bugs/issues/feature requests, please file an issue.
If you would like to contribute to the package, please see our CONTRIBUTING guidelines.
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.
Copyright 2019 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This project was created using the bcgovr package.