[R] Lattice: it seems, a bug in draw.key function

Wladimir Eremeev wl at eimb.ru
Fri May 20 17:05:29 CEST 2005


Dear Deepayan,

I suggest something like

pointsGrob(
        x=if(key$divide>1){(1:key$divide-1)/(key$divide-1)} else 0.5,
             [blah-blah-blah]
          )

This looks like your 3rd variant.

However, I haven't try very hard to verify my solution.

I tried to redefine the entire function draw.key in my working environment,
but this didn't work.

I use R 2.1.0 on windows 2000, packages are precompiled binaries.
Am I right in thinking, that despite the presence of my function
draw.key, xyplot used the function, defined in the package?

DS> There's certainly a problem (at least one of omission in the documentation),
DS> but I'm not sure what the best way to resolve it would be. This is what
DS> currently happens on S-PLUS (6.0) and R:

DS> divide = 3:  o--o--o  S-PLUS/R
DS> divide = 2:  o-----o  S-PLUS/R

DS> divide = 1:     o     S-PLUS
DS>              -------  R

I would like to see ---o---

DS> Possible `solutions' are:

DS> 1. keep things as they are and clarify the documentation (namely, saying that
DS> 'divide' has to be greater than 1 to make sense)

DS> 2. change it to behave like S-PLUS (but that seems silly, since one might then
DS> just as well use 'points' instead of 'lines')

DS> 3. do something else entirely, like ---o--- . This is not attractive from a
DS> programmers point of view because it makes 'divide = 1'  behave 
DS> inconsistently with other values of 'divide'.

Marginal conditions need to be treated individually... :)

--
Best regards
Wladimir Eremeev                                     mailto:wl at eimb.ru

==========================================================================
Research Scientist, PhD                           Leninsky Prospect 33,
Space Monitoring & Ecoinformation Systems Sector, Moscow, Russia, 119071,
Institute of Ecology,                             Phone: (095) 135-9972;
Russian Academy of Sciences                       Fax: (095) 135-9972




More information about the R-help mailing list