selectInput is not reactive to correlation matrix for multiple variables

20 views
Skip to first unread message

yashwanth m r

unread,
Sep 2, 2015, 7:58:45 AM9/2/15
to Shiny - Web Framework for R
Hi,

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.


Reply all
Reply to author
Forward
0 new messages