相关疑难解决方法(0)

部署闪亮的应用程序时找不到数据对象

我正在处理我的第一个闪亮的应用程序,并且遇到了一个问题,即用于渲染我的数据表的数据没有被shinyapps.io接收.

该应用程序在我的控制台中运行良好,但是当我部署它时,应用程序在浏览器中打开并显示错误:找不到对象'Pitchers',其中'Pitchers'是我的数据对象之一.

我找到了一个建议说要将数据放在应用程序文件夹中的文件夹中,但仍然无法正常工作.

这是我当前的服务器.R代码:

shinyServer(function(input, output) {

  Pitchers <- read.csv("data/Pitchers_Edge.csv", header=TRUE, check.names = FALSE)
  Batters <- read.csv("data/Batters_Edge.csv", header=TRUE, check.names = FALSE)

  output$table1 <- renderDataTable({

    if (input$Year != "All"){
      Pitchers <- Pitchers[Pitchers$Year == input$Year,]
    } 
    Pitchers 
  })

  output$table2 <- renderDataTable({

    if (input$Year != "All"){
      Batters <- Batters[Batters$Year == input$Year,]
    } 
    Batters
  })

})
Run Code Online (Sandbox Code Playgroud)

这是ui.R代码:

shinyUI(fluidPage(
  titlePanel('Edge%: 2010-Present'),
    fluidRow(
      column(12,

                    p("Provides current and historical data on the percentage of pitches thrown to different parts of the strike zone by pitchers …
Run Code Online (Sandbox Code Playgroud)

r shiny

8
推荐指数
1
解决办法
1万
查看次数

处理程序错误$ add(处理程序,密钥,尾部):密钥/已经与Shiny一起使用

我尝试构建一个闪亮的应用程序.我想从头开始,因此开始非常基本.现在,当我试图运行我的应用程序时,起初它似乎工作,但立即应用程序冻结并出现此错误:

Error in handlers$add(handler, key, tail) : Key / already in use
Run Code Online (Sandbox Code Playgroud)

我认为我做错了,所以用闪亮的教程中的一个例子试了一下.但是,同样的错误.

这是我的文件:

ui.R

library(shiny)

# Define UI for application that draws a histogram
shinyUI(fluidPage(
  titlePanel("Test"),

  sidebarLayout(
     sidebarPanel("sidebar panel"),
  mainPanel("Data")
)
))
Run Code Online (Sandbox Code Playgroud)

server.R

setwd("/home/User")
library(shiny)

shinyServer(
function(input, output) {
})
Run Code Online (Sandbox Code Playgroud)

随着runApp("ws")我得到错误.

感谢任何帮助,thx.

r shiny

3
推荐指数
1
解决办法
4302
查看次数

标签 统计

r ×2

shiny ×2