[英]R: Manual line break within strings for HTML table output
I am working on a replication of a table in R as an HTML output with huxtable
, and came accross a basic question I can't answer: Is there an easy way to add a line break in a string? 我正在使用huxtable
R中的表复制为HTML输出, huxtable
一个我无法回答的基本问题:是否有一种简单的方法可以在字符串中添加换行符?
Example: 例:
[1] State with highest mortality rate compared to Population Population Deaths
[2] Alabama 16,000,000 15
[3] Alaska 3,000,000 7
...
I would like to break lines manually, since it is a replication project. 我想手动中断行,因为它是一个复制项目。
Possible end-result: 可能的最终结果:
[1] State with highest
mortality rate compared
to Population Population Deaths
[2] Alabama 16,000,000 15
[3] Alaska 3,000,000 7
...
Let me know, if anyone found a good solution. 让我知道,如果有人找到了一个好的解决方案。 Thank you in advance for helping and sharing! 预先感谢您的帮助和分享!
Add breaks in HTML with <br>
and set escape_contents
to FALSE
for the relevant cells. 使用<br>
在HTML中添加分隔符,并将相关单元格的escape_contents
设置为FALSE
。
myhux[1, 1] <- "State with highest<br> mortality rate compared <br> to population"
escape_contents(myhux)[1, 1] <- FALSE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.