BillPetti / baseballr

A package written for R focused on baseball analysis. Currently in development.
billpetti.github.io/baseballr
Other
367 stars 100 forks source link

fg_team_batter drops player name and age #272

Closed rdelrossi closed 1 year ago

rdelrossi commented 1 year ago

Unless I'm missing something, the new fg_team_batter() function doesn't return the player's name (or age in the case of split seasons). The issue seems to be in lines 327 (leaders <- leaders[,-2]) and 390 (leaders <- leaders[,-c(3,5)]).

Dropping these two lines means adjusting the code at lines 335 (increase each index by 1) and 398 (increase each index by 2).

camdenk commented 1 year ago

There's a typo in the url that the function is trying to pull data from, which is causing the issue. The intended behavior is to work similarly to fg_team_pitching() and return pitching statistics aggregated by team, but the typo is causing it to pull individual data (like fg_batter_leaders().

Thanks for letting us know!

rdelrossi commented 1 year ago

Great! Thanks for the quick update. I applied your changes and can confirm that it now works as intended (by team).