r:baseball_data
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
r:baseball_data [2017/06/05 08:37] – hkimscil | r:baseball_data [2017/06/05 09:14] – hkimscil | ||
---|---|---|---|
Line 4: | Line 4: | ||
setwd(" | setwd(" | ||
- | |||
data <- read.csv(" | data <- read.csv(" | ||
head(data, | head(data, | ||
- | bp <- barplot(data$연봉대비출루율, main=paste(" | + | data$forward_rate |
- | | + | |
- | | + | bp <- barplot(data$forward_rate, |
+ | | ||
+ | col=rainbow(25), | ||
+ | cex.names=0.7, | ||
+ | | ||
+ | | ||
title(ylab=" | title(ylab=" | ||
- | # the below can be achieved by mean() function | ||
aver <- 0 | aver <- 0 | ||
- | for(i in 1: | + | for(i in 1: |
- | { | + | { aver <- aver+data$forward_rate[i] } |
- | aver <- aver+data$연봉대비출루율[i] | + | |
- | } | + | |
- | aver | + | |
aver <- aver/ | aver <- aver/ | ||
aver | aver | ||
abline(h=aver, | abline(h=aver, | ||
- | |||
text(x=aver-11, | text(x=aver-11, | ||
text(x=bp*1.01, | text(x=bp*1.01, | ||
| | ||
- | savePlot(" | + | dev.copy(png,filename="barplot.png") |
+ | dev.off() | ||
</ | </ | ||
{{: | {{: | ||
+ | 나이팅게일 챠트 | ||
< | < | ||
- | # 나이팅게일 챠트로 표현하기 | ||
data <- read.csv(" | data <- read.csv(" | ||
data | data | ||
Line 45: | Line 44: | ||
stars(data2, | stars(data2, | ||
| | ||
+ | dev.copy(png, | ||
+ | dev.off() | ||
- | savePlot(" | ||
label <- names(data2) | label <- names(data2) | ||
Line 52: | Line 52: | ||
color <- c(" | color <- c(" | ||
pie(val, | pie(val, | ||
- | savePlot(" | + | dev.copy(png, filename="baseball_regend.png") |
+ | dev.off() | ||
+ | </ | ||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | < | ||
# | # | ||
Line 70: | Line 76: | ||
par(new=T) | par(new=T) | ||
| | ||
- | plot(line2, | + | plot(line2, |
axis(4, | axis(4, | ||
mtext(side=4, | mtext(side=4, | ||
Line 79: | Line 85: | ||
legend(18, | legend(18, | ||
- | savePlot(" | + | </ |
+ | {{:r:baseball_4.png}} | ||
- | |||
- | |||
- | </ |
r/baseball_data.txt · Last modified: 2019/09/18 08:00 by hkimscil