Get access to all lessons in this course.
-
RMarkdown
- Why Use RMarkdown?
- RMarkdown Overview
- YAML
- Text
- Code Chunks
- Wrapping Up
-
Data Wrangling and Analysis
- Getting Started
- The Tidyverse
- select
- mutate
- filter
- summarize
- group_by
- count
- arrange
- Create a New Data Frame
- Crosstabs
- Wrapping Up
-
Data Visualization
- An Important Workflow Tip
- The Grammar of Graphics
- Scatterplots
- Histograms
- Bar Charts
- color and fill
- scales
- Text and Labels
- Plot Labels
- Themes
- Facets
- Save Plots
- Wrapping Up
-
Wrapping Up
- You Did It!
Fundamentals of R (v1)
Bar Charts
This lesson is locked
This lesson is called Bar Charts, part of the Fundamentals of R (v1) course. This lesson is called Bar Charts, part of the Fundamentals of R (v1) course.
If the video is not playing correctly, you can watch it in a new window
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Your Turn
Complete the bar chart sections of the data-visualization-exercises.Rmd file.
Learn More
Bar Chart Resources
You can also find examples of code to make bar charts on the Data to Viz website , the R Graph Gallery website , and in Chapter 3 of the R Graphics Cookbook. Michael Toth also has a detailed blog post about making bar charts with ggplot.
You need to be signed-in to comment on this post. Login.
Allison Brenner
March 25, 2021
I keep getting an error message "attempt to use zero-length variable name". When I get this it's usually some small thing I missed, but I missed things last week and didn't get this message. I'm wondering why I'm seeing this now, and what exactly it means. Also, suddenly I don't get R Studio's automatic prompts when I begin writing a command. For example, when I start "summarise(" it doesn't prompt with the options for the command. Any ideas why I might be experiencing these changes? I have started a new R session and changed the defaults as you indicated in the lessons, but otherwise haven't made any intentional changes in how I am using R.
Nithin Pradeep
October 7, 2021
Hii David, I have a survey dataset with me. The survey has got 4 sections. I want the data to be visualised in such a way that I have "Male" and "Female" in the x-axis and the average sectional scores on y-axis. Can you help me with this?
Nadia Chang
October 13, 2022
For this exercise I gave the data frame and the new variable the same name, but I got the same result. Why this happened? could this give you any trouble later? But I see it's better to give different names.
Emma S
October 19, 2022
I noticed the code works without putting "mapping=" before aes--is this a bad habit to leave it out? This worked for me:
nhanes %>% ggplot(aes (x=smoke_now)) + geom_bar()