Description Usage Arguments References Examples
Extract detailed information about individual events.
1 | cwevent(year)
|
year |
The year to obtain event information |
http://chadwick.sourceforge.net/doc/cwevent.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # acquire event data from 1960
df <- cwevent(1960)
# tack on batter's name
data(players, package = "chadwick")
library(dplyr)
p <- players %>%
rename(BAT_ID = Player.ID, BAT_TEAM_ID = Team) %>%
mutate(Batter.Name = paste(First.Name, Last.Name)) %>%
select(Year, BAT_TEAM_ID, BAT_ID, Batter.Name)
df2 <- left_join(df, p)
# who had the most strikeouts in 1960?
df2 %>%
filter(EVENT_DES == "Strikeout") %>%
count(Batter.Name) %>%
arrange(desc(n))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.