闪亮的编程错误:警告:sourceUTF8中的错误:堆栈跟踪(最里面的第一个):

闪亮的编程错误:警告:sourceUTF8中的错误:堆栈跟踪(最里面的第一个):,r,shiny,probability,R,Shiny,Probability,我正在编写一个逻辑回归应用程序,其中包含几个条件面板,根据用户选择的提示显示结果概率。。。但是,当我运行应用程序时,页面不会加载,并且会出现如下错误: 侦听解析中的错误(文件,keep.source= FALSE,srcfile=src,encoding=enc)输入的意外结束172:) 173: ^警告:sourceUTF8中出错:错误来源C:\Users堆栈跟踪(最内层优先): 1:runApp 我应该在server.R中使用开关盒吗?谢谢 UI.R pageWithSid

我正在编写一个逻辑回归应用程序,其中包含几个条件面板,根据用户选择的提示显示结果概率。。。但是,当我运行应用程序时,页面不会加载,并且会出现如下错误:

侦听解析中的错误(文件,keep.source= FALSE,srcfile=src,encoding=enc)输入的意外结束172:) 173: ^警告:sourceUTF8中出错:错误来源C:\Users堆栈跟踪(最内层优先): 1:runApp

我应该在server.R中使用开关盒吗?谢谢

    UI.R
    pageWithSidebar(

    # Application title
    headerPanel("Steadylosing NBA Probability Set (5200+ Observations)"),


        # Sidebar with conditional slider inputs 
        sidebarLayout(
    sidebarPanel(
      selectInput(
        "Occur",
        "Pick One Outcome to Predict:",
        choices = c(
          "TeamAWin",
          "BothTeamsAllow110+"
        )
      ),
      conditionalPanel(
        condition = "input.Occur == 'TeamAWin",
        sliderInput("aoff", "A's Offensive Rating", 90, 125, 100, .1),
        sliderInput("adef", "A's Defensive Rating", 90, 125, 100, .1),
        sliderInput("boff", "B's Offensive Rating", 90, 125, 100, .1),
        sliderInput("bdef", "B's Defensive Rating", 90, 125, 100, .1),
        selectInput("homecourt", "Homecourt, Yes or No?", choices = c(0, 1))
      ),
      conditionalPanel(
        condition = "input.Occur == 'BothTeamsAllow110+",
        sliderInput("aoff2", "A's Offensive Rating", 90, 125, 100, .1),
        sliderInput("adef2", "A's Defensive Rating", 90, 125, 100, .1),
        sliderInput("boff2", "B's Offensive Rating", 90, 125, 100, .1),
        sliderInput("bdef2", "B's Defensive Rating", 90, 125, 100, .1),
        selectInput("ot2", "Overtime, Yes or No?", choices = c(0, 1)),
        sliderInput("combpace2", "Combined Pace of the Two Teams", 170, 220,     200, .1)
      )

    ),

    # Show prediction values
      mainPanel(

      h2(textOutput("Prediction1")),

      h2(textOutput("Prediction2"))
  )




Server.R 
        shinyServer(function(input, output, session) {
  sliderValues <- reactive({

    # Compose data frame
    data.frame(
      Name = c("aoff", #TeamAoffrtg
               "adef", #TeamAdefrtg
               "boff", #TeamBoffrtg
               "bdef", #TeamBdefrtg
               "homecourt",
               "aoff2", #TeamAoffrtg
               "adef2", #TeamAdefrtg
               "boff2", #TeamBoffrtg
               "bdef2", #TeamBdefrtg
               "ot2", #Overtime
               "combpace2"),

      Value = as.double(c(input$aoff,
                          input$adef,
                          input$boff,
                          input$bdef,
                          input$homecourt,input$aoff2,
                          input$adef2,
                          input$boff2,
                          input$bdef2,
                          input$ot2,
                          input$combpace2)),
      stringsAsFactors=FALSE)

  } )

  function1 <- function(aoff,adef,boff,bdef,homecourt) {
    100*((exp(-1.9418+.1572*aoff-.144*adef-.139*boff+.1414*bdef+.4341*homecourt))/(1+exp(-1.9418+.1572*aoff-.144*adef-.139*boff+.1414*bdef+.4341*homecourt)))
  }
  function2 <- function(aoff2,adef,boff,bdef,ot2,combpace2) {
    100*((exp(-74.6058-.0788*aoff2+.0874*adef+.0795*boff-.09166*bdef+2.8053*ot2+.1897*combpace2))/(1+exp(-74.6058-.0788*aoff2+.0874*adef+.0795*boff-.09166*bdef+2.8053*ot2+.1897*combpace2)))
  }
  output$Prediction1 <- renderText({
    predtype <- input$Occur
    if (predtype == "TeamAWin"){
    c(round(function1((input$aoff),(input$adef),(input$boff),(input$bdef),(input$homecourt)),4),"%")

    }
    })
  output$Prediction2 <- renderText({  predtype <- input$Occur
    if (predtype == "BothTeamsAllow110+"){
    c(round(function2(input$aoff2, input$adef2,input$boff2,input$bdef2,input$ot2,input$combpace2),4),"%")

    }
  })

  else {
 return()
   }

}
)
UI.R
带边框的页面(
#申请名称
headerPanel(“稳定NBA概率集(5200+观察)”,
#带有条件滑块输入的边栏
侧边栏布局(
侧栏面板(
选择输入(
“发生”,
“选择一个结果进行预测:”,
选项=c(
“TeamAWin”,
“两个团队都支持110+”
)
),
条件板(
condition=“input.occure==”TeamAWin”,
sliderInput(“aoff”,“A的攻击等级”,90125100.1),
sliderInput(“adef”,“A的防守等级”,90125100.1),
滑音输入(“波夫”,“B的进攻等级”,90125100.1),
幻灯片(“bdef”,“B的防御等级”,90125100.1),
选择输入(“homecourt”、“homecourt,是或否?”,选项=c(0,1))
),
条件板(
condition=“input.Occurse=”BothTeamsAllow110+”,
sliderInput(“aoff2”,“A的攻击等级”,90125100.1),
sliderInput(“adef2”,“A的防御等级”,90125100.1),
sliderInput(“boff2”,“B的攻击等级”,90125100.1),
滑块输入(“bdef2”,“B的防御等级”,90125100.1),
选择输入(“ot2”,“加班,是还是否?”,选择=c(0,1)),
sliderInput(“ComPace2”,“两支球队的组合节奏”,170、220、200、.1)
)
),
#显示预测值
主面板(
h2(文本输出(“预测1”),
h2(文本输出(“预测2”))
)
服务器.R
shinyServer(功能(输入、输出、会话){

sliderValues该错误意味着您的代码中缺少一个右括号啊,谢谢。相反,它变成了一个(参数“Main Panel”缺少,没有默认错误),尽管我在UI中有一个主面板。当我最终发现我有一个奇怪的字符(西班牙语)时,我也遇到了类似的错误事实上。我再也没有收到这个错误了,删除了那个字符!这个错误意味着你的代码中缺少了一个右括号啊,谢谢。相反,它变成了一个(参数“Main Panel”丢失了,没有默认错误),尽管我在UI中有一个主面板。当我最终发现我有一个奇怪的字符时,我收到了一个类似的错误(西班牙语)真的。我不再犯这个错误了,删除了那个字符!