微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在Localhost和Server上运行ShinyApp有什么区别吗?

如何解决在Localhost和Server上运行ShinyApp有什么区别吗?

我创建了一个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 举报,一经查实,本站将立刻删除。