I have a data set that looks like the following:
Win Gender Score (1-4) Weight SHE
1 F 2 140 Y
0 M 3 155 Y
1 M 4 134 N
I am creating a Shiny App that will create side by side bar charts for the rows that belong to the different scores (4 groups). I want the user to be able to select the variable that will be on the x-axis (either Win, Gender of SHE), and have the charts update to reflect the counts of that variable within each group.
I have tried the following code in server.R:
shinyServer(function(input, output){
output$plotOne <- renderPlot({
ggplot(data=GroupOne, aes(x=input$var))+geom_bar(stat='bin')
})
})
'var' is the name that I have specified for the variable the user selects based on the radio button input in ui.R. The error message I am getting is that input is not found.
I have also tried the above code, but with
histogram(~input$var, data=GroupOne).
This resulted in errors about negative length vectors and other things.