本文介绍了R:Shiny dateRangeInput格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用R的闪存包,我在我的 ui.R中实现了一个dateRangeInput:

I am using the packet shiny for R and I implemented a dateRangeInput in my ui.R:

   dateRangeInput("date", "Date range:",
                       start  = "2013-05-15",
                       end    = "2013-10-01",
                       min    = "2013-05-15",
                       max    = "2013-10-01",
                       format = "dd/mm/yy",
                       separator = " - ")

如果我显示所选的最小和最大值,我会得到以下(奇怪的)输出:

If I display the selected min and max values, i get the following (weird) output:

最小日期值

renderText({(input$date[1])})

输出:

 15840

最大日期值: strong>

Max date value:

renderText({(input$date[2])})

输出:

15979

为什么在输出中得到这些数字,而不是从ui.R本身中选出这些数字:2013-05-15和2013-10-01?而且如何将其转换成这样的格式? as.Date不起作用。

Why do I get these numbers in the output and not the selected ate from the ui.R itself: 2013-05-15 and 2013-10-01 ? And how can I transform it to such a format? as.Date does not work.

推荐答案

实际值是从unix纪元开始的天数,使用格式(输入$ date [1])

The actual value is days since the unix epoch, use format(input$date[1]).

这篇关于R:Shiny dateRangeInput格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 21:36
查看更多