I am trying to get correlation matrix for the list of all numerical variables.
UI.R
Category <- c("category1","category2","category3","category4")
shinyUI(fluidPage(
theme = shinytheme("united"),
titlePanel("App Title"),
sidebarPanel(
conditionalPanel(condition = "$('li.active a').first().html()==='Correlation'",
selectInput('category',"Select category :",choices = Category))
),
mainPanel(
tabsetPanel(
tabPanel('Correlation',tableOutput("corr"))
))
))
Server.R
data_Input <- read.csv("data.csv")
shinyServer(
function(input,output){
output$corr <- renderTable({
data = subset(data_Input,Category==input$category)
cor(data[,sapply(data,is.numeric)])
})
}
)
Issue : When I select category, correlation matrix is not reactive. It is gives correlation matrix for category_1 alone.
Please help me fix this.