[R] bwplot: how to get plotmath labels?

Marius Hofert m_hofert at web.de
Sat Mar 26 09:47:07 CET 2011


Dear expeRts,

How can I get plotmath-labels in the bwplot below?
As you can see, I couldn't manage to pass the expressions through the dimnames 
argument.

Cheers,

Marius


library(lattice)

## data
dim <- c(100, 6, 2, 3)
dimnames <- list(n=paste("n=", seq_len(100), sep=""),
	         groups=paste("group=", seq_len(6), sep=""),
	         methods=c(expression(method==1), expression(alpha=1)),
	         attr=paste("attribute=", seq_len(3), sep=""))
data <- rexp(prod(dim))
arr <- array(data=data, dim=dim, dimnames=dimnames)
z <- abs(sweep(arr, 3, 1))
df <- as.data.frame.table(z, responseName="error")

## box plot
bwplot(error ~ methods | attr * groups, data=df, 
       as.table=TRUE, outer=FALSE, strip=TRUE, notch=TRUE,
       scales=list(alternating=c(1,1), tck=c(1,0)))


More information about the R-help mailing list