This repos is intended as an R template for the analysis of a research project.
- R (www.r-project.org)
- RStudio (https://www.rstudio.com/)
- Git (https://git-scm.com/)
See the video instructions below:
- Download the template as a .zip file.
- Extract to the desired location on your system.
- Rename the root directory to your project's name.
Delete the existing template-R-project.Rproj and .gitignore files. Alternatively, move the .gitignore file to another location (e.g. desktop) and copy it back after the repo has been initialized. - Open RStudio and create a New Project (existing directory) in the root folder.
- Go to Global Preferences in RStudio and set-up version control to Git
RStudio will create a local git repo for you and include a .gitginore.
- Fork this repository to your remote Git and rename it to .
- Open RStudio and create a New Project (from repository) in the root folder.
- Enter the URL: https://github.com//.git
RStudio will clone the remote repo to a local git repo for you.
- Adapt the .gitignore file:
- Add /data Data are immutable. The raw data should never be changed, use scripts to clean instead. Data should not live on GitHub.
- Add /plots line Plots take up a lot if space, GitHub is not ment to version control plots.
-
Add package versions to the requirements in order to install specific versions of a package.
-
Run the
R/env.R
script to install the requirements -
[Optional] Consider using renv for isolation and reproducibility. It comes as an option in your Rproject settings.
Lauch the terminal. Go to the path of your repo:
cd Z:/path/to/your/repo
git init
git add *
git commit -m "initial commit"