R:使用来自DataFrame列中的信息作为KableExtra中的标题
使用gt(),您还可以使标题还包括来自数据框架的信息:
table_name <- paste(data$`column_data`[1],paste("Sample Text"))
table <- gt(data,
rownames_to_stub = TRUE) %>%
tab_header(title = table_name)
有没有办法使KableExtra做到这一点?
Using gt() you can make the title include information from the data frame in addition to text:
table_name <- paste(dataUsing gt() you can make the title include information from the data frame in addition to text:
column_data`[1],paste("Sample Text"))
table <- gt(data,
rownames_to_stub = TRUE) %>%
tab_header(title = table_name)
Is there a way to make KableExtra do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,通过向
标头
add_header_above()
函数的参数提供数据框。根据该论点的文档:a
{gt}
表结果:
a
{kableExtra}
表结果:
Yes, by supplying a data frame to the
header
argument ofadd_header_above()
function. According to the documentation of this argument:A
{gt}
tableThe result:
A
{kableExtra}
tableThe result: