多排乳胶 table 与 R
Multi-row latex table with R
我有这个数据框:
mydf <- data.frame(rowFactor1 = c(rep("S4",6),rep("S5",6),rep("S6",6)),
rowFactor2 = rep(c("All","T1/T2(V)"), 9),
colFactor1 = rep(c(rep("Ml",2),rep("Mp",2),rep("Mra",2)), 3),
x = c(
"8.73",
"0.46 / 8.28 ( 2 )",
"7.02",
"0.84 / 8.28 ( 3 )",
"0.55",
"0.90 / 1.20 ( 0 )",
"8.14",
"2.02 / 1.57 ( 5 )",
"0.55",
"2.90 / 1.28 ( 4 )",
"1.73",
"3.46 / 8.28 ( 6 )",
"6.02",
"0.87 / 8.90 ( 5 )",
"1.55",
"0.90 / 1.20 ( 1 )",
"6.24",
"2.02 / 1.57 ( 7 )"
))
如何在 R 上使用 mydf
创建具有多行的 Latex table?
我尝试使用R包的tabular
功能tables
tab1 <- tabular(Heading()*RowFactor(rowFactor1, spacing = 1,
c("S4","S5","S6"))*
Heading()*RowFactor(rowFactor2,
levelnames = c("All","T1/T2(V)")) ~
Heading()*Factor(colFactor1,
levelnames = c("Ml","Mp","Mra")),
data = mydf)
latex(tab1)
我有这个 table 没有 x 的值 (8.73, 0.46 / 8.28 ( 2 )
...) 并且填充了单个值 1
.
感谢您的帮助!
如果您希望在 table 中使用字符串,可以将您的 x
因子转换为字符:
mydf$x <- as.character(mydf$x)
然后包含 x
个字符串,如下所示:
library(tables)
tab1 <- tabular(Heading()*RowFactor(rowFactor1, spacing = 1,
c("S4","S5","S6"))*
Heading()*RowFactor(rowFactor2,
levelnames = c("All","T1/T2(V)")) ~
Heading()*Factor(colFactor1,
levelnames = c("Ml","Mp","Mra"))*
Heading()*(x)*Heading()*identity,
data = mydf)
latex(tab1)
同时考虑替代 tabular
的 Latex tables:
Tools for making latex tables in R
我有这个数据框:
mydf <- data.frame(rowFactor1 = c(rep("S4",6),rep("S5",6),rep("S6",6)),
rowFactor2 = rep(c("All","T1/T2(V)"), 9),
colFactor1 = rep(c(rep("Ml",2),rep("Mp",2),rep("Mra",2)), 3),
x = c(
"8.73",
"0.46 / 8.28 ( 2 )",
"7.02",
"0.84 / 8.28 ( 3 )",
"0.55",
"0.90 / 1.20 ( 0 )",
"8.14",
"2.02 / 1.57 ( 5 )",
"0.55",
"2.90 / 1.28 ( 4 )",
"1.73",
"3.46 / 8.28 ( 6 )",
"6.02",
"0.87 / 8.90 ( 5 )",
"1.55",
"0.90 / 1.20 ( 1 )",
"6.24",
"2.02 / 1.57 ( 7 )"
))
如何在 R 上使用 mydf
创建具有多行的 Latex table?
我尝试使用R包的tabular
功能tables
tab1 <- tabular(Heading()*RowFactor(rowFactor1, spacing = 1,
c("S4","S5","S6"))*
Heading()*RowFactor(rowFactor2,
levelnames = c("All","T1/T2(V)")) ~
Heading()*Factor(colFactor1,
levelnames = c("Ml","Mp","Mra")),
data = mydf)
latex(tab1)
我有这个 table 没有 x 的值 (8.73, 0.46 / 8.28 ( 2 )
...) 并且填充了单个值 1
.
感谢您的帮助!
如果您希望在 table 中使用字符串,可以将您的 x
因子转换为字符:
mydf$x <- as.character(mydf$x)
然后包含 x
个字符串,如下所示:
library(tables)
tab1 <- tabular(Heading()*RowFactor(rowFactor1, spacing = 1,
c("S4","S5","S6"))*
Heading()*RowFactor(rowFactor2,
levelnames = c("All","T1/T2(V)")) ~
Heading()*Factor(colFactor1,
levelnames = c("Ml","Mp","Mra"))*
Heading()*(x)*Heading()*identity,
data = mydf)
latex(tab1)
同时考虑替代 tabular
的 Latex tables:
Tools for making latex tables in R