title: “Chapter 4 Homework” author: “Jean-Pierre Amoakon” date: “02 October, 2018” output: prettydoc::html_pretty: theme: cayman highlight: github # Possible pretty doc themes are: # cayman, architect, tactile, hpstr, leonids
df1 <-
weather %>%
filter (month == 7) %>%
group_by(day) %>%
summarise(temperature= min(temp)) %>%
mutate(type = "minimum")
df2 <-
weather %>%
filter (month == 7) %>%
group_by(day) %>%
summarise(temperature= max(temp)) %>%
mutate(type = "maximum")
df3 <- rbind(df1, df2)
ggplot(df3, aes(x=day, y= temperature))+
geom_line(aes(color=type))
Distribution of temperature per day in NYC in July 2013
weather %>%
filter(month == 7) %>%
group_by(day) %>%
na.omit() %>%
summarise(MeanWindSpeed= mean(wind_speed)) %>%
ggplot(aes(x=day, y=MeanWindSpeed))+
geom_point()+
geom_line()
Average windspeed per day in NYC in July 2013
The Angels have at times been called the California Angels (CAL), the Anaheim Angels (ANA), and the Los Angeles Angels of Anaheim (LAA). Find the 10 most successful seasons in Angels history. Have they ever won the World Series?
Teams %>%
filter(teamID == "CAL" |teamID == "ANA" | teamID == "LAA") %>%
mutate(WtoLRatio= W/L) %>%
arrange(desc(WtoLRatio)) %>%
select(yearID, teamID, W, L, WtoLRatio, WSWin) %>%
head(10) %>%
knitr::kable(caption = "10 most succesful seasons of the Angels")
| yearID | teamID | W | L | WtoLRatio | WSWin |
|---|---|---|---|---|---|
| 2008 | LAA | 100 | 62 | 1.612903 | N |
| 2002 | ANA | 99 | 63 | 1.571429 | Y |
| 2014 | LAA | 98 | 64 | 1.531250 | N |
| 2009 | LAA | 97 | 65 | 1.492308 | N |
| 2005 | LAA | 95 | 67 | 1.417910 | N |
| 2007 | LAA | 94 | 68 | 1.382353 | N |
| 1982 | CAL | 93 | 69 | 1.347826 | N |
| 1986 | CAL | 92 | 70 | 1.314286 | N |
| 2004 | ANA | 92 | 70 | 1.314286 | N |
| 1989 | CAL | 91 | 71 | 1.281690 | N |
Yes, the Angels won the World Series in 2002.