Lecture 14
Duke University
STA 199 - Fall 2022
10/18/22
Clone your ae-11
project from GitHub, render your document, update your name, and commit and push.
Can be difficult to catch up on AEs if bits are missed.
Will post AE solutions after class instead of waiting for the deadline. You still need to attempt them to get points.
ae-10
When working in a Quarto document, your analysis is re-run each time you knit
If web scraping in a Quarto document, you’d be re-scraping the data each time you knit, which is undesirable (and not nice)!
An alternative workflow:
Two different scenarios for web scraping:
Screen scraping: extract data from source code of website, with html parser (easy) or regular expression matching (less easy)
Web APIs (application programming interface): website offers a set of structured http requests that return JSON or XML files
What are some functions you’ve learned? What are their inputs, what are their outputs?
mean()
multiply_by_two()
multiply()
temp_convert()
Repeat yourself:
Load package:
To apply the same function to multiple values (stored in an object like a vector), use map()
functions:
map()
returns a list
map_lgl()
, map_int()
, map_dbl()
and map_chr()
return an atomic vector of the indicated type (logical, integer, double, or character, respectively)
map_dfr()
and map_dfc()
return a data frame created by row-binding and column-binding, respectively
ae-11
ae-11
(repo name will be suffixed with your GitHub name).