Problems when printing lists inside RJournal template code chunks

僤鯓⒐⒋嵵緔 提交于 2019-12-02 22:22:17

问题


I'm using RStudio Version 0.99.896 and trying to compile an article which uses RJournal template (.Rmd). The thing is, whenever I try to compile a simple chunk like

```{r}
l = list(a = list(b = c(1,2)), b = c(3,4))
l$a 
l[[1]]$b
```

i get this awful output (in the .pdf):

\begin{Schunk} \begin{Sinput} l = list(a = list(b = c(1,2)), b = c(3,4)) l$a \end{Sinput} \be-
gin{Soutput} #> b > [ 1 ] 12
\textbackslash{}end\{Sinput\}
\begin{Soutput}
> [1] 1 2
\end{Soutput}
\textbackslash{}end\{Schunk\}
\textbackslash{}begin\{Schunk\}
\begin{Sinput}

I don't even have to use the problematic $ (dollar sign) to get this. Printing any list or object will do. For instance, this line

model = auto.arima(ipca)

prints

    \begin{Soutput} #> Series: ipca #> ARIMA(1,1,2)(0,0,1)[12]
#> #> Coefficients: #> ar1 ma1 ma2 sma1 #> 0.8259 -0.8128 -0.1339 0.1851 #> s.e. 0.0604
0.0816 0.0676 0.0896 #> #> sigmaˆ2 estimated as 21.04: log likelihood=-919.24 #> AIC=1848.48
AICc=1848.68 BIC=1867.21 \end{Soutput} \end{Schunk}

It's a mess. Does anyone know what's happening? Didn't see anyone else complaining about it. I guess it's a simple question, then.

来源:https://stackoverflow.com/questions/39237598/problems-when-printing-lists-inside-rjournal-template-code-chunks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!