r - Remove Bars with Small Counts from Bar Chart in ggplot2 -


i make bar chart factor lots of levels. exclude factors have small number of occurrences. can making new data frame, there way ggplot2 internally?

i have tried using limits, ..count.., etc.

here example:

#### has 4 levels remove bins 1 observation ### df<-data.frame(x=as.factor(c(rep("a",4),rep("b",5),rep("c",2), rep("d",1)))) p<-ggplot(df)+geom_bar(aes(x))  ###### gives correct thing, had make new data frame ###### new.df<-subset(df, x%in%levels(df$x)[table(df$x)>1]) p<-ggplot(new.df)+geom_bar(aes(x)) 


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -