I'm new to R shiny, i try to add a new column using a condition, but the shiny app object throws this error. Can someone help.
In the below code im trying to display number of games that have a tied match for each team in the season.
My code
matches_played = reactive({ matches_year() %>% filter(match_id < playoff()) }) # playoff here is match-id before qualifiers start.
t1 = reactive({ matches_played() %>% group_by(team1) %>% summarise(count = n()) })
t2 = reactive({ matches_played() %>% group_by(team2) %>% summarise(count = n()) })
wl = reactive({ matches_played() %>% filter(winner != "") %>% group_by(winner) %>% summarise(no_of_wins = n()) })
playertable = reactive({ data.frame(Teams = t1()$team1, Played = t1()$count+t2()$count, Wins = wl()$no_of_wins) })
playertable_new = reactive({ playertable() %>% mutate(Teams = ifelse(Teams == tied()$team1|Teams == tied()$team2,1,0), Lost = Played-Wins-Tied, Points = wl()$no_of_wins*2) %>% arrange(-Wins) })
output$player_table = renderTable({ playertable_new() })