R widgetFunc()警告消息,带有EventResponsive(警告1)和renderDataTable(警告2)
我正在编写一个闪亮的应用程序,它运行得非常好,突然我收到两条警告信息。我回到了以前运行良好的副本,它们现在显示的是相同的错误消息,所以我真的很困惑。我的代码仍然在运行,并在我闪亮的仪表板的“结果”选项卡上显示准确的结果,但我想跟踪警告消息。我调试后,第一个警告随rendDataTable一起消失,第二个警告在我单击仪表板上的选项卡时出现。数据是一个n X 10的数据帧,带有数字和字符。任何帮助都将不胜感激。如果我能提供更多的信息,请告诉我 以下是1:R widgetFunc()警告消息,带有EventResponsive(警告1)和renderDataTable(警告2),r,shiny,R,Shiny,我正在编写一个闪亮的应用程序,它运行得非常好,突然我收到两条警告信息。我回到了以前运行良好的副本,它们现在显示的是相同的错误消息,所以我真的很困惑。我的代码仍然在运行,并在我闪亮的仪表板的“结果”选项卡上显示准确的结果,但我想跟踪警告消息。我调试后,第一个警告随rendDataTable一起消失,第二个警告在我单击仪表板上的选项卡时出现。数据是一个n X 10的数据帧,带有数字和字符。任何帮助都将不胜感激。如果我能提供更多的信息,请告诉我 以下是1: Warning in widgetFunc(
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
以下是第二点:
Warning in widgetFunc() :
renderDataTable ignores ... arguments when expr yields a datatable object; see ?renderDataTable
tran_cd=c('I','E','R'))
数据源cd=c('1','2','3','4'))
图书馆(闪亮)
图书馆(shinydashboard)
图书馆(xlsx)
如果(!require(“DT”))安装.packages('DT')
sessionInfo()
图书馆(DT)
ui之所以出现此错误,是因为您返回了一个DT::datatable
,并且filter='top'
也被指定为的参数之一。当消息试图告诉您时,。
参数被忽略,因为您返回的是DT::datatable
。这是因为..
参数旨在传递给DT:datatable
构造函数
在DT::datatable
构造函数内移动filter='top'
,或者返回一个data.frame
,当DT::renderDataTable
使用指定的data.frame
构建一个DT::datatable
时,将使用filter='top
,只要运行代码,如果您提供了monitoringestion.R和list.csv文件,以便我可以玩弄它,那将是多么棒的事情啊,如果您不介意的话。@infiniteflashches谢谢您的回复。我将原来的MonitoringEstion函数替换为更简单的代码(见上文)。它只是加载了一个数据文件,我仍然得到相同的警告(1)。数据文件是一个nx7数据帧,包含数字和字符列。奇怪的是,我在保存服务器、ui和MonitoringEstion时有不同版本的服务器、ui和MonitoringEstion,所以我可以随时返回,即使是运行良好的旧版本也有相同的警告。我找不到它的确切产地。在shiny中很难调试。您最近是否升级了软件包?那么这可能是由于软件包更新导致的软件包之间不兼容,对此您可能无能为力(除非您想降级,或者您想等待软件包作者解决此问题)。警告消息来自DT
,但是由于DT
已经有一段时间没有更新了(仍然是0.1版本),我怀疑这是由更新版本的Shiny(与DT交互)引起的,或者可能是您安装了github版本的DT。但是如果你的结果是正确的,我会说忽略这个警告。
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