我想在我的应用程序中添加如下内容:
的数据是否有现成可用的输入,或者我必须对其进行编程?最好的祝愿。
2izufjch1#
shiny中没有相对日期输入你可以使用numericInput来指定你想要返回多少天、多少月或多少年。例如
shiny
numericInput
numericInput("relativedate","Select days back",value = 30, min = 1) data <- reactive(data %>% filter(Date >= max(data$Date) - input$relativedate & Date <= max(data$Date)) %>% group_by(col1) %>% summarize(count = n(),mean = mean(col1)
字符串同样,对于月份和年份,您可以使用lubridate . Read more here
lubridate
library(lubridate) numericInput("relativedate","Select months back",value = 2, min = 1) data <- reactive(data %>% filter(Date >= max(data$Date) %m-% months(input$relativedate) & Date <= max(data$Date)) %>% group_by(col1) %>% summarize(count = n(),mean = mean(col1) numericInput("relativedate","Select years back",value = 5, min = 1) data <- reactive(data %>% filter(Date >= max(data$Date) - years(input$relativedate) & Date <= max(data$Date)) %>% group_by(col1) %>% summarize(count = n(),mean = mean(col1)
型
1条答案
按热度按时间2izufjch1#
shiny
中没有相对日期输入你可以使用
numericInput
来指定你想要返回多少天、多少月或多少年。例如
字符串
同样,对于月份和年份,您可以使用
lubridate
. Read more here型