Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move relative paths + focus on compatibility #145

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions episodes/read-cases.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,12 @@ Similarly, you can import files of other formats such as `tsv`, `xlsx`, ... etc.

### Why should we use the {here} package?

The `{here}` package is designed to simplify file referencing in R projects by providing a reliable way to construct file paths relative to the project root. Here are the three key reasons to use it:
The `{here}` package is designed to simplify file referencing in R projects by providing a reliable way to construct file paths relative to the project root. The main reason to use it is **Cross-Environment Compatibility**.

- **Relative Paths**: Allows you to use relative file paths with respect to the `R` Project, making your code more portable and less error-prone.
It works across different operating systems (Windows, Mac, Linux) without needing to adjust file paths.

- **Cross-Environment Compatibility**: Works across different operating systems (Windows, Mac, Linux) without needing to adjust file paths. This notation `here::here("data", "ebola_cases_2.csv")` avoids using `"data\ebola_cases_2.csv"` in some and `"data/ebola_cases_2.csv"` in others!

- **Reduces Errors**: Avoids the need to use `setwd()` or absolute paths, reducing errors in scripts shared across machines. This avoids notations like `"C:/Users/mycomputer/Documents/projects/helloworld"`.
- On Windows, paths are written using backslashes ( `\` ) as the separator between folder names: `"data\raw-data\file.csv"`
- On Unix based operating system such as macOS or Linux the forward slash ( `/` ) is used as the path separator: `"data/raw-data/file.csv"`

The `{here}` package is ideal for adding one more layer of reproducibility to your work. If you are interested in reproducibility, we invite you to [read this tutorial to increase the openess, sustainability, and reproducibility of your epidemic analysis with R](https://epiverse-trace.github.io/research-compendium/)

Expand Down
11 changes: 8 additions & 3 deletions learners/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
+ **Challenges**: complete challenges to test your understanding.
+ **Explainers**: add to your understanding of mathematical and modelling concepts with the explainer boxes.

Also check out the [glossary](../reference.md) for any terms you may be unfamiliar with.

Check warning on line 40 in learners/setup.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[missing file]: [glossary](../reference.md)

### Epiverse-TRACE R packages

Our strategy is to gradually incorporate specialised **R packages** into a traditional analysis pipeline. These packages should fill the gaps in these epidemiology-specific tasks in response to outbreaks.

![I](episodes/fig/pkgs-hexlogos-2.png).

Check warning on line 46 in learners/setup.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: episodes/fig/pkgs-hexlogos-2.png

<p><figure>
<img src="episodes/fig/pkgs-hexlogos-2.png"
Expand Down Expand Up @@ -248,14 +248,19 @@
- **Create an RStudio Project**. If needed, follow this [how-to guide on "Hello RStudio Projects"](https://docs.posit.co/ide/user/ide/get-started/#hello-rstudio-projects) to create a New Project in a New Directory.
- **Create** the `data/` folder inside the RStudio project or corresponding directory. Use the `data/` folder to **save** the data sets to download.

The directory of an RStudio Project named, for example `workshop`, should look like this:
The directory of an RStudio Project named, for example `training`, should look like this:

```
workshop/
training/
|__ data/
|__ workshop.Rproj
|__ training.Rproj
```

**RStudio Projects** allows you to use _relative file_ paths with respect to the `R` Project,
making your code more portable and less error-prone.
Avoids using `setwd()` with _absolute paths_
like `"C:/Users/MyName/WeirdPath/training/data/file.csv"`.

:::::::::::::::::::::::::::::::::

### 4. Create a GitHub Account
Expand Down
Loading