Ggplot2 geom_bar plot where..count .. greater than X
2 answers
If I understood your question correctly (you didn't provide the example data), the simplest way is to create the dataframe you want to plot outside of ggplot. So
##Example data
items = data.frame(itemname = sample(LETTERS[1:5], 30, replace=TRUE))
##Use table to count elements
items_sum = as.data.frame(table(items))
Then sketch
X = 4
ggplot(items_sum[items_sum$Freq > X,], aes(x=items,y=Freq)) +
geom_bar(stat="identity")
+1
source to share