我创建了一个包含package reactable的表格,但我不确定如何在其中添加标题。我在Github中有几个例子,他们添加了一个,但我不能得到相同的结果。这是我的代码:
library(reactable)
library(htmltools)
example<- reactable(data.frame(country=c("argentina","brazil"),
value=c(1,2)
))
div(class = "table",
div(class = "title", "Top CRAN Packages of 2019"),
example
)
print(example)这是一个例子,他们在表格中添加标题,以及我尝试添加标题的其他内容:
https://glin.github.io/reactable/articles/twitter-followers/twitter-followers.html
发布于 2020-08-15 07:55:08
reactable函数返回一个特殊的对象,该对象恰好使用htmlwidgets包来帮助渲染。您可以使用htmlwidgets::prependContent函数将HTML内容添加到标题的对象中。例如
withtitle <- htmlwidgets::prependContent(example,
h2(class = "title", "Top CRAN Packages of 2019"))
print(withtitle)这会在打印时将<h2>头标记和内容放在表元素之前。
https://stackoverflow.com/questions/63421032
复制相似问题