Learning Quote of the Day

Learning is not attained by chance, it must be sought for with ardor and diligence.

  • Abigail Adams

Theme of the course

We’ll be working through problems together in class and discussing content from your reading assignments. This class may be different from other classes you take or your experiences in classrooms from the past. I prefer to think of myself as your guide on the side instead of the sage on the stage. I’m here to assist you as needed, but I don’t want to be the passer of all knowledge to you. In other words, I’m hoping to create an environment where you develop understanding based on each of your own needs rather than just dictating how and what to think to you.

Plicker time

Which plot for which problem set-up?

Question from PS5 - Question 1

Why do we still use the less efficient plots, like the side-by-side barplot, the stacked barplot, or even the pie-chart when there are much more effective plots, like the faceted barplot, to use? It just seems weird to me.

Question from PS5 - Question 2

geom_bar(position = "dodge") What does a dodge position?

Question from PS5 - Question 3

When playing with the code in Rstudio for chapter 4 i kept getting the error message that “ggplot” is not a package. I then proceeded to look in my packages and found that i have “ggplot2”. Long story short, i still don’t know how to get “ggplot” and was wondering how i would go about doing that?

R problems for practice

Getting set-up

  • Create a new R Markdown file
  • Clean out all of the default text in the document
  • Save it as dataviz-09-21.Rmd in your LastnameFirstname folder
  • This is where you will be putting your chunks of code.

Practice problem 1

  • Produce a histogram of the humidity recordings in the weather data frame with 15 bins, missing values removed, fill with a color of your choosing, and a border color of your choosing.

  • Describe in a few sentences how this plot is different from the last plot.

Practice problem 2 (CHALLENGE)

Produce the following boxplot:

  • What does this plot tell us about how the response variable differs by the different levels of the explanatory variable?

Practice problem 3

  • Install the okcupiddata package by typing install.packages("okcupiddata") into your R console.

  • Load the package via library(okcupiddata)

  • Load the data via data(profiles)

  • Produce a barplot of the status variable

Practice problem 4

  • Produce a barplot of the sex variable in the profiles data frame

Practice problem 5

  • Produce a faceted barplot of the status variable based on sex

CHALLENGE

  • Fill the faceted barplot based on drinks

One more step

library(dplyr); library(okcupiddata)
non_straight <- filter(profiles, orientation != "straight", status != "unknown")
ggplot(data = non_straight, aes(x = drinks, fill = sex)) +
  geom_bar() + facet_wrap(orientation ~ status)

Finish Lab 2 / Start on Lab 3

To do for next time

  • Complete corrections for Lab 2 by 3 PM tomorrow
  • Read Sections 4.5 and 4.6 of MODERN DIVE textbook
  • Complete PS6 by 10 AM on Monday
  • Begin work on Lab 3

Course (so far) evaluation