[R] strip.custom() with more than one conditioning variable

p_connolly at slingshot.co.nz p_connolly at slingshot.co.nz
Thu Nov 15 21:53:15 CET 2012


Suppose I wanted to plot the barley data like this:

    dotplot(variety ~ yield | year+ site, barley,
            strip = strip.custom(style = 4))

The factor levels are far too long for that to be useful.  I can
overcome that problem if I shorten the levels like this:

    dotplot(variety ~ yield | year + site, barley,
            strip = strip.custom(style = 4,
              factor.levels =  substring(levels(barley$site), 1, 1)))

But that messes up the year levels.  So I try to have it influence
only the site levels:

    dotplot(variety ~ yield | year+ site, barley,
            strip = strip.custom(which.given = 2, style = 4,
              factor.levels =  substring(levels(barley$site), 1, 1)))

But then the year strip is omitted altogether.  How do I specify
a different list for different which.given numbers?

In this case, I know I could simply redefine the levels in the factor
but that's not an option where I wish to apply this method.

TIA
Patrick



More information about the R-help mailing list