Intermediate R
In this session , we will learn about function and control structures such as writing functions , if statements, and loops.
We will also explore Data Cleaning and Transformations such as handling missing data , reshaping data using the dplyr functions.
First , we need to load this package
#install.packages("tidyverse")
library(tidyverse)
#> ── Attaching core tidyverse packages ──── tidyverse 2.0.0 ──
#> ✔ dplyr 1.1.4 ✔ readr 2.1.4
#> ✔ forcats 1.0.0 ✔ stringr 1.5.1
#> ✔ ggplot2 3.5.0 ✔ tibble 3.2.1
#> ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
#> ✔ purrr 1.0.2
#> ── Conflicts ────────────────────── tidyverse_conflicts() ──
#> ✖ dplyr::filter() masks stats::filter()
#> ✖ dplyr::lag() masks stats::lag()
#> ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
It will load
-
ggplot2
: Used for data visualization using the grammar of graphics. -
dplyr
: Provides a set of tools for efficiently manipulating datasets. -
tidyr
: Used for tidying data, that is, transforming it to a format that is easy to work with. -
readr
: Used to read rectangular data like CSVs and text files into R. -
purrr
: Enhances R’s functional programming (FP) toolkit, making it easier to work with lists and functions. -
tibble
: A modern reimagining of data frames, providing a cleaner and more user-friendly data structure. -
stringr
: Simplifies the process of working with strings (text data). -
forcats
: Designed to handle categorical variables (factors) with ease.
In this session , we will use some of them