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

การดึงข้อมูล sample_price.csv เข้าในโปรแกรม R

df = read.csv("sample_houseprice_2.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)
par(mfrow = c(2,2))
  plot(LotFrontage,Id,col="khaki",pch=5,main="Dot Graph of LotFrontge with Id",lwd=0.1,type="p")

  plot(LotFrontage,SalePrice,col="hotpink",pch=6,main="Dot Graph of LotFrontge with SalePrice",lwd=0.1,type="p")

  plot(LotFrontage,LotArea,col="turquoise",pch=2,main="Dot Graph of LotFrontge with LotArea",lwd=0.1,type="p")
  
  plot(LotFrontage,MSSubClass,col="violet",pch=7,main="Dot Graph of LotFrontge with MSSubClass",lwd=0.1,type="p")

การสร้าง Boxplot เบื้องต้น

par(mfrow = c(1,2))

  boxplot(df$LotFrontage,col="red",pch=9,main="Vertical LotFrontage graph",lwd=1)
 
  boxplot(df$LotFrontage,col="green",horizontal = T,pch=11,main="Horizotal LotFrontage graph",lwd=1)

การสร้าง barplot เบื้องต้น

barplot(table(MSZoning,MSSubClass),col=c("#66FFFF","#FF3399","#CCFF00"),beside=T,legend.text=T,xlab="The BuldingClass" ,main="Example Barplot")