#Task 01
# dataset
data<-mtcars
View(data)
table(data$mpg)
##
## 10.4 13.3 14.3 14.7 15 15.2 15.5 15.8 16.4 17.3 17.8 18.1 18.7 19.2 19.7 21
## 2 1 1 1 1 2 1 1 1 1 1 1 1 2 1 2
## 21.4 21.5 22.8 24.4 26 27.3 30.4 32.4 33.9
## 2 1 2 1 1 1 2 1 1
#load ggplot2 and data
barplot(table(data$mpg),
xlab="mpg of cars",
ylab="Numbers",
main="Cars according to mpg",
col="blue")

mosaicplot(table(data$mpg,data$gear),
col="Purple",
main='Mosiac Plot')

# load ggplot2
library("ggplot2")
## Warning: package 'ggplot2' was built under R version 4.4.3
ggplot(data)+
geom_point(mapping=aes(x=mpg,y=gear, alpha=mpg), col="Brown")

#task 02
ggplot(data, aes(x=wt)) +
geom_histogram(aes(x=wt),
binwidth=.07,
colour="Red", fill="black") +
geom_density(alpha=.6, fill="#66ffff")
