简体   繁体   English

R Shiny 产生空输出

[英]R Shiny Produces Empty Outputs

I am following the examples from this website here on R shiny: https://mastering-shiny.org/action-graphics.html I am following the examples from this website here on R shiny: https://mastering-shiny.org/action-graphics.html

I copied and pasted the following code from the website:我从网站上复制并粘贴了以下代码:

library(shiny)
ui <- fluidPage(
  sliderInput("height", "height", min = 100, max = 500, value = 250),
  sliderInput("width", "width", min = 100, max = 500, value = 250),
  plotOutput("plot", width = 250, height = 250)
)
server <- function(input, output, session) {
  output$plot <- renderPlot(
    width = function() input$width,
    height = function() input$height,
    res = 96,
    {
      plot(rnorm(20), rnorm(20))
    }
  )
}

But this produces no output at all.但这根本不会产生 output。

According to the website, this should produce a similar output:根据网站,这应该会产生类似的 output:

在此处输入图像描述 But the code I ran produces no output at all.但是我运行的代码根本没有产生 output 。

Can someone please show me what I am doing wrong?有人可以告诉我我做错了什么吗?

Thanks谢谢

We need to execute the ui, server in shinyApp我们需要在shinyApp中执行ui、server

shinyApp(ui = ui, server = server)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM