0
[我試圖引用應用程序用戶輸入多個日期範圍。但是,日期範圍輸入的數量可能每次都不相同。例如,這次我有3個時間段,下一次我可能有17個時間段來抓。我應該如何編寫代碼的結束日期,以具有R自動抓取的最後日期範圍輸入?]以R的最後日期範圍輸入Shiny
ui <-fluidPage(
dateRangeInput('dateRange1', label = 'period1', start = '', end = '' ),
dateRangeInput('dateRange2', label = 'period2', start = '', end = '' ),
dateRangeInput('dateRange3', label = 'period3', start = '', end = '' ),
dateRangeInput('dateRange4', label = 'period4', start = '', end = '' ),
dateRangeInput('dateRange5', label = 'period5', start = '', end = '' ),
dateRangeInput('dateRange6', label = 'period6', start = '', end = '' ),
dateRangeInput('dateRange7', label = 'period7', start = '', end = '' ),
dateRangeInput('dateRange8', label = 'period8', start = '', end = '' ),
dateRangeInput('dateRange9', label = 'period9', start = '', end = '' ),
dateRangeInput('dateRange10', label = 'period10', start = '', end = '' ),
dateRangeInput('dateRange11', label = 'period11', start = '', end = '' ),
dateRangeInput('dateRange12', label = 'period12', start = '', end = '' ),
dateRangeInput('dateRange13', label = 'period13', start = '', end = '' ),
dateRangeInput('dateRange14', label = 'period14', start = '', end = '' ),
dateRangeInput('dateRange15', label = 'period15', start = '', end = '' ),
dateRangeInput('dateRange16', label = 'period16', start = '', end = '' ),
dateRangeInput('dateRange17', label = 'period17', start = '', end = '' ),
dateRangeInput('dateRange18', label = 'period18', start = '', end = '' ),
dateRangeInput('dateRange19', label = 'period19', start = '', end = '' ),
dateRangeInput('dateRange20', label = 'period20', start = '', end = '' ),
actionButton("submit", "Submit")
)
server <- function(input, output, session) {
observeEvent(input$submit, {
startDate = input$dateRange1[1]
endDate = ???
})
}
我也喜歡你的答案,因爲你太棒了,你花時間去解決別人的問題。感謝 – nik
非常感謝,但這是不必要的。 –