This preparation guide consists of three sections:
The instructions guide you through the installation and testing of several software packages, and registration on GitHub. In case some of the software is already installed on your system, you can skip those related steps. Additionally, we have an exercise which tests if your installation and setup was completed successfully. This allows us to identify potential errors/issues and resolve them before the workshop, so things go more smoothly during the workshop itself.
If you run into any issues, please don’t hesitate to ask for help during our drop-in call for Installation & Set-Up Support or by emailing Neha Moopen (n.moopen@uu.nl). Try not to leave them until the morning of the workshop!
Source: vignettes/setup.Rmd
This is a tutorial from the WORCS package website on how to set up your personal computer for use with the worcs
package. It guides you through the installation of several software packages, and registration on GitHub. This vignette does not assume a prior installation of R
, so it is suitable for novice users.
You only have to perform these steps once for every computer you intend to use R
and worcs
on, and the entire process should take approximately 30 minutes if you start from scratch.
In case some of the software is already installed on your system, you can skip those related steps.
Follow these steps in order:
Install R from https://CRAN.R-project.org
Install ‘RStudio’ Desktop (Free) from rstudio.com
install.packages("package name")
install.packages("worcs", dependencies = TRUE)
tinytex::install_tinytex()
renv::consent(provided = TRUE)
If you do not have a Git user set up on your computer yet (e.g., if this is the first time you will be using Git), run the following - making sure to substitute your actual username and email:
worcs::git_user("your_name", "your_email", overwrite = TRUE)
If you intend to write documents in APA style, you should additionally install the papaja
package.
Unfortunately, this package is not yet available on the central R repository CRAN, but you can install it from ‘GitHub’ using the following code:
remotes::install_github("crsh/papaja", dependencies = TRUE, update = "never")
Because papaja
has many dependencies, it is recommended to skip this step if you intend to write documents in a different style than APA.
That’s it! Everything should be installed and connected now.
With this exercise we want to verify if your set-up was successful and the connection between RStudio & Git/GitHub is working smoothly.
Create a new GitHub repository
test
repo to test my RStudio & Git/GitHub connection
Copy the repository SSH URL
git@github.com:<USERNAME>/test.git
Create a new RStudio Project with Git version control
git@github.com:<USERNAME>/test.git
test
The GitHub repository will be copied (or cloned in Git terms) into the specified project folder on your computer. You should immediately find yourself in a new local RStudio Project that represents your test repo on GitHub.
The content of the GitHub repository should now appear in the “Files” pane of RStudio and you should see the README.md file. Moreover, now that you have enabled git versioning for your Project, a “Git” tab should have been added to your interface next to “Environment” and “History” tabs.
Push to GitHub
This is an edit from RStudio
. Don’t forget to save the file.This is an edit from RStudio
line in the README.md file and the commit message your provided will be noted in the history of the file.Pull from GitHub
This is an edit from GitHub
and commit (save) the change. Once again, use a simple, but meaningful commit message such as edited README.md in GitHubThis is an edit from GitHub
line in the README.md file.If you made it this far, congratulations! You’re all set up to use RStudio and Git/GitHub and you even practiced the standard workflow of making commits + pushing + pulling.
If you run into errors or issues, please use the drop-in call for Installation & Set-Up Support. You should have received the MS Teams link to this in the Welcome email for the course. You can also email one of the course instructors: Neha Moopen (n.moopen@uu.nl).
Since this course is still in it’s pilot phase, we don’t an extensive have troubleshooting guide yet. We will be updating this section as we hear from partcipants about their issues. Just follow the steps and don’t worry if you don’t fully understand some of the technical language, this troubleshooting guide is also for instructors to refer to.
This usually means that RStudio doesn’t know the exact location of your remote repository (e.g. on GitHub). More specifically, it may not yet know which branch to track within the remote repository (e.g. origin).
To fix this, try the following:
Open a terminal to the working directory of your project
The “Terminal” tab is next to the “Console” tab in RStudio. Click on the “Terminal” tab and a new terminal session will be created (if there isn’t one already). If the tab isn’t visible, show it via Shift+Alt+T or using the menu: Tools -> Terminal -> Move Focus To Terminal
In the terminal, type cd <PATH\TO\THE\WORKING\DIRECTORY\OF\YOUR\PROJECT>
. The cd
command stands for ‘change directory’.
Check if the git remote was set up alright
In the terminal, type git remote -v
You should get something like:
origin git@github.com:<USERNAME>/test.git (fetch)
origin git@github.com:<USERNAME>/test.git (push)
In the unlikely case that there is no remot set up, then copy the SSH URL for your repository again and type:
git remote add origin git@github.com:<USERNAME>/test.git
Tell RStudio to track the main branch of your remote repository
In the terminal, type git push --set-upstream origin main
This above is equivalent to git push -u origin main
but conveys more information about what is intended. Essentially, we’re ensuring the local main
branch is set to track the main
branch on GitHub.
Restart RStudio and try Pushing and/or Pulling again.