
Today we will…
Look at the file extension for the type of data file.
.csv : “comma-separated values”
Name, Age
Bob, 49
Joe, 40
.xls, .xlsx: Microsoft Excel spreadsheet
readxl package . . ..txt: plain text
The tidyverse has nice functions for reading in data in the readr and readxl packages:
read_csv() is for comma-separated data.
read_tsv() is for tab-separated data.
read_table() is for white-space-separated data.
read_delim() is any data with “columns” (you specify the separator). The above are special cases.
read_excel() is specifically for dealing with Excel files.
Remember to load the readr and readxl packages first!
You have to tell R where to “find” the data you want to read in using a file path.
Quarto automatically sets the working directory to the be directory where the Quarto document is for any code within the Quarto document
This overrides the directory set by an .Rproj
Pay attention to this when setting relative filepaths
"../""../data/dat.csv"
readr and readxl cheatsheetsGraphics consist of:
Structure: boxplot, scatterplot, etc.
Aesthetics: features such as color, shape, and size that map other variables to structural features.
Both the structure and aesthetics should help viewers interpret the information.

Edward R. Tufte is a well-known critic of visualizations, and his definition of graphical excellence consists of:
Do not use rainbow color gradients!
Be conscious of what certain colors “mean”.


To colorblind-proof a graphic…
To colorblind-proof a graphic…


To colorblind-proof a graphic…


There are several packages with color scheme options:
These packages have color palettes that are aesthetically pleasing and, in many cases, colorblind friendly.
You can also take a look at other ways to find nice color palettes. ColorBrewer is my personal favorite.
https://www.data-to-viz.com/graph/area.html
https://r-graph-gallery.com/web-vertical-line-chart-with-ggplot2.html
https://r-graph-gallery.com/web-line-chart-with-labels-at-end-of-line.html
Starting with Lab 2, your labs will be graded more strictly on appearance and code format.
Review the lab formatting guidelines on Canvas before you submit your lab!
Big points: