Help with a Lattice plot that fails with an empty unique combination
On Wednesday 09 June 2004 01:58, Tom Mulholland wrote:
While using Lattice I received the following error. Error in if (xx != 0) xx/10 else z/10 : argument is of length zero In addition: Warning messages: 1: is.na() applied to non-(list or vector) in: is.na(x) 2: is.na() applied to non-(list or vector) in: is.na(x) 3: no finite arguments to min; returning Inf 4: no finite arguments to max; returning -Inf 5: NaNs produced in: log(x, base) Can anyone point me in the right direction.
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