【问题标题】:shiny ui.r code is not working闪亮的 ui.r 代码不起作用
【发布时间】:2017-08-25 07:58:04
【问题描述】:

这是我的 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)))

                  )
    )


    )

  )

【问题讨论】:

  • 请花时间阅读如何格式化您的问题。还要指定您甚至想要实现的目标以及无法实现的目标。

标签: r shiny


【解决方案1】:

您的代码非常混乱,有很多打开和未关闭的括号,没有逗号,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)

您应该更清楚地说明您想要检查您的代码格式!请注意clear Question的未来!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-10
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-02
    • 1970-01-01
    相关资源
    最近更新 更多