::ji("banana") emo
2.4 {renv}
Open the slides in a new tab here.
Exercises
Install
{renv}
, then initialize in your in-class R project withrenv::init()
Find and open the
renv.lock
file to look at the packages that are included.Install a new R package of your choice. (Not sure what to choose? Try one of these fun packages. For example, I did
install.packages("hadley/emo")
.)Create an R script and save it in your R project. Include some code that requires the package. For example:
Run
renv::status()
to make sure your project picked up the package as a dependency.Run
renv::snapshot()
to record that package in your lockfile.Open your lockfile and look for your new package. For example, mine now has:
"emo": {
"Package": "emo",
"Version": "0.0.0.9000",
"Source": "git",
"RemoteType": "git",
"RemoteUrl": "https://github.com/hadley/emo",
"RemoteHost": "api.github.com",
"RemoteUsername": "hadley",
"RemoteRepo": "emo",
"RemoteRef": "master",
"RemoteSha": "3f03b11491ce3d6fc5601e210927eff73bf8e350",
"Requirements": [
"R",
"assertthat",
"crayon",
"glue",
"lubridate",
"magrittr",
"purrr",
"rlang",
"stringr",
"utils"
],
"Hash": "eb32b8f0bb50621ad498f5d836b546a4"
},
- Commit and push. Now anyone can recreate the state of your packages at this moment!