install.packages(c("tidyverse", "broom", "patchwork", "skimr"))
Introduction to linear regression analysis
Setup
The exercise classes require a minimal software setup:
Open https://cran.r-project.org/ and you will find links to R builds for different operating systems. Click on the link matching your operating system and choose the latest version of R. When using the Windows operating system you will see a link “Install R for the first time”. Click on this link and then download R installer. Run the installer and accept the default settings.
After installing R, open https://posit.co/download/rstudio-desktop/. If the web page recognizes your operating system you will see a download button (right side of the page) for R studio. If the button does not appear, scroll down the page and find the installer appropriate for your operating system.
Open R Studio on your computer and create a new R Markdown file. Find the file drop down menu on the top-left part of the interface, select “New file”, then find “R Markdown” and click on it. If this is the first time you create a R Markdown file, R Studio will ask you to install a number of packages. Confirm this and wait for the packages to download and install. Click “OK” on the dialogue button, and you will see a text file with a simple R Markdown template that demonstrates some basic functionality.
In this exercise class we use a lot of functions from the
tidyverse
system and several other packages. In order to access these you need the to install this package. Find the R console in R studio and paste the following line on the command line. Press enter to run it. This will install some of the necessary packages on your system.
Optional: more on R Markdown: https://rmarkdown.rstudio.com/lesson-1.html
Optional: a base R cheatsheet: https://www.datacamp.com/cheat-sheet/getting-started-r