All good things must come to an end, and your access to rstudio.cloud will be one of them. Here I do my best to install good hygiene in your future use of R.
You will need the renv
package. Install it with install.packages("renv")
. You may also need to the usethis
package to finish our git setup. Install it with install.packages("usethis")
.
renv
lets you manage the versions of your R packages on a per-project basis. Managing packages is one of the greatest headaches in R, and if you don’t do it right, your scripts will break and you won’t be able to reproduce your work, let alone anyone else. renv isn’t perfect, but it’s the best solution we’ve got, at the moment.
Basically, all you should need to do is always remember to click the “use renv” when you start a new project. If you are collaborating with others, you can run
::snapshot() renv
periodically to record the state of the package libraries. Then, someone else who is working on your code base can get identical versions of the packages installed with
::restore() renv
<your github id>
for the directory name. (This will be the name of your project and your github repo.)--- title: "HW04" author: "Andrew McTestStudent" date: "10/27/2021" output: github_document ---
renv
added that we shouldn’t commit.1 You can and should add other files to .gitignore that are installation-specific, as well as any files containing secrets (passwords, API keys, etc). Although this repo will be private, and protected in principle, bots use the github API to discover leaked credentials in public repositories almost instantaneously. In the git pane, you should see a .Rprofile, .Rproj, and an renv/ directory all with [?] [?] under status. These are uncommitted files, but we don’t want to commit them now or by accident later, so we’ll tell git to ignore them. In the console, type::use_git_ignore(c("renv/",
usethis".Rprofile",
"*.Rproj"))
Verify that these files no longer appear in the git pane. It should look something like this:
✅ knit and commit, but you don’t have github set up yet, so you can’t push. If you get a message about setting your git configuration user id, etc, consult the lab 01 instructions again to set up the git configuration.
::use_github(organisation = 'URMC-BST', private = TRUE) usethis
If you get errors about missing API keys, or not being about to authenicate, follow the instructions in lab 01 instructions again to set up the git configuration. Or you might just give up and follow the recipe for “existing project, github last” where you will explicitly create the repo on github.com. If you do this make sure it’s owned by the URMC-BST organization so we can see it and grade it.
set.seed(1234)
sort(rnorm(5))
sessionInfo()
Lastly, run
::snapshot() renv
to update your renv file and record the software versions you are using.
🧶 ✅ ⬆️ Knit, commit, and push your changes to GitHub with an appropriate commit message. Make sure to commit and push all changed files so that your Git pane is cleared up afterwards and review the md document on GitHub to make sure you’re happy with the final state of your work.
23 points.
18 points, apportioned across the six exercises as evenly as possible (recognizing some exercises didn’t produce output).
5 points for commit history – should have 2 commits minimum.