title: xts argument error in an R Shiny application
body: <p>I am trying to visualize point data for a selected date based of a slider. However, I am having trouble with <code>xts</code>, as I am getting the following error:</p>
  <pre><code>Warning: Error in match.arg: 'arg' should be one of “years”, “quarters”, “months”, “weeks”, “days”, “hours”, “minutes”, “seconds”, “milliseconds”, “microseconds”, “ms”, “us”
  </code></pre>
  <p>How can this error be fixed?</p>
  <p>Code</p>
  <pre><code># This is a Shiny time series map web application
  library(shiny)
  library(tidyverse)
  library(tidyr)
  library(leaflet)
  library(xts)
  
  
  
  # Create sample data
  Date= c(&quot;2014-04-08&quot;, &quot;2014-06-04&quot;, &quot;2014-04-30&quot;,
                &quot;2014-05-30&quot;, &quot;2014-05-01&quot;)
  lat = as.numeric(c(&quot;45.53814&quot;, &quot;45.51076&quot;, &quot;45.43560&quot;, &quot;45.54332&quot;,
          &quot;45.52234&quot;))
  lon = as.numeric(c(&quot;-73.63672&quot;, &quot;-73.61029&quot;, &quot;-73.60100&quot;,
          &quot;-73.56000 &quot;, &quot;-73.59022&quot;))
  id = as.numeric(c(&quot;1&quot;, &quot;2&quot;, &quot;3&quot;, &quot;4&quot;, &quot;5&quot;))
  
  # Create a df from the above columns
  df = data.frame(id, lat, lon, Date)
  df$Year = lubridate::year(df$Date)
  df$Month = lubridate::month(df$Date, label = TRUE, abbr=FALSE)
  df$Week = lubridate::week(df$Date)
  df$Date = as.Date(df$Date)
  ui = fluidPage(
      
      # Title
      titlePanel(&quot;Time Series Visiualization Map&quot;),
  
      sidebarLayout(
          
          # Define the sidebar
          sidebarPanel(
              
              radioButtons(inputId = &quot;Frequency&quot;,
                           label = &quot; Select Timer Series Frequency&quot;,
                           choices = c(&quot;Week&quot;,
                                       &quot;Month&quot;,
                                       &quot;Year&quot;),
                           selected = &quot;Week&quot;,
                           inline = T),
              
              uiOutput(&quot;Time_Series_UI&quot;)
              ),
          mainPanel(
              leafletOutput(&quot;Time_Series_Map&quot;)),
      ))
      
  
  
  # Define server logic required to draw a histogram
  server = function(input, output) {
      
      # Render slider input depending on data frequency
      
      observe({
          # Create an xts object
          df_xts = xts(df, order.by = as.Date(df$Date))
          
          #All_Dates = unique(df$Start_Date)
          
          Filtered_Dates = df_xts[xts::endpoints(
              df_xts, on = input$Frequency)]
      
      output$Time_Series_UI = renderUI({
          sliderInput(&quot;Date&quot;, &quot;Date:&quot;,
                      min = min(Filtered_Dates),
                      max = max(Filtered_Dates),
                      value = min(Filtered_Dates),
                      step = 1,
                      timeFormat = &quot;%YYYY-%MM-%DD&quot;,
                      animate = T)
      })
      
      })
      
      # Filter data for the date selected
      Filtered_Data = reactive({
          req(input$Date)
          df[df$Date == input$Date]
      })
          
      
      # Create the leaflet map
      output$Time_Series_Map = renderLeaflet({
          leaflet(df) %&gt;% 
              addTiles() %&gt;% 
              setView(lat = 0, lng = 0, zoom = 2) 
      })
      
      # Create data markers for selected date
      observe({
          df$id = Filtered_Data()
          
          leafletProxy(&quot;Time_Series_Map&quot;, data = df) %&gt;%
              addCircleMarkers(lng = ~lon, lat = ~lat, 
                               popup = ~id)
      })     
      
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>