r - 更改闪亮数据表中的列名
问题描述
我正在尝试更改闪亮数据表的列标题。这是我到目前为止所做的。我在服务器部分的代码中添加了注释。我正在尝试更改列名并将行的选择限制为单个。
addr <- as.data.table(read.csv("addresses.csv", header = T, stringsAsFactors = F)
ui <- fluidPage(
br(),
fluidRow(
column(12, div(DT::dataTableOutput("addressTable"), style="font-family:verdana", align="left"))
),
fluidRow(
column(4, div(textOutput("selectedAddress"), align="center"))
)
)
server <- function(input, output) {
# output$addressTable <- DT::renderDataTable({
# names(addr) [1:4]<- c("STREET ADDRESS","CITY NAME","PROVINCE","POSTAL CODE")
# addr
# }) -- This code works, I was able to change the column headers but not able to add the selection single option.
output$addressTable <- DT::renderDataTable(addr, selection = 'single') - this code works with the selection to single, but not able to change column headers.
}
shinyApp(ui, server)
解决方案
推荐阅读
- android - Android Studio Gradle:无法解析符号“amazonaws”
- swift - 我想在扩展中使用 switch
- javascript - Ajax 在整个网站上突然停止工作
- excel - 完全在 VBA 形式中运行目标搜索或求解器
- docker - 访问正在运行的 docker 容器的日志
- c# - 在 IIS 中托管应用程序后,MVC 5 中的捆绑配置未呈现
- .net - 尝试搭建控制器时,我收到一条错误消息,提示找到多个 dbcontext
- python - 在 tkinter 中裁剪图像
- javascript - 基于对象值列表的新对象
- node.js - Flask 用于服务器,Node.js 用于 API?