[R] sunflowerplot error

From: <soeren.vogel_at_eawag.ch>
Date: Thu, 19 Mar 2009 18:47:56 +0100


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*



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 19 Mar 2009 - 16:52:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 Mar 2009 - 17:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive