title: R shiny reactive default date range
body: <p>My question is concerning a dataset with highly variable date ranges.  I want to allow the user to select a person/or event and then have the default appearing daterange in the dateRangeInput as the min and max of those dates.  I want the initial graphs I create from these date ranges to be bounded by the minimum and maximum of the values within that row of the dataset which is easy enough.  However I also need the user to have the ability to change these at will to expand on a broader range or zoom into a closer range.  For the purpose of example I have created a basic code/data example showing my difficulty.  I have looked for other answers, but my searches have proved unsuccessful.  I have drawn from the r help files and 
  <a href="http://shiny.rstudio.com/tutorial/lesson4/" rel="nofollow">http://shiny.rstudio.com/tutorial/lesson4/</a>
  as well as numerous other questions on this site, but all to no avail.</p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>shinyUI(fluidPage(
    titlePanel("Default Date Range"),
  
    sidebarLayout(
      sidebarPanel(
        helpText("Problem initiating a date range default based on selected input"),
  
    selectInput("var", 
                label = "Choose a variable to display",
                choices = c("White", "Red", "Blue"),
                selected = "White"),
  
  
    dateRangeInput('dateRange2',
                   label = paste('Date range selection'),
                   start = textOutput("text1"),
                   end = Sys.Date(), 
                   separator = " - ", 
                   weekstart = 1
    )
  ),
  
  mainPanel(
    textOutput("text1"),
    textOutput("text2")
   ) #end of main panel
   )#end of SidebarLayout
  ))#end of fluid page and UI
  </code></pre>
  
  <p>And for the server.r file</p>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>my.data &lt;- t(data.frame(White = c(as.Date("2010-01-01"), as.Date(Sys.Date())),
                    Red = c(as.Date("1943-01-01"), as.Date("1960-05-19")),
                    Blue = c(as.Date("1975-01-01"), as.Date("2010-03-09"))))
  
  
  shinyServer(function(input, output){
  
  output$text1 &lt;- renderText({ 
    paste("You have selected", input$var)
  })
  
  
  
  output$text2 &lt;- renderText({ 
    my.row = match(input$var, rownames(my.data))
   paste("You need the default date range",
         my.data[my.row,1], "to", my.data[my.row,2])
      })
  
  })
  </code></pre>