【发布时间】:2021-09-15 14:08:07
【问题描述】:
示例如下。我想通过 UI 部分向我的应用程序添加一个句子。不是我给verbatimTextOutput("Some Text Here \n and a new line here")打的电话:
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
verbatimTextOutput("Some Text Here \n and a new line here")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# Run the application
shinyApp(ui = ui, server = server)
一直在阅读this 的帖子,因为我希望能够在一串文本中添加带有\n 的新行,但似乎无法在应用中仅显示文本。
如何在我的应用程序中添加“Some Text Here \n and a new line here”?
【问题讨论】: