Hey guys.
Lets say i have a dataframe that consists 3 categorical variables,
data = data.frame(
score=sample(rnorm(100),100,T),
cat_1=sample(c(T,F),100,T),
cat_2=sample(c("big","med","small"),100,T),
cat_3=sample(c("red","green","blue","orange"),100,T)
)
Now, instead of coding the right shinycode in the UI and then just use in the server this:
data %>% group_by(input$grouping) %>%s
ummarise(mean=mean(score))
It doesnt recognise the 'input$grouping' and instead i use tons of IF statements:
if(input$grouping=="cat_1"){
data %>% group_by(cat_1) %>%s
ummarise(mean=mean(score)) }
else { if(....){--}
}.
Now, my data (in my real shinyapp) is coded within a reactive wrapper, so I'm really struggling to understand what I'm doing wrong.
I also tried to type in the UI side choice=names(data)
but this also doesn't work