Sorry if this question sounds dumb. I have been trying to modify this shiny app hosted at: https://joejansen.shinyapps.io/citi-bike-data-with-rCharts/
Github link: https://github.com/joejansen/citi-bike-data-with-rCharts
I want to add grouped variable so that I can have correlation table with grouping. For example, if the user selects "month" then it should list correlation for each month vs "Miles traveled".
So far, I have this
Server.r
#Server.r
library(dplyr)
corTable <- reactive({
yChoice = input$variable
yCor = citibike_all[yChoice]
#Here we input our group
# yGroup = input$group
# yGroup_input = citibike_all[yGroup]
#For simplicity I selected "month" as a grouping variable but it gives me same values.
grouped_table <- citibike_all %>%
group_by(month) %>%
dplyr::summarize(., cor(citibike_all$miles, yCor , use = "complete.obs"))
grouped_table
})
#Output
output$corTable<-renderTable({
corTable()
})
In index.html
<div id="corTable" class="shiny-html-output shiny-bound-output">
I have tried this answer on stackoverflow:
Passing user specifications as arguments to dplyr within Shiny
but it does not work for me. I keep getting same correlation value for all months:
Thanks for reading this question.