Hello...I was wondering if someone can help me summarize my data by player_name & pitch and show/count all the different events that happens. Thank you!
bdat <- data.frame(
player_name = as.factor(c("bob", "bob", "bob", "bob", "bob", "bob", "bob",
"bob", "bob", "bob", "billy", "billy", "billy",
"billy", "billy", "tom", "tom", "tom", "tom", "tom",
"aaron", "bob", "bob", "bob")),
event = as.factor(c("ball", "calledstrike", "ball", "calledstrike",
"foul", "foul", "foul", "foul", "foul",
"calledstrike", "strikeswinging", "ball", "strikeswinging",
"ball", "calledstrike", "strikeswinging",
"calledstrike", "foul", "foul", "strikeswinging", "bunt",
"calledstrike", "foul", "strikeswinging")),
pitch = as.factor(c("curveball", "fastball", "slider", "fastball",
"fastball", "fastball", "curveball", "fastball",
"curveball", "fastball", "curveball", "curveball",
"curveball", "fastball", "fastball", "fastball",
"fastball", "fastball", "curveball", "fastball",
"fastball", "curveball", "fastball", "curveball"))
)