library(tidyverse)Answers - Excercise 00
exercise 00:
- Load the tidyverse libary package
- Fill in the blanks. Using what you’ve seen in class, if
data/brodheadCenter.csvis a CSV (comma separated values) file, how would you load the file into a new object calledbrodhead?
brodhead <- read_csv("../../data/brodheadCenter.csv")- Display your new
brodheaddata frame?
brodheadstarwarsis an on-board dataset that comes with the tidyverse. Insert a new code chunk and display that data.
starwars- 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")
- Take a look at the structure of the
brodheadobject.- How many observations (rows) are there?
- How many variables (columns) are there?
- How many of the variables are numeric data?
glimpse(brodhead)Rows: 59
Columns: 7
$ name <chr> "Devils Krafthouse", "Devils Krafthouse", "Devils Krafthouse"…
$ type <chr> "bar and grill", "bar and grill", "bar and grill", "bar and g…
$ menuType <chr> "appetizer", "appetizer", "appetizer", "appetizer", "appetize…
$ itemType <chr> "snack", "snack", "snack", "snack", "snack", "snack", "snack"…
$ itemName <chr> "sweet potato tots", "french fries", "quesadillas", "southwes…
$ cost <dbl> 4, 4, 6, 8, 7, 8, 9, 4, 9, 9, 9, 8, 4, 7, 7, 7, 8, 8, 9, 9, 9…
$ rating <dbl> 8, 10, 5, 6, 7, 8, 5, 6, 5, 5, 6, 6, 8, 6, 7, 5, 6, 5, 4, 5, …