[R] Re: Need some quick help with lattice - barchart
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Thu May 5 21:05:22 CEST 2005
Deepayan Sarkar wrote on 5/5/2005 12:03 PM:
> 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
>
Hi Deepayan,
That was my original thought too. But when I tried it I got:
Error in unit(x0, default.units, units.per.obs) :
'x' must be numeric
Changing horizontal to TRUE produces the plot, but I'm sure that's not
what Sandeep wants.
--sundar
More information about the R-help
mailing list