r - 具有美国格式的大数字 xtable

标签 r xtable

我有以下矩阵

matrix(c(10000, 11000, 20000, 0, 4000, 5000))
xtable(x)

我想要这种格式的数字 10'000、11'000 等。 关于如何做到这一点有什么想法吗?

最佳答案

来自 xtable 帮助:

x<-matrix(c(10000, 11000, 20000, 0, 4000, 5000))
require(xtable)
xtable(x)
print(xtable(x), format.args = list(big.mark = "'", decimal.mark = ","))
#% latex table generated in R 3.0.2 by xtable 1.7-1 package
#% Wed Jun 11 18:02:05 2014
#\begin{table}[ht]
#\centering
#\begin{tabular}{rr}
#  \hline
# & x \\ 
#  \hline
#1 & 10'000,00 \\ 
#  2 & 11'000,00 \\ 
#  3 & 20'000,00 \\ 
#  4 & 0,00 \\ 
#  5 & 4'000,00 \\ 
#  6 & 5'000,00 \\ 
#   \hline
#\end{tabular}
#\end{table}

关于r - 具有美国格式的大数字 xtable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22069771/

相关文章:

r - Shiny 的应用因错误而停止。如何处理此类错误

r - 使用 xtable 对 latex 输出表进行排序

html - R:输出带有小计的类似数据透视表

r - mclapply 与 parLapply 速度

r - as_mapper(.f, ...) 错误 : argument ".f" is missing, 没有默认值,带有函数映射

r - 将多个值定义为数据框中缺失

r - 如何使用 ggplot2 将新图例添加到复杂的散点图

r - xtable 中的双线

r - 使用 R 的 xtable 行名

r - knitr xtable 突出显示并为同一行添加水平线,