Re: [R] dotplot (lattice) with panel.segments and groups

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat 08 Jul 2006 - 02:15:27 EST

It seems to work if you handle the col= argument explicitly. Suggest you double check this since I have not carefully done so:

barley$yield2 <- with(barley, yield + 5)

dotplot(site ~ yield | variety, data=barley, groups=year,

       yield2=barley$yield2, col=c("gray", "black"),
       panel=function(x, y, subscripts, groups, yield2, col, ...) {
           panel.dotplot(x, y, ...)
           panel.segments(x, as.numeric(y),
              yield2[subscripts], as.numeric(y),
		col = col[groups[subscripts]], ...)
       })



On 7/7/06, Sebastian Luque <spluque@gmail.com> wrote:
> Hi,
>
> The following produces almost exactly what I needed. The problems are
> that the 'panel.dotplot' call (commented) generates the error 'Error in
> NextMethod("[") : argument "subscripts" is missing, with no default'. The
> other problem is that the colors alternate between the levels of the 'site'
> variable, rather than 'year'.
>
>
> barley$yield2 <- with(barley, yield + 5)
>
> dotplot(site ~ yield | variety, data=barley, groups=year,
> yield2=barley$yield2, col=c("gray", "black"),
> panel=function(x, y, subscripts, yield2, ...) {
> ## panel.dotplot(x, y, ...)
> panel.segments(x, as.numeric(y),
> yield2[subscripts], as.numeric(y), ...)
> })
>
> R> sessionInfo()
> Version 2.3.1 (2006-06-01)
> i486-pc-linux-gnu
>
> attached base packages:
> [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
> chron gmodels lattice
> "2.3-3" "2.12.0" "0.13-8"
>
>
> Can somebody please suggest how to properly make that 'panel.dotplot' call
> and set the 'col' argument? Thanks in advance.
>
>
> Cheers,
>
> --
> Seb
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 08 02:35:40 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 08 Jul 2006 - 04:15:22 EST.

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