Skip to content

Commit

Permalink
Read exercise instructions from other repo
Browse files Browse the repository at this point in the history
The README.md instruction files are read-in with httr and then rendered. This ensures both will always be consistent.
  • Loading branch information
NeuroShepherd committed Jul 23, 2024
1 parent 4809e7a commit d06e47d
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 312 deletions.
35 changes: 35 additions & 0 deletions ex_2.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,38 @@ title: "Using `restore()`"

- restoring a project
- **Go to the Exercise 2 Folder**


``` r
renv::dependencies()
#> Finding R package dependencies ... Done!
#> Source
#> 1 /Users/<USER>/Documents/Coding/Open Science Center/introduction-to-renv-exercises/restore-exercises/billboard_100.R
#> 2 /Users/<USER>/Documents/Coding/Open Science Center/introduction-to-renv-exercises/restore-exercises/billboard_100.R
#> 3 /Users/<USER>/Documents/Coding/Open Science Center/introduction-to-renv-exercises/restore-exercises/presentation.qmd
#> 4 /Users/<USER>/Documents/Coding/Open Science Center/introduction-to-renv-exercises/restore-exercises/presentation.qmd
#> 5 /Users/<USER>/Documents/Coding/Open Science Center/introduction-to-renv-exercises/restore-exercises/presentation.qmd
#> 6 /Users/<USER>/Documents/Coding/Open Science Center/introduction-to-renv-exercises/restore-exercises/renv.lock
#> Package Require Version Dev
#> 1 dplyr FALSE
#> 2 tidyr FALSE
#> 3 dplyr FALSE
#> 4 ggplot2 FALSE
#> 5 rmarkdown FALSE
#> 6 renv FALSE
```


> Warning message:
The 'yaml' package is required to parse dependencies within Quarto Markdown files
Consider installing it with `install.packages("yaml")`.

```{r, results='asis', echo=FALSE}
# To make changes to the instructions, go to the init-snapshot-exercises-instructions.md file in the intro-to-renv-exercises repository!
library(httr)
url="https://raw.githubusercontent.com/lmu-osc/introduction-to-renv-exercises/main/restore-exercises/README.md"
response=GET(url)
cat(content(response))
```
24 changes: 24 additions & 0 deletions ex_init_snapshot.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,39 @@
title: "Initialize and Snapshot"
---

```{r}
library(magrittr)
```

The following examples will guide you through the process of initializing a project with {renv} and then snapshotting the project to capture the packages used in the project. It is **recommended** that you fork the repository to your GitHub account and clone it to your local machine to follow along with the examples. This will allow the course facilitators to see your work, provide feedback, and troubleshoot with you as needed.

However, this is not strictly necessary. You can also follow along by creating a new project on your local machine and initializing {renv} in that project. If you choose to do this, you can skip the forking and cloning steps and instead download a zip file of the repository.


# Getting Started


- fork the intro-to-renv-examples repo
- **Go to the Exercise 1 folder**
- init renv
- commit repo changes


```{r, results='asis', echo=FALSE}
# To make changes to the instructions, go to the init-snapshot-exercises-instructions.md file in the intro-to-renv-exercises repository!
library(httr)
url="https://raw.githubusercontent.com/lmu-osc/introduction-to-renv-exercises/main/init-snapshot-exercises/README.md"
response=GET(url)
cat(content(response))
```



# Snapshotting


- We want to observe the process in action
- Run `dependencies()`
- Create a new .R file
Expand Down
Loading

0 comments on commit d06e47d

Please sign in to comment.