[R] How to quieten axis() for Sweave: avoid echoing NULL?

2005-01-02 Thread Andrew Robinson
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 : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to quieten axis() for Sweave: avoid echoing NULL?

2005-01-02 Thread Ulises M. Alvarez
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
[EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to quieten axis() for Sweave: avoid echoing NULL?

2005-01-02 Thread Peter Dalgaard
Andrew Robinson [EMAIL PROTECTED] 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
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Black and white graphics and transparent strip panels with lattice under Sweave

2005-01-02 Thread Frank E Harrell Jr
What is the most elegant way to specify that strip panels are to have 
transparent backgrounds and graphs are to be in black and white when 
lattice is being used with Sweave?  I would prefer a global option that 
stays in effect for multiple plots.

If this is best done with a theme, does anyone have a lattice theme like 
col.whitebg but that is for black and white?

I'm using the following with lattice 0.10-16, grid 2.0.0:
platform i586-mandrake-linux-gnu
arch i586
os   linux-gnu
system   i586, linux-gnu
status
major2
minor0.0
year 2004
month10
day  04
language R
Thanks,
Frank
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Black and white graphics and transparent strip panels with lattice under Sweave

2005-01-02 Thread Deepayan Sarkar
On Sunday 02 January 2005 19:40, Frank E Harrell Jr wrote:
 What is the most elegant way to specify that strip panels are to have
 transparent backgrounds and graphs are to be in black and white when
 lattice is being used with Sweave?  I would prefer a global option
 that stays in effect for multiple plots.

 If this is best done with a theme, does anyone have a lattice theme
 like col.whitebg but that is for black and white?

I'd do something like this as part of the initialization:

...
library(lattice)
ltheme - canonical.theme(color = FALSE) ## in-built BW theme
ltheme$strip.background$col - transparent ## change strip bg
lattice.options(default.theme = ltheme)  ## set as default
@

Deepayan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Black and white graphics and transparent strip panels with lattice under Sweave

2005-01-02 Thread Frank E Harrell Jr
Deepayan Sarkar wrote:
On Sunday 02 January 2005 19:40, Frank E Harrell Jr wrote:
What is the most elegant way to specify that strip panels are to have
transparent backgrounds and graphs are to be in black and white when
lattice is being used with Sweave?  I would prefer a global option
that stays in effect for multiple plots.
If this is best done with a theme, does anyone have a lattice theme
like col.whitebg but that is for black and white?

I'd do something like this as part of the initialization:
...
library(lattice)
ltheme - canonical.theme(color = FALSE) ## in-built BW theme
ltheme$strip.background$col - transparent ## change strip bg
lattice.options(default.theme = ltheme)  ## set as default
@
Deepayan
That worked perfectly.  Thank you very much Deepayan.  -Frank
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] subsetting within a function

2005-01-02 Thread Pamela McCaskie
Thankyou for your help with subsetting within a function. I have now tried
to apply the same theory in the framework of an lme as follows:

fit1.lme - eval(substitute(lme(fixed=fixed, data=dataframe,
random=random, correlation=corCAR1(form= corr), na.action=na.omit,
subset=subset),list(subset=subs)))

but I get the following error:

Error in switch(mode(object), name = , numeric = , call = object,
character = as.name(object),  :
[[ cannot be of mode logical

I'm not sure why. Can anyone help me with this?
kind regards
Pam



On Thu, 30 Dec 2004, Thomas Lumley wrote:

 On Thu, 30 Dec 2004, Pamela McCaskie wrote:
  And so my attempt to wrap a simple function around this looks like:
  test.fun - function(formula, mydata, sub=NULL){
   subs - with(mydata, eval(sub))
   fit.glm - glm(formula=formula, data=mydata, family=binomial, subset=subs)
   return(fit.glm)
  }
 
  But when I tested it out with
  test - test.fun(y~x1+x2, mydata=testdata, sub=expression(SEX==0))
 
  I get:
  Error in [.data.frame(structure(list(N_ASTHMA = as.integer(c(0, 0, 0,  :
 invalid subscript type

 I get a different error: it may be that you have an object called `subs`
 in the global environment

  I'm guessing that it's looking in the global environment for
  subs,

 More precisely, it is looking in environment where `formula` was created,
 which happens to be the global environment.

 This is the sort of thing that happens with the fitting functions because
 they go to such lengths to break the basic scoping of R.


 You probably have to substitute() the evaluated subset into the glm call.

fit.glm - eval(substitute(glm(formula=formula, data=mydata,
   family=binomial, subset=subset),list(subset=subs)))


   -thomas


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] matrix and error in points, plot ?

2005-01-02 Thread Patrick Giraudoux H
Hi,
Would a specialist of the point or plot functions try the following:
mat-matrix(c(1.836767,4.025989,0.6396777,0.376),ncol=2)
plot(mat)
points(mat[1,],col=red)
..A lag appears on x for mat [1,1] between the two displays.
I wonder if this example may be due to a bug or to the mis-use of a matrix 
in the plot() points()  functions. In case of mise-use which kind can it be?

I am working with R 2.0.1 and Windows XP.
Cheers,
Patrick Giraudoux
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html