-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
6 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
_freeze/posts/2022-12-01-targets-proj-workflows/index/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"hash": "71977170a32607ab4bbc95716c0fcd20", | ||
"result": { | ||
"markdown": "---\ntitle: \"Reproducibile Workflows with `targets`\"\nauthor: \n - name: Boyi Guo\n url: https://boyiguo1.github.io\n affiliation: Department of Biostatistics, Johns Hopkins\n affiliation_url: https://publichealth.jhu.edu\ndescription: \"A Make-line pipeline tool for creating reproducible workflows in R\"\ndate: 2022-12-01\ndraft: true\ncategories: [module 3, week 6, project management, targets]\nexecute:\n eval: false\n---\n\n\n\n\n<!-- Add interesting quote -->\n\n# Pre-lecture materials\n\n### Read ahead\n\n::: callout-note\n## Read ahead\n\n**Before class, you can prepare by reading the following materials:**\n\n1. <https://books.ropensci.org/targets/>\n2. <https://books.ropensci.org/targets/walkthrough.html>\n3. <https://boyiguo1.github.io/talks/2020-07-16-Reproducible-Analysis-Workflow.pdf>\n:::\n\n### Prerequisites\nBefore starting you must install the additional package:\n\n* `targets` - the R Workflows package\n* `usethis` - an automation package that simplifies project creation and setup\n* `renv` - a package manager in R\n\nYou can do this by calling\n\n\n::: {.cell}\n\n```{.r .cell-code}\ninstall.packages(\"usethis\")\ninstall.packages(\"targets\")\ninstall.packages(\"renv\")\n```\n:::\n\n\nor use the “Install Packages…” option from the “Tools” menu in RStudio.\n\n### Acknowledgements\n\nMaterial for this lecture was borrowed and adopted from\n\n- https://books.ropensci.org/targets/walkthrough.html\n\n# Learning objectives\n\n::: callout-note\n# Learning objectives\n\n**At the end of this lesson you will:**\n\n- setup up `targets` analytic pipeline\n- write and run a data analysis with `targets`\n- replicate and retrieve analysis results from a `targets` workflow\n:::\n\n# What is `targets`?\n\n\n# Why do we use `targets`?\n\n\n# How to use `targets`\n\n## Set up a `targets` workflow\n\n::: {.cell}\n\n```{.r .cell-code}\n# Start a new R project\nusethis::create_project(\"targets_eg\")\n# Config target workflow\ntargets::use_targets()\n```\n:::\n\n\n### (Optional) Version control packages with `renv`\n\n::: {.cell}\n\n```{.r .cell-code}\n# Config renv system\nrenv::init()\ntargets::tar_renv()\n```\n:::\n\n\nIf other people opens up this project on a different computer, `renv` will automatically install all the necessary packages, i.e. the same version.\n\n::: callout-tip\n### Important `renv` functions\nYou need to keep track of your R packages in this analysis, similar to you version control your files using `git`. You may need to call the following functions periodically, i.e. after you add/remove necessary packages.\n* `targets::tar_renv()` updates `_targets_packages.R` by gathering all packages in your analytic workflow \n* `renv::status()` shows which packages are outdated or not recorded\n* `renv::snapshot()` updates your packages version number\n* `renv::restore()` restores all missing packages or packages whose version number doesn't match with the most updated snapshot.\n\nFor more information, visit <https://rstudio.github.io/renv/articles/renv.html>\n:::\n\n## Understand the file system\n\n\n\n\n\n# Post-lecture materials\n\n### Final Questions\n\nHere are some post-lecture questions to help you think about the material discussed.\n\n::: callout-note\n### Questions\n\n1. Add here.\n:::\n\n### Additional Resources\n\n::: callout-tip\n- `targets` website <https://docs.ropensci.org/targets/>\n- The `targetopic`, a `targets` ecosystem <https://wlandau.github.io/targetopia/packages.html>\n- A tutorial & reproducible example on calculating residential segregation indices with decennial US census data <https://github.com/boyiguo1/Tutorial-Residential_Segregation_Score>\n:::\n", | ||
"supporting": [], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
], | ||
"includes": {}, | ||
"engineDependencies": {}, | ||
"preserve": {}, | ||
"postProcess": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters