Create a free RStudio Cloud account and take a copy of the HealthyR Notebooks project following this link: https://rstudio.cloud/project/3850635
- Create an account
- Click on "Take a permanent copy" at https://rstudio.cloud/project/3850635
- Click on the
01_introduction
folder in the Files pane (bottom-right), then open01_introduction.Rmd
- Installing R
- Installing RStudio
- Installing R packages: https://media.ed.ac.uk/media/Installing+R+Packages/1_2yfie5da
- Exploring RStudio: https://media.ed.ac.uk/media/Exploring+RStudio/1_0bdm2dxf
- Welcome to R: https://media.ed.ac.uk/media/Welcome+to+R/1_is6b5a1d
- RStudio Projects: https://media.ed.ac.uk/media/RStudio+Projects/0_06t7jmhd
- Importing CSV files: https://media.ed.ac.uk/media/Importing+CSV+Files/1_ntwi93hq
- Importing Excel files: https://media.ed.ac.uk/media/Importing+Excel+files/0_7k3z7x1a
- Exploring data: https://media.ed.ac.uk/media/Exploring+Data/0_0x81oy5g
- Preparing data: https://media.ed.ac.uk/media/Preparing+Data/0_2w3an1sj
- Tidying data: https://media.ed.ac.uk/media/Tidying+Data/1_6lvj81qx
All videos: https://media.ed.ac.uk/tag/tagid/healthyr
Download and install the latest version of R from:
https://www.stats.bris.ac.uk/R/
Mac: Download R for (Mac) OS X
- R-4.1.2.pkg
Windows: Download R for Windows
- base
Then download and install RStudio:
https://www.rstudio.com/products/rstudio/download/#download
healthyr_notebooks = c("tidyverse", "boot", "finalfit", "flexdashboard",
"gapminder", "here", "kableExtra", "knitr", "remotes",
"rmarkdown", "shiny", "survminer", "tinytex", "patchwork")
install.packages(healthyr_notebooks)
tinytex::install_tinytex()
If it asks you "Do you want to restart your R session", press Yes the first time. If it immediately asks again, press No.
Code to check tinyTex and Tex working as expected:
tinytex:::is_tinytex()
# If installed should return `TRUE`.
# Notice the triple colon, this is because it's an internal variable name.
~"TeX failed, you already have a TeX distribution...".
If you already have LaTex installed on your computer, the tinytex::install_tinytex()
one is not necessary and might not work. This is fine, there is no harm in copy-pasting in anyway if you are not sure.
WARNING: Rtools is required to build R packages, but is not currently installed.
Some packages need a little extra help on installation. This can happen if the package developer hasn't uploaded the Windows binaries to CRAN, or if you're installing directly from GitHub. Mac's have this capability built in, whereas Windows users will have to install RTools before trying to install package again: https://cran.r-project.org/bin/windows/Rtools
- Click on
Clone or download
thenDownload ZIP
(top-right of this GitHub page) - Unzip the folder and rename it to just healthyr (so from
healthyr_notebooks_materials-master
tohealthyr
). - Move this folder to where you will be keeping your R projects. Each RStudio project is in a separate folder, but you can always move them afterwards (e.g. into a new folder called R-projects).
- Open RStudio. Click on New Project.
- Select "Existing Directory".
- Browse to find your
healthyr
folder, thenCreate Project
. - Click on the
01_introduction
folder in the Files pane (bottom-right), then open01_introduction.Rmd
.