title: How to select multiple input case using if statement in Shiny?
body: <p>I am developing a shiny application to visualize earthquakes better. I have got two attributes which are depth and magnitude and want to draw 3 different plots according to only depth, only magnitude and selection of both. However I can not select the case with multiple inputs by using if statement. How can I do this? Thanks in advance</p>
  
  <p>Here is the data and the code.</p>
  
  <pre><code> structure(list(latitude = c(39.597, 39.2815, 40.6823, 40.427, 
   39.0462, 40.854), longitude = c(34.3363, 40.2353, 36.6918, 26.2398, 
   41.4552, 27.9235), depth = c(8.6, 5, 13.7, 7.2, 12.9, 14.9), 
    magnitude = c(5.2, 5.5, 5.1, 5.1, 5.1, 5.1), time = structure(c(-7304, 
  -7271, -7067, -7059, -6974, -6716), class = "Date")), .Names = 
   c("latitude", 
   "longitude", "depth", "magnitude", "time"), row.names = c(NA, 
    6L), class = "data.frame")
  library(shiny)
  library(sp)
  library(aspace)
  
   ui &lt;- fluidPage(headerPanel("Earthquakes"),
    dateRangeInput(inputId = "time","Date range:",format = "yyyy-mm-dd",min=min(turkat$time),max = max(turkat$time),start=min(turkat$time),end=max(turkat$time),separator="-" ),
              sidebarPanel(
                selectInput("att", "Select an attribute", choices=c("depth","magnitude"),selected="magnitude",multiple=TRUE,selectize=TRUE)),
              mainPanel(plotOutput("map1"))
  
  
   )
   server &lt;- function(input, output) {
  
  
   myturkat &lt;- reactive({
    turkat[turkat$time&gt;=input$time[1]&amp;turkat$time&lt;=input$time[2],]
   })
     clr&lt;-reactive({as.factor(cut(myturkat()$depth,breaks=c(0,20,40,60,Inf)))        })
    mag&lt;-reactive({as.factor(cut(myturkat()$magnitude,breaks= seq(floor(min(myturkat()$magnitude)),ceiling(max(myturkat()$magnitude)))),include.lowest=TRUE)
    })
  
  
  
   output$map1 &lt;- 
      renderPlot({ if (is.null(input$att)){ warning("select at least one attribute"); return(NULL)}
  
  
       else if(input$att=="magnitude"){
      req(myturkat())
      par(mar=c(5.1, 4.1, 3.1, 2.1))
       plot(turkiye, axes=TRUE,ylim=c(38,42),xlim=c(26,42))  
       points(myturkat()$longitude,myturkat()$latitude,pch=1,cex=myturkat()[,input$att]-(min(myturkat()[,input$att])-1),col="blue",lwd=1.2)
       }
        else if(input$att=="depth"){
         req(myturkat())
        par(mar=c(5.1, 4.1, 3.1, 2.1))
        plot(turkiye, axes=TRUE,ylim=c(38,42),xlim=c(26,42))  
        points(myturkat()$longitude,myturkat()$latitude,pch=16,cex=1.2,col=clr())
        lev&lt;-levels(clr())
         legend("topright",lev,col=palette(),pch=16,title="depth (km)",pt.cex=1.2)}
  
       else if(input$att=="depth" &amp;&amp; input$att=="magnitude") { 
       {req(myturkat())
         grup&lt;-split(myturkat(),mag)
         par(mar=c(5.1, 4.1, 3.1, 2.1))
         plot(turkiye, axes=TRUE,ylim=c(38,42),xlim=c(26,42))
         for (i in 1: length(levels(mag)))
         {
           points(grup[[i]]$longitude,grup[[i]]$latitude,pch=i,cex=1,col=black)}
       }}}
   )
   }
  
        shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>program gave this error.</p>
  
  <pre><code>  Listening on http://127.0.0.1:3066
    Warning in renderPlot(...) : select at least one attribute
    Warning in if (input$att == "magnitude") { :
    the condition has length &gt; 1 and only the first element will be used
    Warning in if (input$att == "depth") { :
    the condition has length &gt; 1 and only the first element will be used
  </code></pre>