O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating bar graphs

Bar charts are usually used to explore how one (or more) categorical variables are distributed. In ggplot, the geom_bar geometry counts the number of occurrences of each factor variable that appears in the data. This recipe shows you how to create bar graphs that enable segment-wise comparisons with different variable types.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required