Get startedGet started for free

Survey-weighted histograms

If we want to understand the distribution of nightly sleep for Americans, we should construct a histogram. Let's do that now and see the impact of changing the width of the bins.

This exercise is part of the course

Analyzing Survey Data in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a histogram with a set binwidth
ggplot(data = ___,
       mapping = aes(___)) + 
	geom_histogram(binwidth = ___,
                   color = "white") +
	labs(x = "Hours of Sleep")
Edit and Run Code