如何使用 renderUI shiny app R 显示文本框编号的值
how to display value of text box number using renderUI shiny app R
我想显示输入时显示的文本框编号的值
这就是我想要做的
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
h1("Enter One Number"),
numericInput("number","enter a number", "" , min = 1 , max = 100),
uiOutput("uu")
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$uu <- renderUI({"you are typing " input$number })
}
您需要处理字符串。不可能仅仅将它们连接在 renderUI
中。为了组合字符串,请使用 paste
、sprintf
或任何适当的字符串函数。
library(shiny)
ui <- fluidPage(
h1("Enter One Number"),
numericInput("number","enter a number", "" , min = 1 , max = 100),
uiOutput("uu"))
server <- function(input, output, session) {
output$uu <- renderUI({paste("you are typing", input$number) })
}
shinyApp(ui, server)
您不能在 R 中简单地组合文本和对象,但您可以在这种情况下使用 paste
。
library(shiny)
ui <- fluidPage(
# Application title
h1("Enter One Number"),
numericInput("number","enter a number", "" , min = 1 , max = 100),
uiOutput("uu")
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$uu <- renderUI({paste0("you are typing ", input$number) })
}
shinyApp(ui = ui, server = server)
我想显示输入时显示的文本框编号的值
这就是我想要做的
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
h1("Enter One Number"),
numericInput("number","enter a number", "" , min = 1 , max = 100),
uiOutput("uu")
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$uu <- renderUI({"you are typing " input$number })
}
您需要处理字符串。不可能仅仅将它们连接在 renderUI
中。为了组合字符串,请使用 paste
、sprintf
或任何适当的字符串函数。
library(shiny)
ui <- fluidPage(
h1("Enter One Number"),
numericInput("number","enter a number", "" , min = 1 , max = 100),
uiOutput("uu"))
server <- function(input, output, session) {
output$uu <- renderUI({paste("you are typing", input$number) })
}
shinyApp(ui, server)
您不能在 R 中简单地组合文本和对象,但您可以在这种情况下使用 paste
。
library(shiny)
ui <- fluidPage(
# Application title
h1("Enter One Number"),
numericInput("number","enter a number", "" , min = 1 , max = 100),
uiOutput("uu")
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$uu <- renderUI({paste0("you are typing ", input$number) })
}
shinyApp(ui = ui, server = server)