我遇到了 Stargazer 函数将我的 data.frame 中的数据解释为乳胶命令的问题。我想找到一种方法来抑制 stargazer 的这个功能。见下文。
z <- c("Bank of America Corp",
"Citigroup Inc",
"JPMorgan Chase & Co",
"Morgan Stanley",
"Wells Fargo & Co")
s <- data.frame(z=z, l= c(100000, 25, 10000, 24, 100000))
library(stargazer)
stargazer(s, type = "text", summary = FALSE)
# prints out
==============================
z l
------------------------------
1 Bank of America Corp 100,000
2 Citigroup Inc 25
3 JPMorgan Chase Co
4 Morgan Stanley 24
5 Wells Fargo Co
------------------------------
由于它在乳胶中的含义,这里的&符号导致假定一个新列。我确认了这一点,因为将 & 替换为 and 会导致表格正确打印。
z <- c("Bank of America Corp",
"Citigroup Inc",
"JPMorgan Chase and Co",
"Morgan Stanley",
"Wells Fargo and Co")
s <- data.frame(z=z, l= c(100000, 25, 10000, 24, 100000))
library(stargazer)
stargazer(s, type = "text", summary = FALSE)
# prints out
===============================
z l
-------------------------------
1 Bank of America Corp 100,000
2 Citigroup Inc 25
3 JPMorgan Chase and Co 10,000
4 Morgan Stanley 24
5 Wells Fargo and Co 100,000
-------------------------------
我可以在 stargazer 函数中调用任何选项来防止这种行为吗?