[英]R Shiny: How do I unbold the column names and reduce the font size of the column names with renderTable
[英]R Shiny - How do You present nicely column names?
我的所有列都包含參數名稱,例如:“all_application”、“all_phones”、“all_send_forms” 在 shiny 表中看起來不太好。 你如何解決? 我想將其更改為更多帶有空格的人名。
在將 dataframe 傳遞給 output 渲染之前,我通常只是將列重命名為 shiny 中的最后一步:
library(tidyverse)
df <- tibble (all_columns = 1:3,
all_phones = c("a", "b", "c"))
df_nice_names <- df %>%
rename("All Columns" = all_columns,
"All Phones" = all_phones)
# A tibble: 3 x 2
`All Columns` `All Phones`
<int> <chr>
1 1 a
2 2 b
3 3 c
Shiny 應用:
library(shiny)
ui <- fluidPage(
titlePanel(""),
sidebarLayout(
sidebarPanel(
),
mainPanel(
tableOutput("table")
)
)
)
server <- function(input, output) {
output$table <- renderTable({
library(tidyverse)
df <- tibble (all_columns = 1:3,
all_phones = c("a", "b", "c"))
df_nice_names <- df %>%
rename("All Columns" = all_columns,
"All Phones" = all_phones)
})
}
# Run the application
shinyApp(ui = ui, server = server)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.