This repository holds all relevant documents for CGT (control and gambling task) study for Anna Rini's thesis and the extension to run pupillometry run by Anna Rini and Von Monteza.
This study was programmed using PsychoPy (Builder) and hosted on Pavlovia (here is the link to the Gitlab repository). More information on the task itself can be found here: [LINK!]
This is a template repository for using R with a team. Use this template to leverage a shared set of configurations optimized for teams developing projects in R.
The R project you create with this template will be equipped with several helpful features:
- An RStudio project
template.Rproj
with smart defaults - Package dependency management using
renv
- Environment-specific configuration using
config
- A comprehensive
.gitignore
file to keep version tracking history clean - An RMarkdown notebook
notebook-template.Rmd
with quick code chunk examples - Generated document settings in
_output.yaml
for rendering RMarkdown notebooks withknitr
- A dedicated
R
folder for pure R scripts and reusable functions - GitHub Issues templates for filing bug reports, documentation updates, and feature requests
Please make sure that you have recent versions of R and RStudio installed.
This template is compatible with Git and GitHub by default. We suggest using GitHub Desktop to develop your project from this template. Please follow these installation instructions if you have not already installed and configured your local GitHub Desktop application.
If you would like to use the GitHub CLI, or the standard command line tools that come with your computer's Git installation, that's perfectly fine! However, this README will not discuss those methods of interaction in detail.
To take advantage of the optimized configuration settings included with this template, you must have the renv
package installed on your local computer. While in an active RStudio session, simply run the following line of code in the Console.
install.packages('renv')
To use this template, click the green Use this template button or you can click here to generate your project. It will ask you to
- Choose the repository's username/organization name, i.e.,
yourlab
. - Name the repository, i.e.,
our-new-r-project
. - Add a description of your project (optional, but highly recommended).
Once the repository is generated, you will be redirected to your new repository on GitHub.
Go to the green Code button with a dropdown menu. There are two preferred methods, and we recommend using whichever you prefer:
Click Open with GitHub Desktop, and pick a location in your personal file system to store it using the GitHub Desktop cloning interface. If using Linux, see option 2.
If using Linux or prefer the command line, you will use the HTTPS-based URL from the Code dropdown menu. The URL will look like https://github.com/startyourlab/r-project-template.git
. Click the clipboard icon to copy it. From within your projects directory in the terminal, run git clone ...
, replacing the "..." with the URL you just copied.
Once the project is cloned to your computer, you need to rename the following files with your own names:
template.Rproj
, changingtemplate
to your repository namenotebook-template.Rmd
, changingnotebook-template
to the notebook name that you would like for the project's first notebook.LICENSE.md
, replacingStart Your Lab
with your name or lab's name.
After renaming the above files, run the following line of code in your RStudio's Console:
renv::restore()
This will install all of the foundational packages needed to begin developing your R project with this template. If installation encounters an error, restart your R session and try again. If it still does not work, please reach out to the Start Your Lab team with your issue and we can help you and your lab resolve it.
If you would like to install packages specific to your project's goals, now is the time to start! You can install packages like tidyverse
, slackr
, or other packages on CRAN. For example, running
install.packages('tidyverse')
will install tidyverse
for your project. If you want to make this a package that the entire team uses for this project, run
renv::snapshot()
to record the package with its version number in the renv.lock
file, which keeps track of all the great packages you and your team use together.
Once files are renamed and packages are installed, it's time to commit these changes to GitHub. Using the GitHub Desktop application, review the files you changed. Make sure that you renamed and updated the appropriate files above. Then, add a summary commit message, such as "update file names and configure project", and Commit to main
. Finally, click Push origin, which will push your committed changes to the project's centralized copy of repository on GitHub. Your collaborators will now be able to pull these changes from GitHub into their local version of this repository.
Now that everything is squared away, it's time to start work on your project. Open the renamed .Rproj
file in RStudio, and start your project's development!
For questions about this template, please contact Start Your Lab. You can also reach us on Twitter and Stack Overflow using the following buttons: