I am experiencing a problem where the Stargazer function is interpreting data in my data.frame as a latex command. I would like to find a way to suppress this feature of stargazer. See below.
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
------------------------------
Here the ampersand is causing a new column to be assumed due to its meaning in latex. I confirmed this because replacing & with and causes the table to print out properly.
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
-------------------------------
Is there any option I can invoke in the stargazer function to prevent this behavior?