Lecture 5
NC State University
ST 511 - Fall 2024
2024-09-04
– Are you keeping up with the prepare material?
– Are you posting on Slack?
– Take advantage of TA office hours!
– Data Viz quiz due Sunday
– HW-1 due Sep 8th on Gradescope
– Pull up today’s slides + follow along!
HW-1 question 1b
Create a data frame that displays the minimum and maximum lot area, in acres. Name your columns min_lot and max_lot.
The acres column is in square feet. It is fine to leave the units as square feet for this question.
The workbench license went through (last last week)
You can still use local install if you would like
HW-1
-- Gradescope is set up; Mark all pages associated with each exercise
-- Do not select any pages of your PDF submission to be with Workflow + Formatting
AE
-- Solutions from last week are posted
-- Will be posted shortly after quiz due date
New resources
– Functions + Arguments
– Tidyverse stylings (also was prepare material)
Practice reading the following code as a sentence
– More plots!
– More practice with R
Based on the style guide, how can the code below be improved?
A bar chart or bar graph is a chart or graph that presents categorical data with rectangular bars
The bars represent either counts or a proportional value
There are two types of bar charts: geom_bar()
and geom_col()
geom_bar()
performs a statistical transformation to your data before plotting (i.e., it counts up the cases for you)
geom_col()
uses stat_identity(): it leaves the data as is.
# A tibble: 3 × 2
species count
<fct> <int>
1 Adelie 152
2 Chinstrap 68
3 Gentoo 124
The bars represent either counts or a proportional value
we can do this within the geom
function!
This is a little more nuanced in just a bar chart. We need to calculate the proportions ourselves before plotting. This can be a separate resource / in Slack for those interested.