Вопрос

Sweave/Latex newbie here. I have no problems generating regular functions outputs, but the plots don't show up. Here's a basic example:

\documentclass{article}
\begin{document}
\SweaveOpts{concordance=TRUE}

<<chunk1>>=
print("Hello World")
boxplot(rnorm(100))
@

\end{document}

And the corresponding .tex output:

\documentclass{article}
\usepackage{Sweave}
\begin{document}
\input{test2-concordance}

\begin{Schunk}
\begin{Sinput}
> print("Hello World")
\end{Sinput}
\begin{Soutput}
[1] "Hello World"
\end{Soutput}
\begin{Sinput}
> boxplot(rnorm(100))
\end{Sinput}
\end{Schunk}

\end{document}

I am running Rstudio version 0.98.501. I use Texlive, and tried on both Windows and Linux with the same results. What am I missing?

Это было полезно?

Решение

You need to put fig=TRUE in the hook. It should look like:

<<chunk1,fig=TRUE>>=

Then try again!!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top