We will be working with the most recent stable versions of R and RStudio, as well as with a number of additional packages. You will need to install R, RStudio, and the necessary packages on your own computer.
1. Install R on your computer
Begin by installing R (http://cloud.r-project.org). Choose the version appropriate for your computing platform:
If you use macOS with an Apple Silicon processor (i.e. an M1, M2, or M3 chip), then install R for macOS’s Apple Silicon build. This version does not work on older, Intel-based Macs.
Once R and RStudio are installed, launch RStudio. Either carefully type in or copy-and-paste the following lines of code at R’s command prompt, located in the RStudio window named “Console”, and then hit return. To copy this chunk of code, mouse over the code click the clipboard icon, , that appears in the top right corner of the chunk.
Installing these packages may take a little time. Once you have completed this step, you’ll be ready to begin.
Source Code
---title: "Example 01: Get up and running"---We will be working with the most recent stable versions of R and RStudio, as well as with a number of additional packages. You will need to install R, RStudio, and the necessary packages on your own computer.### 1. Install R on your computerBegin by installing R (<http://cloud.r-project.org>). Choose the version appropriate for your computing platform: - If you use macOS with an Apple Silicon processor (i.e. an M1, M2, or M3 chip), then install [R for macOS's Apple Silicon build](https://cran.r-project.org/bin/macosx/big-sur-arm64/base/R-4.3.2-arm64.pkg). This version does not work on older, Intel-based Macs.- If you use macOS with an Intel processor, then install [R for macOS's Intel build](https://cran.r-project.org/bin/macosx/big-sur-x86_64/base/R-4.3.2-x86_64.pkg). - If you use Microsoft Windows, then install [R for Windows](https://cran.r-project.org/bin/windows/base/R-4.3.2-win.exe).- If you use Linux, [choose a distribution](https://cloud.r-project.org/bin/linux/) and install it.### 2. Install RStudio on your computer- If you use macOS (whether Apple Silicon or Intel), [install this version of RStudio](https://download1.rstudio.org/electron/macos/RStudio-2023.12.0-369.dmg).- If you use Windows, [install this version of RStudio](https://download1.rstudio.org/electron/windows/RStudio-2023.12.0-369.exe).- If you use Linux, [choose your distribution from the download page](https://posit.co/download/rstudio-desktop/).### 3. Installing some additional packages- Once R and RStudio are installed, launch RStudio. Either carefully type in or copy-and-paste the following lines of code at R’s command prompt, located in the RStudio window named “Console”, and then hit return. To copy this chunk of code, mouse over the code click the clipboard icon, {{< fa clipboard >}}, that appears in the top right corner of the chunk.```{r, eval=FALSE, echo=TRUE}course_packages <- c("tidyverse", "babynames", "broom", "gapminder", "here", "janitor", "naniar", "palmerpenguins", "skimr", "slider", "socviz", "usethis", "visdat","reprex", "remotes")install.packages(course_packages, repos = "http://cran.rstudio.com")data_packages <- paste0("kjhealy/", c("covdata", "congress", "nycdogs", "ukelection2019", "uscenpops"))remotes::install_github(data_packages)```Installing these packages may take a little time. Once you have completed this step, you'll be ready to begin.