[R] sunflowerplot error
soeren.vogel at eawag.ch
soeren.vogel at eawag.ch
Thu Mar 19 18:47:56 CET 2009
A sunflowerplot crossing two categorial variables with NAs fails:
### sample: start ###
set.seed(20)
a <- c(letters[1:4])
z <- c(letters[23:26])
fa <- factor(sample(rep.int(a, 1000), 100, replace=T), levels=a,
ordered=T)
fz <- factor(sample(rep.int(z, 1000), 100, replace=T), levels=z,
ordered=T)
sunflowerplot(fa, fz)
# okay, but:
r <- xyTable(fa, fz)
length(r$x)==length(r$y)
length(r$x)==length(r$number)
# TRUE, TRUE
is.na(fa) <- sort(sample(1:100, 3))
sunflowerplot(fa, fz)
# Error in rep.int(i.multi, number[number > 1]) : invalid 'times' value
s <- xyTable(fa, fz)
length(s$x)==length(s$y)
length(s$x)==length(s$number)
# TRUE, TRUE
### sample: end ###
Seems to fail due to NAs, but (1) why and (2) how to get by?
Thanks, *Sören*
More information about the R-help
mailing list