如何在R中设置表滤波器?
我将RMD文件编织到HTML中,为了将表放入HTML文件中,我使用KableExtra函数。现在,我想知道是否可以将过滤器添加到该表(例如在Excel中)以使其更具交互性并让用户过滤某些参数本身?
df <- data.frame (origin = c("A","B","C","D","E","F","G","H","I","J"),
Percentage = c(23,16,32,71,3,60,15,21,44,60),
rate = c(10,12,20,200,-25,12,13,90,-105,23),
change = c(10,12,-5,12,6,8,0.5,-2,5,-2))
library(kableExtra)
df %>%
kbl() %>%
kable_material(c("striped", "hover"))
I knit my rmd file into HTML and in order to put my table in HTML file, I use the kableExtra function. Now, I wonder if it's possible to add a filter to this table (like in Excel) to make it more interactive and let user filter some parameters itself?
df <- data.frame (origin = c("A","B","C","D","E","F","G","H","I","J"),
Percentage = c(23,16,32,71,3,60,15,21,44,60),
rate = c(10,12,20,200,-25,12,13,90,-105,23),
change = c(10,12,-5,12,6,8,0.5,-2,5,-2))
library(kableExtra)
df %>%
kbl() %>%
kable_material(c("striped", "hover"))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能会在过滤和其他互动方面有更好的运气
使用
dt :: dataTable()
有很多选项, ;例如,设置字体尺寸:有关选项的全面处理,请参见 rstudio.github.github.io/dt/ options.html 和其他文档来源
You may have better luck with filtering and other interaction using
DT::datatable()
There are lots of options; for example, setting font size:
For full treatment of options, see rstudio.github.io/DT/options.html and other documentation sources