R Shiny Error no applicable method for filter applied to an object of class c reactiveExpr reactive

0 votes

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() })

Aug 20, 2019 in Data Analytics by archana
9,110 views

1 answer to this question.

0 votes

The error could be because of using reactive variables without parenthesis.

Or you are filtering the wrong argument from the reactive variable.

In this line,

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) })

Try like this.

playertable()$Tied=reactive({ ifelse(Teams == tied()$team1|Teams == tied()$team2,1,0) })
playertable()$Lost=reactive({ playertable()$Played - playertable()$Won - playertable()$Tied  })

It would work.

To know more about React, We highly recommend to join React Certification course today.

Thank You!!

answered Aug 21, 2019 by Cherukuri
• 33,030 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

"no applicable method" Error in r programming

This is caused by using an object-oriented ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 52,350 points
2,529 views
0 votes
1 answer

Error saying "ERROR: Expected tag to be of type header" while creating a dashboard using shiny R

sliderInput("bins","number of breaks",1,100,50), this line should come under ...READ MORE

answered Nov 30, 2018 in Data Analytics by Maverick
• 10,840 points
4,579 views
+1 vote
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,840 points
2,624 views
+1 vote
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 29, 2018 in Data Analytics by Maverick
• 10,840 points
3,656 views
+2 votes
1 answer
0 votes
1 answer

R Shiny Error: Object of type 'closure' is not subsettable

The error you mentioned happens when you ...READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 33,030 points
6,359 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP