title: Select trace(s) for R plotly graph based on checkboxinput for shiny
body: <p>I have a plotly graph with many lines I added manually with add_trace. I would like to be able to select which lines appear on the graph by selecting checkboxes. I'd also like to be able to have the checkboxes represent several variables. For example, checking the checkbox called "Choice A" returns the lines for varone and vartwo. </p>
  
  <p>I feel like I've tried everything but haven't had any luck. I tried out various reactive functions, but couldn't get them to work, since my variables are in columns, and each trace selects an individual column, so I didn't include reactivity in the code below because I can't get it to work. Help would be greatly appreciated!! </p>
  
  <pre><code>library(shiny)
  library(plotly)
  library(shinythemes)
  
   mydataset &lt;-data.frame( date  = c("12/01/2016", "12/02/2016",  "12/03/2016"),
                varone = c(60, 65, 80),
                vartwo = c(90, 45, 100),
                varthree = c(15, 120,201))
  
  
   ui &lt;- shinyUI(
    navbarPage(theme=shinytheme("journal"), "My Dashboard",
    tabPanel("Data",
      fluidPage(
        fluidRow(
          column(2, dateRangeInput("daterange1", label = h5("Date Range:"),
                                   start = "2001-01-01",
                                   end   = "2010-12-31"),
                 br(),
                 checkboxGroupInput("mydataset", label = h5("Variables:"),
                                    c("Choice A" = "varone",
                                      "Choice B" = "vartwo",
                                      "Choice C" = "varthree"))),#close column
          column(10, plotlyOutput("plot"))
        )))))
  
  
   server &lt;- function(input, output) { 
   output$plot &lt;- renderPlotly({
   plot_ly(x = mydataset$date, y = mydataset$varone, name = 'varone', type = 'scatter', mode = 'lines') %&gt;%
    add_trace(x = mydataset$date, y = mydataset$vartwo, name = 'vartwo', mode = 'lines+markers')%&gt;%
    add_trace(x = mydataset$date, y = mydataset$varthree, name = 'varthree', mode = 'lines+markers')
    })}
  
   shinyApp(ui ,server)
  </code></pre>