# Possible World Series?
h1 <- read.csv("C:/YONG/m1710/0_video튜토리얼_/LAD/LAD20180928.csv")
plot(h1$PA, h1$TB/h1$PA, pch=19,
cex=1.25,
col=rgb(ifelse(h1$Team=="LAD",0,0.5),0,ifelse(h1$Team=="LAD",0.7,0),0.5),
xlab="PA", ylab="TB/PA",
main="Why LAD goes that bad in 2018" )
text(h1$PA, h1$TB/h1$PA, pch=19,
labels=ifelse(h1$Team=="LAD", as.character(h1$Player),""),
pos=3)
abline(h=quantile(h1$TB/h1$PA, 0.8), lty=3)
abline(h=median(h1$TB/h1$PA), lty=3)
abline(v=median(h1$PA), lty=3)
# h2 <- h1[h1$Player==" Choo, S",]
plot(h1$OBP, h1$SLG-h1$AVG,
pch=19,
cex=1.25,
col=rgb(ifelse(h1$Team=="LAD",0,0.5),0,ifelse(h1$Team=="LAD",0.7,0),0.5),
xlab="OBP", ylab="ISOP",
main="Why LAD goes that bad in 2018" )
text(h1$OBP, h1$SLG-h1$AVG,
pch=19,
labels=ifelse(h1$Team=="LAD" | h1$Player==" Choo, S", as.character(h1$Player),""),
pos=3)
abline(h=quantile(h1$SLG-h1$AVG, 0.9), lty=3, col="red", lwd=1.5)
abline(v=quantile(h1$OBP, 0.9), lty=3, col="red", lwd=1.5)
abline(h=median(h1$SLG-h1$AVG), lty=3)
abline(v=median(h1$OBP), lty=3)
points(h2$OBP, h2$SLG-h2$AVG,
pch=19,
cex=1.25,
col="red")
text(h1$OBP, h1$SLG-h1$AVG,
pch=19,
labels=ifelse(h1$OBP>0.38 & (h1$SLG-h1$AVG)>0.18, as.character(h1$Player),""),
pos=3,
col="darkgrey")
ISOP <- h1$SLG-h1$AVG
abline(lm(ISOP~h1$OBP),
lty=2, lwd=2)
points(.411,.203,
pch=19, cex=1.25, col="lightblue")
text(.411,.203, labels="Turner, J", pos=3, col="navy")
points(.391,.306,
pch=19, cex=1.25, col="lightblue")
text(.391,.306, labels="Muncy, M", pos=3, col="navy")
points(.328, .224,
pch=19, cex=1.25, col="lightblue")
text(.328,.224, labels="Puig, Y", pos=3, col="navy")
#---- best lineup
[1] CF Taylor, C ==> Nimmo? Choo?
[2] 3B Turner, J
[3] SS Machado, M
[4] 1B Muncy, M
[5] LF Kemp, M
[6] C Grandal, Y
[7] RF Puig, Y
[8] 2B Dozier, B
[9] P ***
plot(h1$GO_AO, h1$TB/h1$PA,
pch=19,
cex=1.25,
col=rgb(ifelse(h1$Team=="LAD",0,0.5),0,ifelse(h1$Team=="LAD",0.7,0),0.5),
xlab="GO/AO", ylab="TB/PA",
main="Why LAD goes that bad in 2018" )
text(h1$GO_AO, h1$TB/h1$PA,
pch=19,
labels=ifelse(h1$Team=="LAD" | h1$Player==" Choo, S", as.character(h1$Player),""),
pos=3)
abline(h=quantile(h1$TB/h1$PA, 0.9), lty=3, col="red", lwd=1.5)
abline(v=quantile(h1$GO_AO, 0.9), lty=3, col="red", lwd=1.5)
abline(h=median(h1$TB/h1$PA), lty=3)
abline(v=median(h1$GO_AO), lty=3)
points(h2$GO_AO, h2$TB/h2$PA,
pch=19,
cex=1.25,
col="red")
text(h1$GO_AO, h1$TB/h1$PA,
pch=19,
labels=ifelse(h1$OBP>0.38, as.character(h1$Player),""),
pos=3,
col="darkgrey")
plot(h1$SLG-h1$AVG, h1$TB/h1$PA,
pch=19,
cex=1.25,
col=rgb(ifelse(h1$Team=="LAD",0,0.5),0,ifelse(h1$Team=="LAD",0.7,0),0.5),
xlab="ISOP", ylab="TB/PA",
main="Why LAD goes that bad in 2018" )
text(h1$SLG-h1$AVG, h1$TB/h1$PA,
pch=19,
labels=ifelse(h1$Team=="LAD" | h1$Player==" Choo, S", as.character(h1$Player),""),
pos=3)
abline(h=quantile(h1$TB/h1$PA, 0.9), lty=3, col="red", lwd=1.5)
abline(v=quantile(h1$SLG-h1$AVG, 0.9), lty=3, col="red", lwd=1.5)
abline(h=median(h1$TB/h1$PA), lty=3)
abline(v=median(h1$SLG-h1$AVG), lty=3)
points(h2$SLG-h2$AVG, h2$TB/h2$PA,
pch=19,
cex=1.25,
col="red")
text(h1$SLG-h1$AVG, h1$TB/h1$PA,
pch=19,
labels=ifelse(h1$OBP>0.38, as.character(h1$Player),""),
pos=3,
col="darkgrey")
points(.520-.317, 182/409,
pch=19, cex=1.25, col="lightblue")
text(.520-.317, 182/409, labels="Turner, J", pos=3, col="navy")
points(.565-.259, 182/409,
pch=19, cex=1.25, col="lightblue")
text(.565-.259, 182/409, labels="Muncy, M", pos=3, col="navy")
points(.492-.268, 193/430,
pch=19, cex=1.25, col="lightblue")
text(.492-.268, 193/430, labels="Puig, Y", pos=3, col="navy")
plot(h1$OBP, h1$SLG,
pch=19,
cex=1.25,
col=rgb(ifelse(h1$Team=="LAD",0,0.5),0,ifelse(h1$Team=="LAD",0.7,0),0.5),
xlab="OBP", ylab="SLG",
main="Why LAD goes that bad in 2018" )
points(.391, .565,
pch=19,
cex=1.25,
col="lightblue")
'R 데이터 분석' 카테고리의 다른 글
GameLog-In 데이터준비 (0) | 2018.10.16 |
---|---|
[R분석] 실전 EDA 탐색적분석 R 팁 3 (0) | 2018.10.05 |
[R분석] 프로야구 KBO 타자 성적과 나이의 관계 (0) | 2018.09.28 |
[R분석] KBO 프로야구 가을야구 stat 예상 분석 (0) | 2018.09.20 |
[R분석] EDA탐색적분석 base R (mtcars) (0) | 2018.09.18 |