Hi I've been working on a small project on English premier league. I want to create a reactive table based on radio button selection. My sample table is of the form (data is fictional),
Team G_Played H_goals A_goals H_wins A_wins H_loss A_loss
Arsenal 200 120 87 35 20 45 30
Aston Villa 200 118 74 26 14 98 75
Chelsea 200 147 98 48 30 25 28
Bolton 200 108 84 26 14 57 60
If I select "Home" on my radio button, I want records only from Team, G_played, H_goals, H_wins, H_loss. Similarly if I select "Away" I should be able to get Team, G_played, A_goals, A_wins, A_loss.
I've tried the solution from this example, R shiny radio button . But I don't know how to call multiple columns for given radio button selection.
Can someone please suggest a code or suggest what I can start with.
Build an if condition to transform your dataset. You can make this in a reactive function like it is recommanded to do in a shiny app, or directly in your output function.
if(input$radiobutton == 'Home'){ df <- df %>% select(G_played, H_goals, ....) }
Same if 'Away'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.