문제

I get a weird result when trying to output my regression results into latex tables using the stargazer package in R: when I simply do

stargazer(linear.1,linear.2)

I get a perfectly fine latex table displayed in the R console that I can then copy and paste into my latex editor. However, when I use

table<-stargazer(linear.1,linear.2)

the character object 'table' does not have the same latex output that one would expect given the results of the first line of code, but rather the same latex code as before with an additional backslash before every backslash in the original latex code, e.g. instead of \begin{document} I get \\begin{document}, instead of two backslashes for a line break I get three backslashes etc.

Any idea what is causing this behavior and how I could fix it?

Thanks!

도움이 되었습니까?

해결책

Perfectly normal behavior, as backslashes in R string require an escape character that just happens to be... a baskslash!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top