不同时间段之间返回数据的R和Shiny结果不同
我有一个带有时间戳的数据集,number1,number2,。。等等。示例数据如下所示 14878088417378393242738373931,。。。。。1487808841,7378393242,7378373931,..... 14878088417378393245738373932 我需要构建一个闪亮的应用程序,它需要两个输入开始时间和结束时间,并返回范围之间的数据 我使用不同时间段之间返回数据的R和Shiny结果不同,r,shiny,R,Shiny,我有一个带有时间戳的数据集,number1,number2,。。等等。示例数据如下所示 14878088417378393242738373931,。。。。。1487808841,7378393242,7378373931,..... 14878088417378393245738373932 我需要构建一个闪亮的应用程序,它需要两个输入开始时间和结束时间,并返回范围之间的数据 我使用 数据$TimeStampas.POSIXct()与as.POSIXlt()不同。保持两种模式的一致。帕菲特,我
数据$TimeStamp
as.POSIXct()
与as.POSIXlt()
不同。保持两种模式的一致。帕菲特,我试过了。。但是结果还是一样的。你的猜测和我们的一样好!从我们的角度来看,我们看不出您的数据是如何或从何而来的。在两侧进行筛选之前,运行nrow()
,ncol()
,str()
,summary()
,查看它们是否匹配。
ui <- fluidPage(
title = 'Enter the start Time and End Time',
div( id = "eg3",
fluidRow(
column(width = 11, offset = 1,
h4('Enter the start Time and End Time'),
sliderInput("starttime", "Date & Time:",
min=as.POSIXlt("2017-02-23 00:00:00", "GMT"),
max=as.POSIXlt("2017-02-24 23:59:59", "GMT"),
value=as.POSIXlt("2010-01-01 00:00:00", "GMT"),
timezone = "GMT"),
sliderInput("endtime", "Date & Time:",
min=as.POSIXlt("2017-02-23 00:00:00", "GMT"),
max=as.POSIXlt("2017-02-24 23:59:59", "GMT"),
value=as.POSIXlt("2010-01-01 00:00:00", "GMT"),
timezone = "GMT"),
dataTableOutput("output_slider2")
)
)
)
)
server <- function(input, output, session) {
output$output_slider2 <- renderDataTable({
filtered<-cdr1[cdr1$TimeStamp>=input$starttime & cdr1$TimeStamp<=input$endtime,]
filtered[,1]<-as.character(filtered[,1])
datatable(filtered)
})
}
shinyApp(ui = ui,server = server)
data[data$TimeStamp>="2017-02-23 01:00:00" & data$TimeStamp<="2017-02-23 18:00:00",]