Sweave output with ggplot2: suppressing mgcv warnings

76 views
Skip to first unread message

alexcozzi

unread,
Mar 23, 2009, 5:22:48 PM3/23/09
to ggplot2
I am embedding ggplot2 output in a sweave document, and I get the
following output when I use stat_smooth() with a large number of
points:

This is mgcv 1.5-0 . For overview type `help("mgcv-package")'.


The Latex/Sweave command that causes this is:

\begin{figure}
\begin{center}
<<fig=TRUE>>=
print(ggplot(web, aes(x=score, y=grade)) + stat_smooth())
@
\caption{Calibration curve using a smooth local interpolator}
\label{fig:calibration_smooth}
\end{center}
\end{figure}

Is there an easy way to suppress the text output in the latex
document?
Thanks

hadley wickham

unread,
Mar 23, 2009, 5:26:43 PM3/23/09
to alexcozzi, ggplot2
Hi Alex,

Just do library(mgcv) earlier where the output isn't included.

Hadley
--
http://had.co.nz/

alexcozzi

unread,
Mar 23, 2009, 5:36:21 PM3/23/09
to ggplot2
I get the output where I call library then :-(
I tried:
require(mgcv, quietly=TRUE)
and
suppressPackageStartupMessages(library(mgcv, warn.conflicts=FALSE))
but I still get the output

Kasper Daniel Hansen

unread,
Mar 23, 2009, 7:44:42 PM3/23/09
to alexcozzi, ggplot2
The easiest I have found is to include the loading of the packages
inside a chunk with results=hide, as in

<<packages,results=hide>>=
require(mgcv)
@

Kasper
Reply all
Reply to author
Forward
0 new messages