Error stat count must not be used with a y aesthetic

0 votes
Error: stat_count() must not be used with a y aesthetic.

The above error pops up while drawing bar graph. I used mpg dataset to draw bar chart of displ vs cyl.
Aug 16, 2019 in Data Analytics by rayan
9,349 views

1 answer to this question.

0 votes

Hi Rayan,

This error comes due to the mapping of elements in aes() while plotting barplot.

geom_bar by default takes a count of values as y in a bar plot. So use stat="identity" within barplot() to avoid the default and use fields as used in mapping function.

ggplot(data,aes(field1,field2)) +geom_plot(stat="identity")
answered Aug 19, 2019 by anonymous
• 33,030 points

Related Questions In Data Analytics

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer

Error saying "R Error: package ‘lme4’ required by ‘pbkrtest’ could not be found"

Windows 7, revo R 3.2.3 construct a directory ...READ MORE

answered Nov 9, 2018 in Data Analytics by Maverick
• 10,840 points
561 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
2,014 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,622 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9, 2020 by Gitika 908 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
1,014 views
+1 vote
2 answers

How to count the number of elements with the values in a vector?

Use dplyr function group_by(). > n = as.data.frame(num) > ...READ MORE

answered Aug 21, 2019 in Data Analytics by anonymous
• 33,030 points
4,578 views
0 votes
2 answers

How to remove rows with missing values (NAs) in a data frame?

Hi, The below code returns rows without ...READ MORE

answered Aug 20, 2019 in Data Analytics by anonymous
• 33,030 points
14,434 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP