Thanks very much for your input.

On 30/03/2009, at 12:29 PM, Felix Andrews wrote:

Modifying your example...


library(lattice)
set.seed(42)
XX <- data.frame(y=runif(300,0,10),a=factor(sample(letters[1:3],300,
                                           TRUE,c(0.5,0.3,0.2))))
XX <- rbind(XX,XX)
XX$gps <- rep(c("count","percent"),each=300)
print(histogram(~y|a*gps,as.table=TRUE,data=XX,
panel=function(x,...,type) {
panel.histogram(x,...,type=c("count","percent") [current.row()])
       }
))


but the use of current.row() breaks if the layout changes.

        I kind of get the feeling that doing what I want will require
        constant ad hoc adjustment, so this is not really a worry.

Also, the y scales are the same here for count and percent data, which
may not be appropriate.

        Indeed.  The thought had crossed my mind ....

You may have to set the y scales for each panel explicitly.

        Yes, I'd like to ... but I can't figure out how.  I tried
        a bit of an experiment and got the impression that
        panel.histogram() did not respond to specifications of ylim.
        I may just have done something silly ....

Or, another option is:

a <- histogram(~y|a, data = XX, subset = gps=="count", type="count")
b <- histogram(~y|a, data = XX, subset = gps=="density", type="density")
library(latticeExtra)
update(c(count=a, density=b), layout=c(3,2), ylab=c("count", "density"))

        That looks very interesting; I'll give it a try.

        Thanks.

                cheers,

                        Rolf

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@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.

Reply via email to