I’m using Windows.
This is a good tutorial:
First you need to install R from this site that hasn’t made it out of the 90s yet:
All R packages are stored globally by default. See packrat or, seemingly better, renv for per-project package management.