In a Shiny app, after user uploads data df() and choosing a particular column stored in input$var_time, I would like it to automatically 'detect' what day of the week the weekly data is in for the Shiny UI element ID var_base_day.
observe({
updateNumericInput(session,
'var_base_day',
value = wday(ymd(df()[[input$var_time]][1])))
})
I would like to get 0 as the selected value for that particular numericInput Shiny element if wday() returns 0. What are some of the variations I can try to above code?