how would fix this error while trying to webscrape in R
Error in 1:which(team_c$RESULT == "RESULT") : argument of length 0 In addition: Warning message: Unknown or uninitialised column: `RESULT`.
im currently webscraping espn’s NBA schedule to try and create NBA game prediction model, this is the current code that leads to the error
for (i in 1:length(teams)) { url <- paste0("http://www.espn.com/nba/team/schedule/\_/name/", teams[i]) webpage <- read_html(url) team_table <- html_nodes(webpage, 'table') team_c <- html_table(team_table, fill=TRUE, header = TRUE)[[1]] team_c <-team_c[1:which(team_c$RESULT=="RESULT")-1,] team_c$URLTeam <- toupper(teams[i]) team_c$FullURLTeam <- (teams_fullname[i]) by_team <- rbind(by_team, team_c)}