[R] How to use: library lattice: barchart

paladini at rz.uni-potsdam.de paladini at rz.uni-potsdam.de
Tue Mar 21 17:36:22 CET 2006


Thank you both very much. It has to be "abarley =
data.frame(cbind(as.numeric(ayield),avariety,ayear,asite))".
Than the plot looks really fine!

Best regards

clauida


Zitat von Robert Baer <rbaer at atsu.edu>:

> > it looks totaly different and I get the error message:
> > "x should be numeric in: bwplot.formula(x = ayield ~ avariety | asite,
> > data = list(ayield = c(2,"
> 
> -------------------
> 
> > cbind(some numeric and not numeric columns)
> >
> > gives you all columns to be character and when you make data.frame
> > from it it is converted to factors.
> >
> > so
> >
> > > abarley = data.frame(ayield,avariety,ayear,asite)
> >
> > brings you close but than you need ayear to be factor. Either convert
> > it in data frame or on fly
> Actually, as the warning suggests, you have all factors in the dataframe but
> you need to convert ayield to a numeric.  Something like,
> 
> abarley = data.frame(cbind(as.numeric(ayield),avariety,ayear,asite))
> 
> >
> > barchart(ayield ~ avariety | asite, data = abarley, groups =
> > factor(ayear), layout = c(1,5) )
> >
> > HTH
> > Petr
> 
> 
> ____________________________
> Robert W. Baer, Ph.D.
> Associate Professor
> Department of Physiology
> A. T. Still University of Health Science
> 800 W. Jefferson St.
> Kirksville, MO 63501-1497 USA
> 
> 
>




More information about the R-help mailing list