Apprentice Piece with Lattice Graphs

[This article was first published on theBioBucket*, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Lattice graphs can be quite tedious. I don’t use them too often and  when I need them I usually have to dig the archives for the parameter-details.
The here presented example may serve as a welcome template for the usage of panel functions, panel ordering, for drawing of lattice keys, etc.
You can download the example data HERE.

(Also, check this resource with examples by the lattice-author himself). 














library(lattice)
df <- read.csv("PATH/TO/Downloads/lattice_data.csv",
               header = T, sep = ";")
mypch <- rep(21, 3)
mycol <- c(rgb(0.2, 0.8, 0.9), rgb(0.8, 0.2, 0.9), rgb(0.9, 0.2, 0.2))

stripplot(mean ~ group1 | item_parc, groups = group2, data = df,
          type = c("a", "p"), strip = strip.custom(strip.names = c(F, T)),
          ylab = "Score-Mittelwert", layout = c(2, 4),
          scales = list(y = list(cex = 0.9),
                        x = list(cex = 1.1, labels = c("männl.", "weibl."),
                        tck = c(1, 0))),
          par.strip.text = list(cex = 0.9),
          panel = function(...) {
             panel.stripplot(..., col = mycol, pch = mypch, fill = mycol)
          },
          index.cond = list(c(7,8,5,6,3,4,1,2)),
          key = list(space = "bottom", text = list(c("Alter < 35 J.",
                                                     "Alter 35-50 J.",
                                                     "Alter > 50 J.")),
                     points = list(col = mycol, cex = 0.8, pch = mypch, fill = mycol),
                     rep = F))

To leave a comment for the author, please follow the link and comment on their blog: theBioBucket*.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)