Andrew Robinson
2005-Jan-02 23:26 UTC
[R] How to quieten axis() for Sweave: avoid echoing NULL?
Dear R-community, I'm using Sweave to produce reports. The reports require the "axis" command. When I run axis the program returns NULL as well as creating the axis.> plot(1:4, rnorm(4), axes=FALSE) > axis(1, 1:4, LETTERS[1:4])NULL>So, my Sweave tex files have \begin{Schunk} \begin{Soutput} NULL \end{Soutput} \end{Schunk} in front of each graphic that requires axis. I can easily find them and remove them, but I was wondering: is it something I can avoid? Or am I doing something foolish and obvious? Thanks for any assistance, Andrew -- Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : andrewr at uidaho.edu PO Box 441133 W : http://www.uidaho.edu/~andrewr Moscow ID 83843 Or: http://www.biometrics.uidaho.edu No statement above necessarily represents my employer's opinion.
Ulises M. Alvarez
2005-Jan-03 00:01 UTC
[R] How to quieten axis() for Sweave: avoid echoing NULL?
Hi!
The following works for me:
\begin{figure}
\centering
<<fig1.R,fig=true,echo=false>>plot(1:4, rnorm(4), axes=FALSE)
axis(1, 1:4, LETTERS[1:4])
@
\caption{Plot test}
\label{fig:1}
\end{figure}
I'm using R 2.0.1 on an i686 with GNU/Linux Ubuntu 4.10.
Andrew Robinson wrote:> Dear R-community,
>
> I'm using Sweave to produce reports. The reports require the
"axis"
> command. When I run axis the program returns NULL as well as creating
> the axis.
>
>
>>plot(1:4, rnorm(4), axes=FALSE)
>>axis(1, 1:4, LETTERS[1:4])
>
> NULL
>
>
> So, my Sweave tex files have
>
> \begin{Schunk}
> \begin{Soutput}
> NULL
> \end{Soutput}
> \end{Schunk}
>
> in front of each graphic that requires axis. I can easily find them
> and remove them, but I was wondering: is it something I can avoid? Or
> am I doing something foolish and obvious?
>
> Thanks for any assistance,
>
> Andrew
---
Ulises M. Alvarez
<umalvarez at fata.unam.mx>
Peter Dalgaard
2005-Jan-03 00:08 UTC
[R] How to quieten axis() for Sweave: avoid echoing NULL?
Andrew Robinson <andrewr at uidaho.edu> writes:> Dear R-community, > > I'm using Sweave to produce reports. The reports require the "axis" > command. When I run axis the program returns NULL as well as creating > the axis. > > > plot(1:4, rnorm(4), axes=FALSE) > > axis(1, 1:4, LETTERS[1:4]) > NULL > > > > So, my Sweave tex files have > > \begin{Schunk} > \begin{Soutput} > NULL > \end{Soutput} > \end{Schunk} > > in front of each graphic that requires axis. I can easily find them > and remove them, but I was wondering: is it something I can avoid? Or > am I doing something foolish and obvious?I think this qualifies as a bug along with similar issues with title(), text(), and mtext(). They all end with .Internal calls producing NULL. Once upon a time, they did so invisibly, but somehow this changed. The simple workaround is to wrap the call in invisible(). -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907