p_connolly at slingshot.co.nz
2012-Nov-15 20:53 UTC
[R] strip.custom() with more than one conditioning variable
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
Duncan Mackay
2012-Nov-15 23:29 UTC
[R] strip.custom() with more than one conditioning variable
Hi Patrick Not sure what you finally want to achieve but will this do? I have reduced the size of the text to make them readible dotplot(variety ~ yield | year+ site, barley, strip = strip.custom(which.given = 2, style = 4, factor.levels = paste(levels(barley$year), substring(levels(barley$site), 1, 1)), par.strip.text = list(cex = 0.75)) ) Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mackay at northnet.com.au At 06:53 16/11/2012, you wrote:>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 > >______________________________________________ >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.
Possibly Parallel Threads
- [FORGED] Extracting specified pages from a lattice ("trellis") object.
- [FORGED] Extracting specified pages from a lattice ("trellis") object.
- [FORGED] Extracting specified pages from a lattice ("trellis") object.
- lattice: showing panels for factor levels with no values
- dotplot (lattice) with panel.segments and groups