User Tools

Site Tools


r:baseball_data

This is an old revision of the document!


baseball_performance.csv
17.3-1.txt

#Part 2 - 도전 미션 3-1 -소스코드

setwd("c:\\r_temp")
data <- read.csv("baseball_performance.csv", header=T)
head(data,25)
data$forward_rate <- (data$출루율/data$연봉)*100

bp <- barplot(data$forward_rate, 
      main=paste("연봉대비 출루율"), 
      col=rainbow(25), 
      cex.names=0.7, las=2, 
      names.arg=data$선수명, 
      ylim=c(0,50))

title(ylab="연봉대비출루율", col.lab="red")

aver <- 0
for(i in 1:length(data$forward_rate))
   { aver <- aver+data$forward_rate[i] }
aver <- aver/length(data$연봉대비출루율)
aver

abline(h=aver, col="blue")
text(x=aver-11, y=14.5, col="black", cex=0.8, labels=paste(aver,'%',"(평균출루율)"))
text(x=bp*1.01, y=data$연봉대비출루율*1.05, col="black", cex=0.7, 
   labels=paste(data$연봉대비출루율,'%'))
r/baseball_data.1496622150.txt.gz · Last modified: 2017/06/05 08:52 by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki