问题描述
我创建了一个运行良好的闪亮应用程序,但是当我尝试将其部署到shinyapps.io时,出现以下错误。 Error in value[[3L]](cond) : object 'all2' not found
。为什么找不到all2
?我的原始文件是一个excel文件,已存储在我的工作目录中并上传到rstudio中
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(visNetwork)
library(shinyWidgets)
library(igraph)
shinyApp(
ui = dashboardPagePlus(
header = dashboardHeaderPlus(title = "Network Viz."
),sidebar = dashboardSidebar(
pickerInput(
inputId = "ctype",label = "Select Country",choices = unique(all2$Country),selected = unique(all2$Country)[1],multiple = T,options = list(`actions-box` = TRUE)
),uiOutput("lang"),uiOutput("top")
),body = dashboardBody(#This hides the temporary warning messages while the plots are being created
tags$style(type="text/css",".shiny-output-error { visibility: hidden; }",".shiny-output-error:before { visibility: hidden; }"
),visNetworkOutput("network")
)
),server = function(input,output) {
ID<-c(1,2,3,4)
Name<-c("j","dd","ff","fcf")
Language<-c("en","fr","gr","gh")
Country<-c("EN","FR","GR","GRE")
Topic<-c("sc","sc","ghgf","vb")
Follow<-c(34,56,76,76)
Social<-c("Facebook","Facebook","Twitter","Twitter")
all2<-data.frame(ID,Name,Language,Country,Topic,Follow,Social)
dtnew<-reactive({
new<-subset(all2,Country %in% input$ctype)
})
output$lang<-renderUI({
pickerInput(
inputId = "l1",label = "Select Language",choices = unique(dtnew()$Language),multiple = TRUE,selected = unique(dtnew()$Language)[1],options = list(`actions-box` = TRUE)
)
})
output$top<-renderUI({
pickerInput(
inputId = "t1",label = "Select Topic",choices = unique(dtnew()$Topic),selected = unique(dtnew()$Topic)[1],options = list(`actions-box` = TRUE)
)
})
dtnew2<-reactive({
new2<-subset(all2,Country %in% input$ctype&Language%in% input$l1&Topic%in% input$t1)
})
output$network <- renderVisNetwork({
nodes<-dtnew2()
nodes<-nodes[,-c(3,4)]
nodes<-nodes[,-4]
colnames(nodes)<-c("id","label","group","Platform")
nodes$value<-nodes$id
id<-c(nrow(nodes)+1,nrow(nodes)+2)
label<-unique(nodes$Platform)
group<-c("Social","Social")
Platform<-unique(nodes$Platform)
value<-c(nrow(nodes)+1,nrow(nodes)+2)
ft<-data.frame(id,label,group,Platform,value)
nodes<-rbind(nodes,ft)
nodes<-nodes[!duplicated(nodes[2]),]
nodes<-nodes[,-4]
nodes$id <- nodes$label
nodes$value <- seq.int(nrow(nodes))
nodes$title<-paste0("<p>","Name:",nodes$label,"<br>","Group:",nodes$group,"</p>")
edges<-dtnew2()
edges<-edges[,c(2,6,7)]
colnames(edges)<-c("from","value","to")
edges$title<-edges$value
visNetwork(nodes,edges,height = "500px",width = "100%") %>%
visOptions(highlightNearest = list(enabled = T,hover = T),nodesIdSelection = T) %>%
visLayout(randomSeed = 123)%>%
visInteraction(navigationButtons = TRUE)%>%
visIgraphLayout()
})
}
)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)