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

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Fri 06 May 2005 - 05:05:22 EST

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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri May 06 05:10:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:36 EST