我试图在使用package::huxtable的表中添加一个包含4位数年份的脚注。这一年是用科学符号计算出来的。我遇到了同样的问题,涉及到表格中的数字和我的问题here,katia解释了正在发生的事情。但现在,我只能在表格的脚注中试图解决同样的问题:
options(scipen = 100, digits = 10)
library(huxtable)
t <- huxtable(mtcars[1:5, 1:2])
number_format(t) <- 1
add_footnote(t, "No cars in 1776")脚注打印如下:
# No cars in 1.78e+03我不明白发生了什么-- number_format()将整个表的小数位设置为1。或者应该是。丢下它会使整个表恢复为科学符号。在引号中输入1776会导致错误:
Error: unexpected numeric constant in "add_footnote(t, "No cars in "1776"任何指点/帮助都是非常感谢的!
发布于 2018-05-23 00:18:48
footnote在huxtable中带有自己的属性--您可以传递附加的参数,然后传递给`set_cell_properties。
参数 ..。其他属性,传递给set_cell_properties作为脚注单元格。
将number_format指定为add_footnote的附加参数应该有效
add_footnote(t, "No cars in 1776", number_format = 0)
# 21.0 6.0
# 21.0 6.0
# 22.8 4.0
# 21.4 6.0
# 18.7 8.0
# ───────────────────────────────
# No cars in 1776
# Column names: mpg, cylhttps://stackoverflow.com/questions/50478017
复制相似问题