From the course: R for Data Science: Analysis and Visualization

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Creating bar charts

Creating bar charts

- [Instructor] When working with data, it's a beautiful thing to keep things simple and the simplest kind of data is nominal or simply counting data. And the simplest kind of chart for that is a bar chart. Let me show you how to do these in our using the base graphics that are included with her. We'll start by loading the tidyverse and the readxl package to bring in our data set. And I'm going to read in our state trends data set I'm also going to do a little transformation here. I'm going to use this command mutate which means I'm going to make changes to the data across, means I'm going to use several variables and then I'm specifying here that I want to do region through psych region. So that's actually just three variables and then I am turning them into factors. So let's run that command. And when we look at the data you can see that, for instance, region is now a factor. Psych region is a factor and psy_reg is a…

Contents