การดึงข้อมูล

df = read.csv("sample_houseprice.csv")
head(df)
##   Id MSSubClass MSZoning LotFrontage LotArea Street YearBuilt SalePrice
## 1 12         60       RL          85   11924   Pave      2005    345000
## 2 14         20       RL          91   10652   Pave      2006    279500
## 3 21         60       RL         101   14215   Pave      2005    325300
## 4 26         20       RL         110   14230   Pave      2007    256300
## 5 28         20       RL          98   11478   Pave      2007    306000
## 6 33         20       RL          85   11049   Pave      2007    179900

Scatter plot

attach(df)
df = read.csv("sample_houseprice.csv")
par(mfrow = c(1,2))
plot(LotFrontage,SalePrice,col="coral1",pch=16)
plot(LotArea,SalePrice,col="coral1",pch=16)

สร้างกราฟ สองแถวในหน้าเดียวกัน

“mfrow = c(num of row , num of col)”

df = read.csv("sample_houseprice.csv")
par(mfrow = c(1,2))

plot(LotFrontage,SalePrice,col="coral1",pch=16)

plot(LotArea,SalePrice,col="coral1",pch=16)

การสร้างกราฟ boxplot แนวตั้ง

df = read.csv("sample_houseprice.csv")
boxplot(LotFrontage,col = "coral1",horizontal=TRUE)

การสร้างกราฟ boxplot นอน

df = read.csv("sample_houseprice.csv")

boxplot(LotArea,col = "coral1")