R 데이터 분석
R 분석 : 다이아몬드
YONG_X
2017. 2. 8. 13:21
#--- diamonds example -----
install.packages("ggplot2")
library(ggplot2)
data(diamonds)
View(diamonds)
plot(diamonds$x, diamonds$y, col=diamonds$price)
plot(diamonds$x, diamonds$y, col=10*diamonds$price/max(diamonds$price))
plot(diamonds$x, diamonds$z, col=10*diamonds$price/max(diamonds$price))
plot(diamonds$x, diamonds$price , main="relationship between price and predictor x")
abline(lm(diamonds$price~diamonds$x), col="red", lwd=2)
cor(diamonds$price, diamonds$x)
text(2,5000, "cor = 0.8844352")