我需要复制View()基本功能,如下所述,但是在闪亮的数据表中(DT :: renderDataTable)
我有一个表,其中几列内部有很长的文本,我希望每行只显示一行,列宽合理,因此对于长文本列,数据被包装并且只有在完全可见时才会显示将鼠标悬停在View()函数显示数据框上。
请在下面找到最小例子。
library(shiny)
library(DT)
df <- data.frame(A = 1:4, B = T, C = c("Healthcare company",
"tech company",
"develops, manufactures, and distributes antennas, system components, and repeater/rebroadcast systems to wireless communications and renewable energy markets in Australia and internationally. The company offers communications solutions, such as antennas, multicoupling and frequency translating repeater systems, lightning protection products, cables and connectors, batteries, industrial solar products, radio frequency power amplifiers and distribution equipment, and antenna site monitoring solutions for defense, LMR, public safety, and cellular applications in telecommunications, government, and public and private radio operator markets; and cellular distributed antenna systems, tunnel radio rebroadcast systems, and DAS to carriers and building contractors in shopping centers, multi-story office buildings and hospitals. It also engages in the wholesale distribution of solar power products, including stand alone or grid interactive systems and components, including modules, inverters, batteries, and balance of systems hardware; and renewable energy products, such as stand-alone remote area power, industrial, and grid-connect systems in Australia, as well as represents companies in DC and AC power markets. In addition, the company offers installation, consulting, and integrated system services; and site interference and remediation assistance services for large OEMs and integrator customers. It serves emergency service, industrial data collection, building service, and renewable energy providers through a network of resellers, systems integrators, and retail outlets; and a dealer network in the Australian renewable energy market",
"CPG company"),
D = c(1980, 1995, 2015, 2010))
#--------------------
ui <- fluidPage(
dataTableOutput("example_df")
)
server <- function(input, output) {
output$example_df <- renderDataTable({df})
}
shinyApp(ui, server)
当我运行闪亮的应用程序时,包含长文本的数据表行占用了大量空间,使得数据可视化无用
比较View()和dataTableOutput()之前的链接,问题是我需要这种行为,但是在一个闪亮的应用程序中