闪亮的ui.r代码不起作用

时间:2017-03-31 06:37:11

标签: r shiny

这是我的ui.r代码 - 它不起作用。请帮帮我。

library(shiny)
library(plotly)
shinyUI(fluidPage(
  titlePanel("Coronary Heart Disease"),
  sidebarLayout(
    sidebarPanel(
      sliderInput("slider 1","age",15,65,42.82),
      sliderInput("slider 2","trestbps",145,170,120),
      radioButtons("radio", label = h2("radio buttons"),
                   choices = list("choices 1"= male, "choice 2"=female),
                   selected = male),
      hr(),
      fluidRow(column(2,verbatimTextOutput(value)))
    ),
      sliderInput("slider 4","cholestrol",342,177,266),
      sliderInput("slider 5","fbs",0,1,1)
    ),
    mainPanel(
      tabsetPanel(type="tabs",
                  tabsetPanel("instruction",
                              p(""),
p("this web application will calculate the chances of coronary heart disease in a person based on five variables"),
p("just change the five slider value and see the probability value changes correspondingly")


                              ),
tabPanel("probability of having coronary heart disease (%)",h1(textOutput(pred1)))

                  )
    )


    )

  )

1 个答案:

答案 0 :(得分:0)

您的代码非常混乱,有许多括号,这些括号是开放的,未关闭,没有逗号,radioButtons中的选项格式错误等等......

这是我用你提供的内容创建的smthg:

library(shiny)


ui= fluidPage(
  titlePanel("Coronary Heart Disease"),
  sidebarLayout(
    sidebarPanel(
      sliderInput("slider 1","age",15,65,42.82),
      sliderInput("slider 2","trestbps",145,170,120),
      radioButtons("radio", label = h2("radio buttons"),
                   choices = list("choices 1"= "male", "choice 2"="female"),
                   selected = "male"),
      hr(),
    verbatimTextOutput("value"),
    sliderInput("slider 4","cholestrol",342,177,266),
    sliderInput("slider 5","fbs",0,1,1)),
  mainPanel(
    tabsetPanel(type="tabs",
                tabsetPanel("instruction",
                            p(""),
                            p("this web application will calculate the chances of coronary heart disease in a person based on five variables"),
                            p("just change the five slider value and see the probability value changes correspondingly")


                ),
                tabPanel("probability of having coronary heart disease (%)",textOutput("pred1"))

    )
  ))


)

server= function(input, output,session) {}

shinyApp(ui, server)

您应该更清楚地说明您想要的是检查您的代码格式!请关注明确问题

的未来