-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
91 lines (91 loc) · 3.83 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
demo(graphics)
demo(graphics)
demo(persp)
plot
cats
demo(persp)
setwd("~/dataviz-fall-2013/line-chart")
prices <- read.csv("strikeouts.csv")
dir()
prices
dir()
strikeouts <- read.csv("strikeouts.csv")
dim(strikeouts)
head(strikeouts)
plot(strikeouts$so)
plot(strikeouts$g)
unique(strikeouts$g)
head(head)
head(strikeouts)
tail(strikeouts)
strikeouts$kpg <- strikeouts$so / strikeouts$g
head(strikeouts)
max(strikeouts)
max(strikeouts$kpg)
min(strikeouts$kpg)
subset(strikeouts, kpg == max(strikeouts$kpg))
most_strikeouts <- max(strikeouts$kpg)
most_strikeouts
subset(strikeouts, kpg == most_strikeouts)
tacos == tacos
"tacos" == "tacos"
subset(strikeouts, kpg > 8)
oakland <- subset(strikeouts, franchise == "OAK")
oakland
plot(oakland)
head(oakland)
view(oakland)
view:oakland
view("oakland")
max(oakland)
subset(oakland, kpg == max(strikeouts$kpg))
subset(strikeouts, oakland)
subset(strikeouts, max(oakland))
subset(oakland, kpg == max(oakland$kpg))
subset(oakland, kpg == min(oakland$kpg))
oakland <- oakland[order(oakland$kpg), decreasing=T),]
oakland <- oakland[order(oakland$kpg), decreasing=T),]
oakland[order(oakland$kpg), decreasing=T),]
plot(oakland$year, oakland$kpg)
oakland[order(oakland$kpg), decreasing=T,]
oakland <- oakland[order(oakland$kpg), decreasing=T,]
oakland <- oakland[order(oakland$kpg, decreasing=T),]
head(strikeouts)
head(oakland)
tail(oakland)
oakland <- oakland[order(oakland$kpg, decreasing=T),]
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)))
plot(oakland$year, oakland$kpg, pch=15, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)))
plot(oakland$year, oakland$kpg, pch=x, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)))
plot(oakland$year, oakland$kpg, pch=1, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)))
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)), type="1")
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)), type="l")
oakland <- oakland[order(oakland$year),]
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)), type="l")
plot(oakland$year, oakland$kpg, pch=1, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)), type="l")
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)), type="l" lwd=2)
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Strikeouts per game: A's",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)), type="l", lwd=2)
min <- subset(strikeouts, franchise == "MIN")
min <- min[order(min$year),]
plot(min$year, min$kpg, col="blue", main="Strikeouts per game: Minneappolis Twins", + xlab="Year", ylab="Ks per game", ylim=c(0, max(min$kpg)), type="l", lwd=2)
plot(min$year, min$kpg, col="blue", main="Strikeouts per game: Minneappolis Twins", xlab="Year", ylab="Ks per game", ylim=c(0, max(min$kpg)), type="l", lwd=2)
plot(oakland$year, oakland$kpg, pch=16, col="red", main="Oakland vs Minnesota",
xlab="Year", ylab="Ks per game", ylim=c(0, max(oakland$kpg)))
points(min$year, min$kpg, pch=16, col="blue")
max_kpg <- max(c(max(oakland$kpg), min$kpg))
max_kpg <- max(c(max(oakland$kpg), min$kpg))
View(prices)
max_kpg <- max(c(max(oakland$kpg), min$kpg))
plot(oakland$year, oakland$kpg, col="red", main="Oakland vs Minnesota",
xlab="Year", ylab="Ks per game", ylim=c(0, max_kpg), type="l", lwd=2)
lines(min$year, min$kpg, col="blue", lwd=2)