[R] Re: Need some quick help with lattice - barchart

Deepayan Sarkar deepayan at stat.wisc.edu
Thu May 5 21:03:45 CEST 2005


On Thursday 05 May 2005 13:10, Ghosh, Sandeep wrote:
> For the following code below, the x-axis ticks are 1,2,3,4,5,6,7 when I was
> expection them to be 1,2,8,9,10,11,12. Please help me figure out where is
> the mistake.
[...]
> colnames(testdata) <- c('month', 'year', 'mean','stdDev','miceCount')
> testdata$month <- as.numeric(testdata$month)
[...]
> with(testdata, print(barchart(as.numeric(mean) ~ month | year,
> data=testdata, layout=c(1,length(levels(year))),
>     horizontal=FALSE,
[...]

'month' is numeric, so it's being coerced to be a shingle. Try using 
'factor(month)' instead in the formula.

Deepayan




More information about the R-help mailing list