BillPetti / baseballr

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

"Invalid arguments or no team results available" for MIA, WSN, LAD, CLE, CHA for 2022 #292

Open Forrest31 opened 1 year ago

Forrest31 commented 1 year ago

Describe the bug No results for 5 teams using the bref_team_results function.: Marlins, Nats, Dodgers, Guardians, and White Sox.

To Reproduce

The following code provides results for only 25 teams. The teams listed above teams<-c("NYM", "CHC", "ATL", "CIN", "SLN", "LAA", "BAL", "MIN", "OAK", "TEX", "TOR", "ARI", "PIT", "SEA", "HOU", "KCR", "TBR", "COL", "MIL", "PHI", "SDN", "SFN", "BOS", "DET", "NYA","LAD", "CHA", "CLE", "WSN", "MIA")



```{r For Loop for 2022 Season Results}
mlb_results<-data.frame()

for (x in teams) {
  season_results<-bref_team_results(Tm=x, year = 2022) 
  loop<-data.frame(season_results)
  mlb_results<-rbind(mlb_results,loop)
}
2023-03-14 09:58:53: Invalid arguments or no team results data available!
2023-03-14 09:58:54: Invalid arguments or no team results data available!
2023-03-14 09:58:54: Invalid arguments or no team results data available!
2023-03-14 09:58:54: Invalid arguments or no team results data available!
2023-03-14 09:58:54: Invalid arguments or no team results data available!
2023-03-14 09:58:54: Invalid arguments or no team results data available!
2023-03-14 09:58:54: Invalid arguments or no team results data available!
2023-03-14 09:58:55: Invalid arguments or no team results data available!
2023-03-14 09:58:55: Invalid arguments or no team results data available!
2023-03-14 09:58:55: Invalid arguments or no team results data available!
2023-03-14 09:58:55: Invalid arguments or no team results data available!
2023-03-14 09:58:56: Invalid arguments or no team results data available!
2023-03-14 09:58:56: Invalid arguments or no team results data available!
2023-03-14 09:58:56: Invalid arguments or no team results data available!
2023-03-14 09:58:56: Invalid arguments or no team results data available!
2023-03-14 09:58:56: Invalid arguments or no team results data available!
2023-03-14 09:58:56: Invalid arguments or no team results data available!
2023-03-14 09:58:57: Invalid arguments or no team results data available!
2023-03-14 09:58:57: Invalid arguments or no team results data available!
2023-03-14 09:58:57: Invalid arguments or no team results data available!
2023-03-14 09:58:57: Invalid arguments or no team results data available!
2023-03-14 09:58:57: Invalid arguments or no team results data available!
2023-03-14 09:58:57: Invalid arguments or no team results data available!
2023-03-14 09:58:58: Invalid arguments or no team results data available!
2023-03-14 09:58:58: Invalid arguments or no team results data available!
2023-03-14 09:58:58: Invalid arguments or no team results data available!
2023-03-14 09:58:58: Invalid arguments or no team results data available!
2023-03-14 09:58:58: Invalid arguments or no team results data available!
2023-03-14 09:58:58: Invalid arguments or no team results data available!
2023-03-14 09:58:59: Invalid arguments or no team results data available!
**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
 - OS: windows
 - Browser [e.g. chrome, safari]
 - Version R version 4.2.2, baseballr package 1.3.0

**Smartphone (please complete the following information):**
 - Device: [e.g. iPhone6]
 - OS: [e.g. iOS8.1]
 - Browser [e.g. stock browser, safari]
 - Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
camdenk commented 1 year ago

My guess is Baseball Reference might've rate limited your requests.

I ran this below without any issues.

library(tidyverse)
library(baseballr)

teams<-c("NYM", "CHC", "ATL", "CIN", "SLN", "LAA", "BAL", "MIN",
         "OAK", "TEX", "TOR", "ARI", "PIT", "SEA", "HOU", "KCR", "TBR",
         "COL", "MIL", "PHI", "SDN", "SFN", "BOS", "DET", "NYA","LAD",
         "CHA", "CLE", "WSN", "MIA")

mlb_results<-data.frame()

for (x in teams) {
  Sys.sleep(runif(1, max = 7))
  print(x)

  season_results<-bref_team_results(Tm=x, year = 2022) 
  loop<-data.frame(season_results)
  mlb_results<-rbind(mlb_results,loop)
}
Forrest31 commented 1 year ago

Thank you for responding so quickly. I really appreciate it.

Do you happen to have contact information for anyone at baseball reference to increase my limit or know how I could increase this? Thank you so much.

On Wed, Mar 15, 2023 at 3:35 PM Camden Kay @.***> wrote:

My guess is Baseball Reference might've rate limited your requests.

I ran this below without any issues.

library(tidyverse) library(baseballr)

teams<-c("NYM", "CHC", "ATL", "CIN", "SLN", "LAA", "BAL", "MIN", "OAK", "TEX", "TOR", "ARI", "PIT", "SEA", "HOU", "KCR", "TBR", "COL", "MIL", "PHI", "SDN", "SFN", "BOS", "DET", "NYA","LAD", "CHA", "CLE", "WSN", "MIA")

mlb_results<-data.frame()

for (x in teams) { Sys.sleep(runif(1, max = 7)) print(x)

season_results<-bref_team_results(Tm=x, year = 2022) loop<-data.frame(season_results) mlb_results<-rbind(mlb_results,loop) }

— Reply to this email directly, view it on GitHub https://github.com/BillPetti/baseballr/issues/292#issuecomment-1470803841, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTITNU5MESPQEC5PJ73VZDW4IR2RANCNFSM6AAAAAAV2SBRJM . You are receiving this because you authored the thread.Message ID: @.***>

camdenk commented 1 year ago

I think it was likely a temporary limitation. Have you tried updating the package and then running the example that I included to see if that works for you?

Forrest31 commented 1 year ago

No. I assumed the limitation was forever. I can try that now. Thank you.

On Tue, Mar 21, 2023 at 10:29 AM Camden Kay @.***> wrote:

I think it was likely a temporary limitation. Have you tried updating the package and then running the example that I included to see if that works for you?

— Reply to this email directly, view it on GitHub https://github.com/BillPetti/baseballr/issues/292#issuecomment-1478044824, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTITNQYEQ64PWDNPSSPBHTW5HCM5ANCNFSM6AAAAAAV2SBRJM . You are receiving this because you authored the thread.Message ID: @.***>