[英]How can I concatenate non-reactive values with reactive value for a graph title? R Shiny
I am having trouble naming a graph title that contains a normal string AND reactive value/s. 我在命名包含正常字符串和响应值的图形标题时遇到麻烦。
I'm trying to do something like this: main = "Examination of: " + input$userInput 我正在尝试做这样的事情:main =“ Examination of:” + input $ userInput
The error message is: non-numeric argument to binary operator. 错误消息是:二进制运算符的非数字参数。 Does anyone know how to fix this? 有谁知道如何解决这一问题?
The below code could give you what you needed. 下面的代码可以为您提供所需的内容。
library(shiny)
ui <- basicPage(
uiOutput("test"),
plotOutput("plot1")
)
server <- function(input, output) {
output$test <- renderUI({
selectInput("dummy", "Select one value", c(mtcars$qsec))
})
output$plot1 <- renderPlot({
plot(mtcars$wt, mtcars$mpg, main = paste0("this is main ",input$dummy,""))
})
}
shinyApp(ui, server)
The usage of selectInput
is for testing your requirement. selectInput
的用法用于测试您的需求。 Make the needful changes for your actual problem. 对您的实际问题进行必要的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.