install.packages(“tidyverse”)

library(ggplot2)

library(dplyr) library(tidyr) library(readr) library(readxl)

CO2

View(CO2)

head(CO2)

Summary(CO2)

str(CO2)

CO2 %>% select(Type, conc)

CO2 %>% filter(conc>500)

mpg ?mpg head(mpg) summary(mpg)

mpg$hwy mpg %>% filter(hwy>20)

mpg_loc <- mpg %>% filter(hwy > 20) %>% # lọc trước select(hwy) # sau đó chọn cột cần

head(mpg_loc) View(mpg_loc) # chữ “V” viết hoa trong View()

plot(mpg\(displ, mpg\)hwy) library(ggplot2)

ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy), color = “orange”)

library(dplyr)

hangxe <- mpg %>% group_by(manufacturer) %>% summarise( soluong = n(), tonxang = min(hwy), tietkiem = max(hwy), tbtieuthu = mean(hwy) )

hangxe

hist(mpg$hwy)

dongxe <- mpg%>% group_by(mpg$model)%>% summarise(soluong = n())

dem_hx <- table(mpg$manufacturer) ) dem_hx

ggplot(data = mpg)+ geom_histogram(mapping = aes(x= hwy))

library(readxl) Superstore <- read_excel(“3.SUPERSTORE.xlsx”, sheet = 1) head(Superstore)

library(readxl)

Creditdata <- read_excel(“Creditdata.xlsx”, sheet = 1) head(Creditdata) View(Creditdata) credit_data <- Creditdata credit_data[is.na(credit_data)] <- 0 View(credit_data)

theonhom <- credit_data%>% group_by(credit_data$Term)%>% summarise(soluong = n())

View(theonhom)