Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.
/ drake-example Public archive

A home for developing a demo or lesson for using the drake package for R workflows

License

Notifications You must be signed in to change notification settings

bcgov/drake-example

Repository files navigation

img License

drake-example

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.

Install dependencies

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:

File Structures

.
+-- 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

Data

Fake data are created and stored in the data-raw directory. Here we are using the starwars data from the dplyr package.

Workflows

  • 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 the DESCRIPTION files are the main control files for the project. The most important element of this script is the drake::make() or drake::r_make functions. This file also sources all other required files.

Inspiration

This example draws from the following amazing resources:

Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an issue.

How to Contribute

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.

License

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.

About

A home for developing a demo or lesson for using the drake package for R workflows

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages