mirror of
https://github.com/kidwellj/hacking_religion_textbook.git
synced 2024-11-01 01:12:20 +00:00
27 lines
894 B
Plaintext
27 lines
894 B
Plaintext
# Appendix A: how to set up a working environment and layout a reproducible R script:
|
|
|
|
Add `renv` and explanation of `here`
|
|
|
|
```
|
|
# R Setup -----------------------------------------------------------------
|
|
setwd("/Users/kidwellj/gits/hacking_religion_textbook/hacking_religion")
|
|
library(here) # much better way to manage working paths in R across multiple instances
|
|
here::i_am("chapter_1.qmd")
|
|
|
|
# Set up local workspace, as needed: --------------------------------------
|
|
|
|
# Set up paths in case they haven't already been created
|
|
|
|
if (dir.exists(here("data")) == FALSE) {
|
|
dir.create(here("data"))
|
|
}
|
|
|
|
# Note, these two paths are excluded from github as it is best practice in reproducible research for end-user to generate their own
|
|
|
|
if (dir.exists(here("figures")) == FALSE) {
|
|
dir.create(here("figures"))
|
|
}
|
|
|
|
if (dir.exists(here("derivedData")) == FALSE) {
|
|
dir.create(here("derivedData"))
|
|
} |