jflancer / bigballR

Package for working with NCAA Basketball Data
Other
61 stars 19 forks source link

get_player_stats breaks when aggregating season data #38

Closed mdonahue263 closed 1 year ago

mdonahue263 commented 1 year ago

Trying to use this function to aggregate a team's stats for a season. Running Abilene Christian's play-by-play dataframe for 2018-2019 returns this error: Error in dplyr::summarise(): ℹ In argument: PTS_trans = sum((Event_Result == "made") * Shot_Value * isTransition, na.rm = T). ℹ In group 1: ID = 4654122, Date = "11/06/2018", Home = "Abilene Christian", Away = "Arlington Baptist", Event_Team = "Abilene Christian", Player_1 = "BJ.MAXWELL". Caused by error in (Event_Result == "made") * Shot_Value * isTransition: ! non-numeric argument to binary operator

mdonahue263 commented 1 year ago

Edit - Possibly caused by writing play-by-play data to CSV and reading; the problem occurred in the "isTransition" column, which when saved as CSV sometimes converted the logical true/false values to strings. Problem fixed by casting the column as logical.