R 包装中的年份::huxtable表格脚注默认为科学概念

R 包装中的年份::huxtable表格脚注默认为科学概念,r,R,我试图使用package::huxtable将包含4位数年份的脚注添加到表中。年份以科学记数法输出。“我在表格正文中的数字和我的问题上遇到了同样的问题,”卡蒂亚解释了发生的事情。但现在我一直在试图解决同样的问题,但在表格的脚注中: options(scipen = 100, digits = 10) library(huxtable) t <- huxtable(mtcars[1:5, 1:2]) number_format(t) <- 1 add_footnote(t, "No c

我试图使用package::huxtable将包含4位数年份的脚注添加到表中。年份以科学记数法输出。“我在表格正文中的数字和我的问题上遇到了同样的问题,”卡蒂亚解释了发生的事情。但现在我一直在试图解决同样的问题,但在表格的脚注中:

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")
我无法理解发生了什么-数字\u format()将整个表的小数点设置为1。或者应该是。放下它,整张桌子就变成了科学记数法。将1776置于引号中会导致错误:

Error: unexpected numeric constant in "add_footnote(t, "No cars in "1776"

非常感谢任何指点/帮助

footnote
在一个
huxtable
中有它自己的属性-你可以传递额外的参数,然后传递到'set\u cell\u properties'

参数
... 其他属性,传递给设置脚注单元格的单元格属性

number\u格式
指定为
add\u 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, cyl

非常感谢。这起作用了。我尝试用format()包装,但没有想到传递number\u format()。
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, cyl