问题描述
我创建了一个shniy应用程序,该应用程序允许用户使用一些功能来操作数据,更改某些值,重命名列并从上传的数据中绘制传单地图,从而上传excel文件并进行预处理,该应用程序在使用Rstudio运行时效果很好在localhost上,但是当我在Rstudio服务器上运行该按钮时,服务器上弹出按钮clean Asia data和其他操作按钮的上传文件屏幕,而不是在客户端屏幕上弹出我不明白为什么的弹出窗口?闪亮的代码如下
library(shiny)
library(readxl)
library(leaflet)
library(mongolite)
#runApp(host="0.0.0.0",port=5050)
options(shiny.maxRequestSize = 30*1024^2)
runApp(host="0.0.0.0",port=5050,list(
ui = fluidPage(
titlePanel("Upload Excel File"),sidebarLayout(
sidebarPanel(
fileInput('file1','Choose file',accept = c(".xlsx"),),actionButton("cleana","Clean Asia Data",style="color: #fff; background-color: #12e64e; border-color: #12e64e ;
border-radius: 10px; border-width: 2px"),actionButton("mapa","Show Asia Map",style="color: #fff; background-color: #e95420; border-color: #c34113;
border-radius: 10px; border-width: 2px"),actionButton("reporta","Print Asia Report",downloadButton("downloadData","Download"),actionButton("cleank","Clean Korek Data",actionButton("mapk","Show Korek Map",actionButton("reportk","Print Korek Report",actionButton("cleanz","Clean Zain Data",actionButton("mapz","Show Zain Map",actionButton("reportz","Print Zain Report",mainPanel(
tableOutput('contents'),leafletoutput("mymap")),server = function(input,output,session){
output$contents <- renderTable({
inFile <- input$file1
if(is.null(inFile))
return(NULL)
file.rename(inFile$datapath,paste(inFile$datapath,".xlsx",sep=""))
read_excel(paste(inFile$datapath,sep=""),1)
})
observeEvent(input$cleana,{
output$contents <- renderTable({inFile <- asia()})
})
observeEvent(input$mapa,{
amapdat <- read_excel(file.choose())
amapdat <- data.frame(amapdat)
amapdat$LON <- as.numeric(amapdat$LON)
amapdat$LAT <- as.numeric(amapdat$LAT)
output$mymap <- renderLeaflet(leaflet(amapdat)
%>%
addTiles() %>%
addMarkers(lng = ~LON,lat = ~LAT,popup = ~amapdat))
})
observeEvent(input$cleank,{
output$contents <- renderTable({inFile <- korek()})
})
observeEvent(input$mapk,{
kmapdat <- read_excel(file.choose())
kmapdat <- data.frame(kmapdat)
kmapdat$LONGITUDE <- as.numeric(kmapdat$LONGITUDE)
kmapdat$LATITUDE <- as.numeric(kmapdat$LATITUDE)
output$mymap <- renderLeaflet(leaflet(kmapdat)
%>%
addTiles() %>%
addMarkers(lng = ~LONGITUDE,lat = ~LATITUDE,popup = ~kmapdat))
})
observeEvent(input$cleanz,{
output$contents <- renderTable({inFile <- zain()})
})
observeEvent(input$mapz,{
zmapdat <- read_excel(file.choose())
zmapdat <- data.frame(zmapdat)
zmapdat$Calling.Longitude <- as.numeric(zmapdat$Calling.Longitude)
zmapdat$Calling.Latitude <- as.numeric(zmapdat$Calling.Latitude)
output$mymap <- renderLeaflet(leaflet(zmapdat)
%>%
addTiles() %>%
addMarkers(lng = ~Calling.Longitude,lat = ~Calling.Latitude,popup = ~zmapdat))
})
observeEvent(input$reportz,{
output$contents <- renderTable({inFile <- zain()})
})
}
)
) ```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)