Loading package

library(ggplot2)
library (ggthemes)

Đọc dữ liệu

ob = read.csv("D:\\Deskop\\Học R tại CT\\DỮ LIỆU ĐÍNH KÈM BÀI TẬP\\Obesity data.csv")

vẽ biểu đồ

p = ggplot(data=ob, aes(x=bmi, y=pcfat, col=gender)) + geom_point() + geom_smooth()
p =p + labs(x="Tỷ trọng cơ thể (BMI)", y= " Tỷ trọng mỡ (%)", title = "Mối liên quan giữa tỷ trọng cơ thể và tỷ trọng mỡ") 
p + theme_economist()
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'