闪亮的应用程序:“错误:没有适用于'filter_'的方法应用于类”function“的对象”

时间:2017-08-30 15:34:05

标签: r syntax-error rstudio shiny

我正在尝试与shinyapps.io分享一个应用,但报告了以下错误:

  

错误:没有适用于'filter_'的方法应用于对象   “功能”一类。

当我发布我的应用时,错误报告。当我在R studio中运行de app时,不要报告任何错误

该应用程序位于以下代码中:

data<-read.csv("data3.csv", encoding = "UTF-8", sep = ";")
ui<-(fluidPage( theme = shinytheme("journal"), tags$head(
  tags$style(HTML("
      @import url('//fonts.googleapis.com/css?family=Lobster|Cabin:400,700');

      h1 {
        font-family: 'Lobster', cursive;
        font-weight: 500;
        line-height: 1.1;
        color: blue4;
      }

    "))
),

headerPanel("Ejecucion de los indicadores"),
    sidebarPanel(
    sliderInput("Ano", "Ano", min = 2012, max = 2016, value = 1), width=3),
  mainPanel(
    plotlyOutput(outputId = "p", height=550, width = 100)
  )
))


Server<-function(input, output) {

  output$p <- renderPlotly({ df_term <- data  %>% dplyr::filter(Ano %in% input$Ano)

  g<-ggplot(data = df_term, aes(x =Provincia , y = Indicador)) +
    geom_tile(aes(fill = Cumplio, text = txt), colour = 'white') +theme_classic()+
    theme(axis.text.x = element_text(angle = 90, family="Officina Serif ITC", size = 10), 
          axis.text.y = element_text(family="Officina Serif ITC", size = 10),
          legend.title = element_blank(),
          legend.text=element_text(family="Officina Serif ITC", size = 10),
           axis.title =element_text(colour="black", size = 12, family = "Officina Serif ITC", face = "bold"),
          legend.key.height = unit(10, "cm"), 
          legend.key.width  = unit(1, "cm"),legend.position="bottom")+

    scale_fill_manual(values = c("palegreen2","firebrick1","lightgoldenrod1") , na.value="cornsilk3",
                      breaks = c("No cumplio la meta",'Proximo a cumplir la meta','Cumplio la meta'))+ 

     labs(x = "", y="")  


  m <- list(
   l = 200,
   r = 80,
   b = 100,
   t = 100  )

  a<-ggplotly(g, tooltip = "text")%>%   layout(autosize = F, width = 1000, height = 600, margin = m)
  a  
  })
}

shinyApp(ui, Server)

我认为错误出现在以下代码行中:

Server<-function(input, output) {
        output$p <- renderPlotly({ df_term <- data  %>% dplyr::filter(Ano %in% input$Ano)

感谢您的帮助!

0 个答案:

没有答案