Data Processing and Visualization in R
2024-11-21
R is a statistical programming language.
R is a statistical programming language.
R is a statistical programming language.
R is a statistical programming language.
R is a statistical programming language.
It allows you to flexibly
wrangle
analyze
visualize your data
create reproducible documents
All code
is in monospace font peach text
R functions end with parentheses: function()
Directory names end with slash: home/
Package names are surrounded by curly braces: {tidyverse}
Keyboard buttons separate keys with a plus: Ctrl+S
These are parentheses ()
, brackets []
, and braces {}
Links are in light blue text
Download at https://r-project.org.
For Windows, also install Rtools
RStudio is an Integrated Development Environment (IDE). Download from Posit
Base R is a core set of packages for all R installations.
Note
User-contributed packages can be found on the Comprehensive R Archive Network or CRAN.
In the console type
install.packages("<package_name>")
where <package_name>
is the name of the package.
Try installing the {palmerpenguins}
package.
Load the {here}
package:
Note
Every time you close your R session, you’ll have to reload the packages you were using.
Let’s view the penguins
data set from the {palmerpenguins}
package.
Try this:
You should receive Error: object 'penguins' not found
. Why did you receive this error?
But you can either load the {palmerpenguins}
package, or use this trick to call a specific function from a specific package.
{ggplot2}
, for data visualisation
{dplyr}
, for data manipulation
{tidyr}
, for data tidying
{readr}
, for data import
{purrr}
, for functional programming
{tibble}
, for tibbles, a version of data frames
{stringr}
, for strings
{forcats}
, for factors
Install R from https://r-project.org
Install RStudio from https://rstudio.com
Install {tidyverse}
package
Complete course introduction form
Read the syllabus
Read readings in syllabus schedule