簡體   English   中英

如何使用 Formattable 在 R Shiny 上修復表格的列寬?

[英]How to fix a table's column width on R Shiny using Formattable?

我想使用 formattable 在 R Shiny 上顯示數據框。 但是,這里的解決方案不起作用。 https://cran.r-project.org/web/packages/formattable/vignettes/formattable-data-frame.html

scores <- data.frame(id = 1:5,
                    prev_score = c(10, 8, 6, 8, 8),
                     cur_score = c(8, 9, 7, 8, 9),
                     change = c(-2, 1, 1, 0, 1))

width_formatter <- formatter("span",
                               style = x ~ style("width" = '100px'))


formattable(scores, list(width_formatter))

我該怎么做? 謝謝

除了DT解決方案,因為說的formattable的小插曲,你可以使用從要素formattableknitr::kable 然后就可以使用 kableExtra 來處理列寬問題了。

http://haozhu233.github.io/kableExtra/use_kableExtra_with_formattable.html

如何在 Shiny 中使用它: http : //haozhu233.github.io/kableExtra/use_kable_in_shiny.html

一般小插圖: http : //haozhu233.github.io/kableExtra/awesome_table_in_html.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM