Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.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 打印意外错误_R_Ggplot2_Shiny - Fatal编程技术网

R 打印意外错误

R 打印意外错误,r,ggplot2,shiny,R,Ggplot2,Shiny,我试图在Shining中创建一个ggplot,它响应与日期相关的用户定义输入。这似乎是一个直截了当的问题,也是我以前成功解决过的问题 在这个问题中,我有用户选择的数据帧气象年中的MODIS值。每16个日历日是一个不同的MODIS值(例如,1月1-16日=1,1月17日-2月1日=2,等等)。这将以类似于我的闪亮应用程序的另一个窗口中显示的卫星图像的时间增量显示天气数据 如果我在R中使用下面的代码(根据需要进行调整),并改变MODIS值,那么图形将非常完美 output$weather <-

我试图在Shining中创建一个ggplot,它响应与日期相关的用户定义输入。这似乎是一个直截了当的问题,也是我以前成功解决过的问题

在这个问题中,我有用户选择的数据帧气象年中的MODIS值。每16个日历日是一个不同的MODIS值(例如,1月1-16日=1,1月17日-2月1日=2,等等)。这将以类似于我的闪亮应用程序的另一个窗口中显示的卫星图像的时间增量显示天气数据

如果我在R中使用下面的代码(根据需要进行调整),并改变MODIS值,那么图形将非常完美

output$weather <- renderPlot({
  weatherData <- filter(weatherYear, weatherYear$MODIS <= input$index)
  ggplot(weatherData, aes(x=DOY), order = DOY) +
    geom_ribbon(aes(ymin = TempMin, ymax = TempMax), alpha = 0.3, fill = "indianred2") +
    geom_line(aes(y = TempAvg), color = "black") +
    geom_bar(aes(y = Precip*20), stat = "identity", color = "blue") +
    labs(y = "Mean Daily Temperature (F)", x = "Month") +
    coord_cartesian(ylim = c(-5,105), xlim = c(1, 365)) +
    scale_y_continuous(sec.axis = sec_axis(~./20, name="Precipitation (in)")) +
    scale_x_continuous(expand = c(0, 0),
      breaks = c(15,45,75,105,135,165,195,228,258,288,320,350),
     labels = c("J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"))

output$weather可能重复或相关帖子:在这种情况下没有换行或丢失数据。从第一个索引期(DOY 1-16)更改到第二个索引期(DOY 16-32)时,只引入了一个较大的间隙.可能重复或相关帖子:本例中没有换行或数据丢失。从第一个索引期(DOY 1-16)更改到第二个索引期(DOY 16-32)时,只引入了较大的间隙。