Lab 6: Import, Parse, and Explore
Load the hate-crime files, parse a few strings, and explore diamonds.
Work in a Quarto document. Do 6.1
through 6.3 first. Put the course CSV files in a
data/ folder of your project (see the Data section of the
course page).
library(tidyverse)
1. Import
read_lines()onhate_crimes1.csvthroughhate_crimes7.csvandhate_crimes_1a.csv. Then load each with the matchingread_*(). Checkhead()and the number ofNAs per column.- Load
hate_crimes_1a.csvonce as-is and once withna = "missing". What changed?
2. Parsers
- Parse
"01, January 2018","01-January/2000", and"1 Jan 19"as dates. - Parse
"10:40 pm"and"23:40-22"as times. - Load
estate.csv. Useproblems()if anything looks off. Setcol_typesfor at least one column.
3. EDA
Using diamonds (or estate if you
prefer):
- The distribution of one categorical variable and one quantitative variable.
- A scatterplot of two quantitative variables, with overplotting handled.
- A boxplot of a quantitative variable by a categorical variable.