[R] lattice: limits in reversed order with relation="same"

Thaler, Thorn, LAUSANNE, Applied Mathematics Thorn.Thaler at rdls.nestle.com
Mon Aug 30 12:56:23 CEST 2010


> No (in fact that wouldn't work anyway), you can simply do
> 
> xyplot(y~x|z, xlim = rev(extendrange(x)))
> 
> The point is that in this case you have to explicitly specify a
> pre-computed limit, and cannot rely on the prepanel function to give
> you a nice default.

Thanks that does the trick. Because I'm curious: is extendrange(x) the default way to calculate the limits if not given?

By the way, it would be very nice if one could write


df <- data.frame(x=1:3, y=2:4, df.col=3:5)
xyplot(y~x, data=df, col=df.col)

instead of 

xyplot(y~x, data=df, col=df$df.col)

which is a common mistake I make assuming that providing the data argument to a lattice command allows for omitting the name of the data.frame in all parts of the argument list not just in the formula part. Is there a reason why this is not the default behavior?

Thanks again + BR

Thorn




More information about the R-help mailing list