[R] ggplot2 - geom_bar
Matthias Rieber
ml-r-project at zu-con.org
Tue Apr 24 07:04:33 CEST 2012
On 23.04.2012 20:55, Brian Diggs wrote:
> On 4/23/2012 9:24 AM, Matthias Rieber wrote:
>> Hello,
>>
>> I've some problem with the ggplot2. Here's a small example:
>>
>> [...]
>> Is it wrong to use geom_bar with that kind of data? I could avoid this
>> issue when I cast the data.frame, but I like to avoid that solution.
>
> There is nothing wrong with using bars with this sort of data. There
> is a bug in the faceting code of 0.9.0 that will be fixed in 0.9.1
> (see https://github.com/hadley/ggplot2/issues/443 ) which caused
> duplicate rows of data to be dropped when there was faceting. That is
> what you are seeing in the second example; row 6 is identical to row 7
> and is dropped before plotting. One easy workaround until 0.9.1 comes
> out is to add unique column to the data that is otherwise ignored:
>
> molten <- data.frame(date=c('01','01','01','01',
> '02','02','02','02'),
> channel=c('red','red','blue','blue',
> 'red','red','blue','blue'),
> product=c('product1','product2',
> 'product1','product2',
> 'product1','product1',
> 'product1','product2'),
> value=c(1,1,1,1,
> 1,1,1,1),
> dummy=1:8)
>
Thanks! That worked.
Matthias
More information about the R-help
mailing list