Skip to content

JanvandenBrand/template-R-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

template-R-project

This repos is intended as an R template for the analysis of a research project.

Prerequisites

  1. R (www.r-project.org)
  2. RStudio (https://www.rstudio.com/)
  3. Git (https://git-scm.com/)

How to use

Local copy

See the video instructions below:

Video instructions

  1. Download the template as a .zip file.
  2. Extract to the desired location on your system.
  3. 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.
  4. Open RStudio and create a New Project (existing directory) in the root folder.
  5. 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.

Git clone

  1. Fork this repository to your remote Git and rename it to .
  2. Open RStudio and create a New Project (from repository) in the root folder.
  3. Enter the URL: https://github.com//.git

RStudio will clone the remote repo to a local git repo for you.

Set-up the project

Recommendations

  1. 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.
  1. Add package versions to the requirements in order to install specific versions of a package.

  2. Run the R/env.R script to install the requirements

  3. [Optional] Consider using renv for isolation and reproducibility. It comes as an option in your Rproject settings.

Troubleshooting

1. RStudio will not initialize the Git repo.

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"

About

A template R project for research

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages