I want to create a bar chart such that the x-axis contains the different engine_type and the y-axis contains the count. Data frame (DEU_2001_df) below:
Year engine_type count
1 2001 petrol_number 2185247
2 2001 diesel_gas_number 1155300
3 2001 full_mild_hybrid_number 606.
4 2001 plugin_hybrid_number 0
5 2001 battery_electric_number 56
When using the following line:
ggplot(DEU_2001_df, mapping = aes(x = 'engine_type', y = 'count')) +
geom_bar(stat = "identity")
Steps taken as above.
>Solution :
Use variable name without inverted commas:
engine %>% ggplot(aes(x = engine_type, y = count)) + geom_bar(stat = 'identity')
