Chapter 7 Data Visualization

We are finally at making graphs! It’s definitely nerd shit but whatever!

Chapter 7 of your text starts with a little recap of dplyr which is the program containing the Wickam 6, so it’d be good to do that. Then proceed onwards

7.1 Goals

  • Review dplyr functions

  • Set up your workspace

    • saving objects

    • inner_join

    • select

    • read_csv

  • mutate variables from numeric to factor

  • make a bar plot with ggplot and aes functions

  • use geom functions to create layers in ggplot

  • add color to bar plots, name axes, toggle legend

  • try violin box plot

7.2 Tasks

Task 1: Possibilities

Read 7.3. Data visualization is important and I think this passage reflects that. We will be working with ggplot throughout the next few units and it’s a bit quirky in that it’s an older function (so pipes don’t work for instance).Please check out this website and click around a bit. It shows you some of what ggplot and r is capable of and provides the general code frameworks for you to create these yourself.

Task 2: Setting up the workspace

Complete 7.4. It’s basically just loading in all of your data, combining multiple datasets, selecting variables you are interested in, and saving them as an object (dataframe) you we can easily work with.

Task 3: Scales of measurement

Complete 7.5, it hits on something super important when working with ggplot compared to other programs we might use to make plots. If you see in the tibble displayed in 7.5 all variables are numeric……but R uses different labels for numbers like dbl (for whole numbers) and factor for variables describing different groups or categories. Using the mutate function helps us out with this. Ggplot hates when you try to use numeric instead of factors so again, be super purposeful in the creation of you dataframes.

Task 4: Make bar plot and violin boxplot

Complete 7.6-7.8, These will take you through making and editng some simple bar plots and a violin plot.