6

I'm writing a shiny app and it was working perfectly fine and all of a sudden I am getting two warning messages. I have gone back to previous copies that ran fine and they are now showing the same error messages, so I am really confused.My code still runs and shows accurate results on the results tab of my shiny dashboard, but I want to track down the warning messages. I debug and the first warning goes away with the rendDataTable and the second warning comes up when I click a tab on my dashboard. The data is a data frame n X 10 with numeric and characters. Any help would be greatly appreciated. If I can provide any more info, just let me know.

Here's 1:

Warning in widgetFunc() :
  renderDataTable ignores ... arguments when expr yields a datatable object; see ?renderDataTable
Warning: Error in cat: argument 1 (type 'environment') cannot be handled by 'cat'
Stack trace (innermost first):
    74: cat
    73: eval
    72: eval
    71: withVisible
    70: evalVis
    69: utils::capture.output
    68: paste
    67: output$ntext1
     1: shiny::runApp

Here's 2:

Warning in widgetFunc() :
  renderDataTable ignores ... arguments when expr yields a datatable object; see ?renderDataTable
tran_cd=c('I','E','R')
data_source_cd=c('1','2','3','4')
library(shiny)
library(shinydashboard)
library(xlsx)
if (!require("DT")) install.packages('DT')
sessionInfo()
library(DT)
ui <- dashboardPage(
  dashboardHeader(title = "ARC"),
  dashboardSidebar(sidebarMenu(
    menuItem("Settings", tabName = "settings", icon = icon("th")),
    menuItem("Results Table", tabName = "ResultsTable", icon = icon("ResultsTable")))),
  dashboardBody(
    tabItems(tabName = "ResultsTable",
              fluidPage(  
                headerPanel(
                  h1("Anomaly List", align="center",  style = "font-family: 'Verdana';font-weight: 800; line-height: 1.1;   color: #151515;")),
                # fluidRow(
                #     column(8, DT::dataTableOutput("table",width = "100%"),offset = 2)))),
                #                 # Create a new Row in the UI for selectInputs
                fluidRow(

                  column(4,
                         selectInput("sour",
                                     "Source Type:",
                                     c("All",
                                       unique(as.character(data_source_cd))))
                  ),
                  column(4,
                         selectInput("sour1",
                                     "Source Type:",
                                     c("All",
                                       unique(as.character(data_source_cd))))
                  ),
                  column(4,
                         selectInput("tran",
                                     "Transaction Type:",
                                     c("All",
                                       unique(as.character(tran_cd)))))),
                # Create a new row for the table.
                fluidRow(column(8, DT::dataTableOutput("table",width = "100%"),offset = 2))))
)))




library(shiny)
library(chron)
library(forecast)
library(ggplot2)
#names(iris) = gsub("\\.", "", names(iris))
setwd("C:/Users/Name/Documents/Projects/TrendAnalysis/Data")
source("C:/Users/Documents/Projects/TrendAnalysis/Rcode/App-1/MonitoringIngestion.R")
df=read.csv('list.csv',header=TRUE, stringsAsFactors = FALSE)
df=unique(df[,1:3])
dfrn=df[,2];
rownames(df)=make.names(dfrn, unique=TRUE)
shinyServer(function(input, output, session) {
  rv <- reactiveValues()
  rv$data <- NULL

  ntext1 <- eventReactive(input$gobutton,{
    if (input$dateRange[2]<input$dateRange[1]){print("You selected the date range option;however, the end date entered occurs before the starting date")}
    else{
      output$ntext1 <- renderText({print("Analysis Complete...Data Loading...")});
      observe({    ## will 'observe' the button press
        if(input$gobutton){ 
          print("here")  ## for debugging
          Singledate=input$date;
          Daterange=input$dateRange;
          Alldata=input$checkbox;
          SourceSelect=input$checkGroup1;
          TranSelect=input$checkGroup2;
          AirlineSelect=input$x3_rows_selected;
          Mag_level=input$slider1;
          rv$data <- MonitoringDDSIngestion(Alldata,Singledate,Daterange,SourceSelect,TranSelect,AirlineSelect,Mag_level)   ## store the data in the reactive value
        }
      })
    }
  }) 

  output$table <- DT::renderDataTable(DT::datatable({
     data <- rv$data
    if (input$sour != "All") {
      data <- data[data[,1] == input$sour,]
    }else{data}
     if (input$sour1 != "All") {
       data <-data[data[,2] == input$sour1,]
     }else{data}

     if (input$tran != "All") {
       data <-data[data[,3] == input$tran,]
     }else{data}

  }), filter='top')
})


MonitoringIngestion2 <-function(All,date1,date2, source_cd,tran_cd,airline_list,mag_level) {
    print(All); print(date1); print(date2); print(source_cd);print(tran_cd);print(airline_list);print(mag_level)
    setwd("C:Documents/Projects//Data")
    data = read.csv("November2015_December2015.csv",header=TRUE,sep=",",colClasses="factor")
  }
data  
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Tracy
  • 699
  • 2
  • 9
  • 21
  • 2
    Just ran your code, and what would be awesome if you provided the MonitoringIngestion.R and list.csv file so that I can toy around with it, if youre alright with that. – InfiniteFlash Mar 19 '16 at 06:21
  • @ InfiniteFlashChess thank you for your response. I replaced the original MonitoringIngestion function with something simpler to see if it was that code (see above). It just loads a data file and I still get the same warning (1). The data file is a nx7 data frame with numeric and character columns. The strange thing is I have different versions of server, ui, and monitoringingestion as I save them as I go along so I could always go back and even the old version that worked perfectly fine have the same warning. I can't track down exactly where it is produced. Hard to debug in shiny. – Tracy Mar 19 '16 at 11:51
  • 1
    Did you by any chance upgrade your packages recently? – Xiongbing Jin Mar 19 '16 at 15:52
  • yes @warmoverflow I did! – Tracy Mar 19 '16 at 16:31
  • 1
    Then this is likely a incompatibility between packages caused by package updates, which you probably can do nothing about (unless either you want to downgrade, or you want to wait for it to be resolved by the package authors) – Xiongbing Jin Mar 19 '16 at 16:41
  • @warmoverflow this makes sense because all my other script versions weren't working either, so was hard to believe it was the code. Do you have any idea from the packages I load at the top of the script, which it could be? Also, when I upgrade some, others that are related get updated too. Is there anyway for me to track it down? I have no problem downgrading. – Tracy Mar 19 '16 at 16:59
  • 2
    The warning message is from `DT`, but since `DT` hasn't been updated for a while (still 0.1 release), I suspect it is caused by a newer version of Shiny (which interacts with DT), or maybe you have installed a github version of DT. But if your result is correct, I would say just ignore the warning. – Xiongbing Jin Mar 19 '16 at 17:22
  • It's not uncommon for changes in packages to cause unexpected errors. RStudio launched PackRat for situations like this. It might be helpful for you in the future. https://rstudio.github.io/packrat/ – Andrew Brēza Dec 21 '16 at 14:42

1 Answers1

11

You are getting this error because you are returning a DT::datatable AND you are also specifying filter='top' as one of the ... arguments to DT::renderDataTable. As the message is trying to tell you ... arguments are ignored since you are returning a DT::datatable. This is because the ... arguments are intended to be passed through to the DT:datatable constructor.

Either move filter='top' inside the DT::datatable constructor or return a data.frame and the filter='top will be used when DT::renderDataTable constructs a DT::datatable with your specified data.frame.

PeterVermont
  • 1,922
  • 23
  • 18