Exercise 0

Author
Affiliations
John R Little

Duke University

Published

January 6, 2023

Goals:

ANSWER can be found in exercise_00_answers.Rmd file

Exercise: Data Structures & Vector Types

  1. Load the tidyverse libary package
library(tidyverse)
  1. Fill in the blanks. Using what you’ve seen in class, if data/brodheadCenter.csv is a CSV (comma separated values) file, how would you load the file into a new object called brodhead?
_____  <- read_csv(________)
  1. Display your new brodhead data frame?
  1. starwars is an on-board dataset that comes with the tidyverse. Insert a new code chunk and display that data.

  2. Copy and paste the following code into a new code chunk in your new file.

starwars %>% 
  ggplot(aes(fct_infreq(hair_color))) + 
  geom_bar() + 
  ggtitle("Hair Color Frequency of Star Wars Characters")

BONUS

  1. Take a look at the structure of the brodhead object.

    • How many observations (rows) are there?
    • How many variables (columns) are there?
    • How many of the variables are numeric data?

    HINT: You can use the glimpse() function

ANSWER can be found in exercise_00_answers.Rmd file