[R] Hmisc xYplot won't do conditioning on factors?
Ivan Adzhubey
iadzhubey at rics.bwh.harvard.edu
Fri Feb 29 04:07:36 CET 2008
Hi,
Since nobody replied, I'd rather post this self-reply for the sake of
documenting the solution.
It appears that xYplot, unlike "standard" xyplot (or coplot to that matter)
does not accept factors as x variable in formula. With x converted to numeric
everything worked as expected. This small discrepancy was not documented on
xYplot help page.
--Ivan
On Tuesday 26 February 2008 07:47:14 pm Ivan Adzhubey wrote:
> Hi,
>
> I am trying to replace (lattice) standard xyplot with xYplot variant from
> Hmisc package to be able to add error bars to my plots. However, this does
> not work, e.g:
>
> library(lattice)
> d <- data.frame(
> SKU=gl(3, 1, 21, labels=c("a", "b", "c")),
> Weekday=gl(7, 3, 21),
> QCRate=runif(21))
>
> xyplot(QCRate ~ Weekday | SKU, data=d)
>
> (this plots nice 3 panels as per a,b,c conditionals)
>
> library(Hmisc)
>
> > xYplot(QCRate ~ Weekday | SKU, data=d)
>
> Error in Summary.factor(1:7, na.rm = TRUE) :
> range not meaningful for factors
>
> Is there a workaround?
>
> Thanks,
> Ivan
More information about the R-help
mailing list