This is to revise the baiscs and get rid of this boredom due to quarantine!!!
install.packages("tidyverse")
## Installing package into '/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6'
## (as 'lib' is unspecified)
library(tidyverse)
## ── Attaching packages ───────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.0 ✓ purrr 0.3.4
## ✓ tibble 3.0.1 ✓ dplyr 0.8.5
## ✓ tidyr 1.0.3 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ──────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
ggplot(data = mpg)
head(mpg)
## # A tibble: 6 x 11
## manufacturer model displ year cyl trans drv cty hwy fl class
## <chr> <chr> <dbl> <int> <int> <chr> <chr> <int> <int> <chr> <chr>
## 1 audi a4 1.8 1999 4 auto(l5) f 18 29 p compa…
## 2 audi a4 1.8 1999 4 manual(m5) f 21 29 p compa…
## 3 audi a4 2 2008 4 manual(m6) f 20 31 p compa…
## 4 audi a4 2 2008 4 auto(av) f 21 30 p compa…
## 5 audi a4 2.8 1999 6 auto(l5) f 16 26 p compa…
## 6 audi a4 2.8 1999 6 manual(m5) f 18 26 p compa…
6 Rows and 11 Columnss
?mpg
drv tells the type of drive train, where f = front-wheel drive, r = rear wheel drive, 4 = 4wd
Other Variables
manufacturer: manufacturer name
model: model name
displ: engine displacement, in litres
year: year of manufacture
cyl: number of cylinders
trans: type of transmission
cty: city miles per gallon
hwy: highway miles per gallon
fl: fuel type
class: “type” of car
ggplot(data = mpg)+
geom_point(mapping = aes(x=hwy, y=cyl), col = 'blue')
ggplot(data = mpg)+
geom_point(mapping = aes(x=class, y=drv), col = 'red')
It is not useful because it cannot help us in drawing any logical relation.
Please don’t judge. I am doing it because of the boredom!!!! :)
Question source: https://r4ds.had.co.nz/data-visualisation.html