From deepayan at stat.wisc.edu  Tue May 13 23:26:56 2003
From: deepayan at stat.wisc.edu (deepayan@stat.wisc.edu)
Date: Tue May 13 22:27:08 2003
Subject: [Rd] bug and proposed fix in print.trellis 1.7.0 (PR#2859)
Message-ID: <200305132026.h4DKQu2b001918@pubhealth.ku.dk>


Hi,

sorry for the delay, I didn't have time to look at this earlier.

On Sunday 27 April 2003 09:44, rmh@surfer.sbm.temple.edu wrote:

> The new feature described in rw1070/library/lattice/Changes is very
> useful and is needed for several of the examples I showed at DSC-2003.
>
> > scales
> > ------
> > In anticipation of future use (in nlme, for example), the at and
> > labels components of scales can now be a list. Each element
> > corresponds to a panel. This is thoroughly untested and not guaranteed
> > to work.

It's not at all clear from this entry, but I meant to do this only when 
relation="free" or "sliced" in scales, because those are the only cases in 
which different tick positions and labels can be guaranteed to be associated 
with each panel. In the relation = "same" case, changing the layout changes 
which labels go with which panel (and if alternating = 0 or 3, it's even 
ambiguous).

I notice now that your first example (with the 'at' but no 'labels') does 
produce some output that seems to take the list into account, but that was 
unintended. My preference would be to produce an error in such cases, but I'm 
open to other suggestions.

Do you really need this ? I think relation="free" would suit your purpose 
quite well, at least in the given example. Perhaps I could additionally allow 
'limits' (which is ignored now for relation="free") to be a list as well.

Deepayan


> It currently rejects correctly formed user labels.  I attach an
> example of the problem and a proposed fix.
>
> Rich
>
> --please do not edit the information below--
>
> Version:
>  platform = i386-pc-mingw32
>  arch = i386
>  os = mingw32
>  system = i386, mingw32
>  status =
>  major = 1
>  minor = 7.0
>  year = 2003
>  month = 04
>  day = 16
>  language = R
>
> Windows XP Home Edition (build 2600) Service Pack 1.0
>
> Search Path:
>  .GlobalEnv, file:c:/HOME/rmh/hh/splus.library/.RData, package:grid,
> package:lattice, package:methods, package:ctest, package:mva,
> package:modreg, package:nls, package:ts, Autoloads, package:base
>
>
> example:
> ## print.trellis bug in R 1.7.0
>
> tmp <- data.frame(a=factor(c("a","b","c")),
>                   b=factor(c("d","e","f")),
>                   d=factor(c(1,1,2)))
>
> xyplot(a ~ b | d, data=tmp,  ## works
>         scales=list(alternating=F))
>
> xyplot(a ~ b | d, data=tmp,  ## Invalid value for labels
>        scales=list(x=list(labels=list(c("d","e",""),c("","","f")),
>                      alternating=F)))
>
> source("print.trellis.r")    ## rmh proposed fix
>
> xyplot(a ~ b | d, data=tmp,  ## now it works
>        scales=list(x=list(labels=list(c("d","e",""),c("","","f")),
>                      alternating=F)))


[Rd] bug and proposed fix in print.trellis 1.7.0 (PR#2859)
deepayan@stat.wisc.edu