您好,我想做的是绘制数据的指数最佳拟合曲线。我正在尝试制作我的第一个闪亮应用程序,其中包含多个垃圾箱的滑块输入以获取起始值。但是,当我运行代码时,它没有显示任何图表。代码:
`x<- Tmax <- 443, 454, 451, 438, 451, 452, 453, 454, 453, 445, 449, 449, 454 y<- HI <- 43, 62, 63, 95, 105, 117.51, 119.07, 122, 122, 125, 131.8, 137, 139 #save this script as app.R library(shiny) library(ggplot2) ui <- fluidPage( Application title titlePanel("Exponential Equation App"), Sidebar with a slider input for number of bins sidebarLayout( sidebarPanel( sliderInput(inputId = "H0_1",label = "H0_1:", min = 100,max = 1000,value = 100, step = 0.5), sliderInput(inputId = "beta",label = "beta", min = 300,max = 600,value = 300, step = 0.5), sliderInput(inputId = "theta",label = "theta", min = -200,max = -1,value = -5, step = 1), sliderInput(inputId = "c",label = "c", min = 0,max = 100,value = 0, step = 1) ), mainPanel( plotOutput("lineplot") ) ) ) server <- function(input, output) { output$lineplot <- renderPlot({ x <- seq(from = 427, to = 458, by = 1) y <- H0_1 * (1 - exp(- (Tmax / beta) ^ theta)) + c plot(x,y, col="red", lwd = 3, type = "l") lines(y~For_RStudio$Tmax, col="blue", lwd=3) legend("topleft",c("real data","constructed"), col=c("blue","red"), lwd=3) }) } shinyApp(ui = ui, server = server) `
在我看来,您没有在服务器功能中使用任何定义的滑块输入。 尝试将它们与
input$H0_1
一起使用,而不仅仅是写 H0_1
。