r - Rshiny:在数据表中,我应该如何突出显示某些文本?
问题描述
我正在创建一个 R 闪亮的应用程序,当我使用浏览按钮输入一个 CSV 文件时,它现在显示一个数据表。我想强调几句话。在一个四列十行的 CSV 文件中,我想在主面板中突出显示第 4 列和第 9 行的值。应该如何在 R 中完成
我的代码:
library(shiny)
ui <- fluidPage(
fileInput("myfileinput", "Please choose a csv File", multiple = FALSE, accept = c("text/csv", "text/comma-separated-values,text/plain", ".csv")),
tableOutput('mytable')
)
server <- function(input, output, session) {
#Reactive to store loaded data
reactives <- reactiveValues(
mydata = NULL
)
#Observe file being selected
observeEvent(input$myfileinput, {
#Store loaded data in reactive
reactives$mydata <- read.csv(file = input$myfileinput$datapath)
})
#Data table
output$mytable <- renderTable({
reactives$mydata
})
}
shinyApp(ui = ui, server = server)
解决方案
推荐阅读
- java - 如何通过Java代码为mongoDB实现嵌套查询
- react-native - 何时返回 fetch() 以及何时仅使用 fetch() 请求?
- ios - 如何让我的 iOS 项目为正确的版本构建?
- javascript - 从变量 jQuery 中减去 1
- django - Django-rest-framework - JWT 身份验证
- c++ - CPP:如何获取字符的最后一个索引?
- ruby-on-rails - Rails 5.2 /products/new.html.erb 添加产品时遇到实际问题
- javascript - 如何为 html 集合中的每个元素添加事件侦听器?
- sql - 临时表-内连接
- mysql - MySQL 错误 0:未为不安全的连接启用 RSA 公钥的检索