Skip to content
New course: Interactive Dashboards with Shiny. Get 50% off with coupon SHINYLAUNCH.
R for the Rest of Us Logo

This lesson is locked

Get access to all lessons in this course.

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 histogram sections of the data-visualization-exercises.Rmd file.

Learn More

Histogram Resources

You can find examples of code to make histograms on the Data to Viz website , the R Graph Gallery website , and in Chapter 6 of the R Graphics Cookbook , and Chapter 7 of the Fundamentals of Data Visualization.

To learn about more statistical transformations, Chapter 3 of R for Data Science has a discussion of them.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Atlang Mompe

Atlang Mompe

April 5, 2021

Hi David, I don't think I quite understand bins - as when the graph changes from bins =100 to bins =10, I thought the x axis would change, so what exactly is being group? Thank you for the further clarification. Atty.

David Keyes

David Keyes

April 5, 2021

The x axis doesn't change because the range of data plotted on the x axis doesn't change, it's just the number of buckets we put it into that does. Does that help? This overview of how histograms work might also be helpful to you.

Kateryn Pino

Kateryn Pino

April 8, 2021

Hi David, everything is ok. Just this message appears... Removed 78 rows containing non-finite values (stat_bin). What is that mean?

David Keyes

David Keyes

April 8, 2021

Great question! It means that there were 78 observations that had NA for the weight variable so they were not included in the plot. Nothing went wrong, it's just an informational message.

Kateryn Pino

Kateryn Pino

April 15, 2021

Thanks David!

Louise Blight

Louise Blight

April 9, 2021

There's an informational pop-up in the exercises file (at line 63 in my code) that reads " stat_bin() using bins = 30. Pick better value with binwidth ". Should this read bins instead of binwidth? I tried the latter and it seems to code for the actual width of the bins - no surprise I guess - instead of the number of bins we're adjusting in this exercise.

David Keyes

David Keyes

April 10, 2021

You can actually do both! To be honest, I'm not super great with the rationale for why you'd want to do one or another, but try them both and see what happens!