Skip to content
Back to formatted view

Raw Message

Message-ID: <loom.20090212T133957-398@post.gmane.org>
Date: 2009-02-12T13:41:43Z
From: Dieter Menne
Subject: barplot() x axes are not updated after removal of categories	from the dataframe

R User R User <ruser2008 <at> googlemail.com> writes:

> I am plotting categories (X axis) and their mean count (Y axies) with
> barplot().
> 
> The first call to barplot works fine.
> 
> I remove records from the dataframe using final=[!final$varname == "some
> value",]
> 
> I echo the dataframe and the records are no longer in the dataframe.
> 
> When I call plot again however, the X axis still contains the removed
> category values albeit with a count of 0.
> 
> How can I stop the removed categories appearing in the barplot? Are they
> stored globally after the first barplot call?
> 

It has do do with non-dropped factors.

See http://markmail.org/message/qdgjpuzcfia3xm6p

Create a new factor with the levels dropped. 

Dieter