On Thu, Aug 25, 2011 at 6:15 PM, markm0705 <markm0...@gmail.com> wrote:
> I've been building a ranked dot plot for several days now and am sorting the
> data using the reorder command.  What I don't understand is how reorder
> works when mutiple varibles are plotted by grouping.  In the example below
> I'm using re-order to sort by a variable name Resv_Prop, but I'm plotting up
> to three different values of Resv_prop (different Year values) for each
> factor.
>
> The results are not what i expected and I would like to control the sorting
> by the 2010 Year values.

reorder() does have a FUN argument that let's you define a summary
measure that is used for sorting when multiple observations are
present per group. Unfortunately, this will not help you here.

However, once you realize that all you really need are the levels() of
your y-variable in the right order, you can finesse the problem as
follows:

Cal_dat_2010 <- subset(Cal_dat, Year == 2010)

tmp <- with(Cal_dat_2010, reorder(paste(Mine,Company), Resv_Prop))

with(Cal_dat,
     dotplot(factor(paste(Mine,Company), levels = levels(tmp)) ~ Resv_Prop,
             groups = factor(Year), auto.key = TRUE))

-Deepayan

______________________________________________
R-help@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.

Reply via email to