-1

I have a df called teams with one column, tm_abbr with 30 teams.

I am trying to get all of their results with a function called team_results_bref, which is done by calling

team_results_bref(team name, year)

this outputs all of the teams game results up until that point in the season.

I am trying to create a df that has every result for all 30 teams.

jprice
  • 9
  • 2
  • 1
    You might want to take a look at [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Next, I would recommend you look at the `dplyr` package, in particular `group_by()` and `group_map()` or `group_modify()` if `team_results_bref()` can return ` data.frame`. – hrvg May 19 '22 at 00:58
  • 1
    In addition to what hrvg states, you also should consider using R's functional nature. R can be viewed many ways given its open source history and development. But for what you are talking about, think about FIRST structuring your data and then SECOND use the functions in the flavor of R you are using to process those data structures. The functions USE the structures to provide all the necessary information to set up vectorization and looping and keep it under the hood where it belongs. In the end there is nothing to help with unless you provide some info as to what you really need. – John Garland May 19 '22 at 01:47

0 Answers0