Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我安装的R Studio/Shining应用程序有一个(非常)简单的问题_R_Statistics_Data Visualization_Shiny - Fatal编程技术网

我安装的R Studio/Shining应用程序有一个(非常)简单的问题

我安装的R Studio/Shining应用程序有一个(非常)简单的问题,r,statistics,data-visualization,shiny,R,Statistics,Data Visualization,Shiny,我发现了一系列精彩的闪亮应用程序教程: 我正在试着运行第二个程序,应该可以看到数据中的绘图。相反,我得到的只是一个空白屏幕(仍然没有足够的堆栈溢出点来发布图像…) 我不明白,因为我的UI代码是: library(shiny) shinyUI(pageWithSidebar( # Application title headerPanel("Miles Per Gallon: Wednesday, 6 August"), # Sidebar with a slider input

我发现了一系列精彩的闪亮应用程序教程:

我正在试着运行第二个程序,应该可以看到数据中的绘图。相反,我得到的只是一个空白屏幕(仍然没有足够的堆栈溢出点来发布图像…)

我不明白,因为我的UI代码是:

library(shiny)

shinyUI(pageWithSidebar(

  # Application title
  headerPanel("Miles Per Gallon: Wednesday, 6 August"),

  # Sidebar with a slider input for number of observations
  sidebarPanel(
    selectInput("variable", "Variable:", 
                list("Cylinders" = "cyl", 
                     "Transmission" = "am", 
                     "Gears" = "gear")), 

    checkboxInput("outliers", "Show Outliers", FALSE)
  ),

  # Show a plot of the generated distribution
  mainPanel(
    h3(textOutput("caption")), 

    plotOutput("mpgPlot")
  )
))
…我的服务器代码是:

library(shiny)
library(datasets)

mpgData <- mtcars
mpgData$am <- factor(mpgData$am, labels = c("Automatic", "Manual"))

shinyServer(function(input, output) {

#Create the formula text as a "reactive" 
  formulaText <- reactive({
    paste("mpg ~", input$variable)
  })

#Print the formulaText as a caption 
  output$caption <-renderText({formulaText()})
#Plot the requested variable against the mpg 

output$mpgPlot <- renderPlot({
  boxplot(as.formula(formulaText())), 
  data = mpgData, 
  outline = input$outliers
})

})
库(闪亮)
图书馆(数据集)

mpgData好吧,好吧,我已经弄明白了这一点:这只是一条线。这是现在的“回答”

好吧,好吧,我已经弄明白了这个问题:只是在line:boxplot(as.formula…)中,我把数据和大纲的定义放在了第一组括号之外。这是一件多么令人沮丧的事情……你能回答你自己的问题并把它作为一个公认的答案吗?