Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 使用x轴作为日期打印笔刷限制_R_Ggplot2_Shiny - Fatal编程技术网

R 使用x轴作为日期打印笔刷限制

R 使用x轴作为日期打印笔刷限制,r,ggplot2,shiny,R,Ggplot2,Shiny,我试图复制rstudio页面上提供的这个示例 问题是,我需要在x轴上使用日期(as.date%d/%m/%Y),在绘图上缩放时会出现此错误 无效输入:date_trans仅适用于类date的对象 库(ggplot2) 图书馆(比例尺) 图书馆(网格) 图书馆(DT) ui您好您需要将范围2$x转换为最新版本: output$plot2 <- renderPlot({ if (!is.null(ranges2$x)) { ranges2$x <- as.Date(rang

我试图复制rstudio页面上提供的这个示例

问题是,我需要在x轴上使用日期(
as.date%d/%m/%Y
),在绘图上缩放时会出现此错误

无效输入:date_trans仅适用于类date的对象

库(ggplot2)
图书馆(比例尺)
图书馆(网格)
图书馆(DT)

ui您好您需要将
范围2$x
转换为最新版本:

output$plot2 <- renderPlot({
  if (!is.null(ranges2$x)) {
    ranges2$x <- as.Date(ranges2$x, origin = "1970-01-01")
  }
  ggplot(articles, aes(Date, Sevdow)) +
    geom_point() +
    coord_cartesian(xlim = ranges2$x, ylim = ranges2$y)
})

@维克多克普。谢谢你的意见。我真的很感激。
output$plot2 <- renderPlot({
  if (!is.null(ranges2$x)) {
    ranges2$x <- as.Date(ranges2$x, origin = "1970-01-01")
  }
  ggplot(articles, aes(Date, Sevdow)) +
    geom_point() +
    coord_cartesian(xlim = ranges2$x, ylim = ranges2$y)
})
output$selected_rows <- renderDataTable({
  articles$Date <- as.numeric(articles$Date)
  nearPoints(articles, coordinfo = input$plot_click, xvar = "Date", yvar = "Sevdow", 
             threshold = 10, maxpoints = 1000,
             addDist = FALSE, allRows = FALSE)
})