Skip to content
Prev 50754 / 398500 Next

Help with a Lattice plot that fails with an empty unique combination

On Wednesday 09 June 2004 01:58, Tom Mulholland wrote:
A traceback() shows that this is happening due to jitter() being called 
with a length-0 numeric. I have added a check in panel.stripplot. Until 
the next release, you can work around it by:


assignInNamespace("panel.stripplot",     
    function(x, y, jitter.data = FALSE, factor = 0.5,
             horizontal = TRUE, groups = NULL, ...)
{
    if (length(x) < 1) return()
    x <- as.numeric(x)
    y <- as.numeric(y)
    y.jitter  <-
        if (horizontal && jitter.data) 
            jitter(y, factor = factor) else y
    x.jitter  <-
        if (!horizontal && jitter.data) 
            jitter(x, factor = factor) else x
    if (is.null(groups)) panel.xyplot(x = x.jitter, 
        y = y.jitter, ...) else 
    panel.superpose(x = x.jitter, y = y.jitter, 
        groups = groups, ...)
}, "lattice")


Deepayan