我的问题似乎并不复杂,但我相信闪亮包中的反应()会阻止我在类型中添加条件颜色=" l"我的renderPlot()中的行。
library(shiny)
library(ggplot2)
# Define server logic for random distribution application
shinyServer(function(input, output) {
sliderValues <- reactive ({
#compose data frame
ws<- as.numeric (c(0:input$sws))
df<-data.frame(
WindSpeed = as.numeric (c(ws)
),
CBH = as.numeric (c(input$sCBH)
),
FFMC = as.numeric (c(input$sFFMC)
),
DC = as.numeric (c(input$sDC)
),
PCFI = as.numeric (c((exp(-66.62+(-0.993*input$sCBH)+(0.568*ws)+(0.671*input$sFFMC)+(0.018*input$sDC)))/(1+(exp(-66.62+(-0.993*input$sCBH)+(0.568*ws)+(0.671*input$sFFMC)+(0.018*input$sDC)))))
)
)
})
#Show the values using an HTML table
output$summary <- renderPlot ({
plot(sliderValues()$WindSpeed, sliderValues()$PCFI, col =ifelse(sliderValues()$PCFI <0.5, 'green', 'red'), type="l", lty = 2, ylim = c(0,1), xlab = "Windspeed 10 km/hr", ylab = "Probability of Crown Fire Initiation (%)")
})
output$values <- renderTable({
sliderValues()
})
})