library(jsonlite)
# A JSON array of primitives
json <- '["Mario", "Peach", null, "Bowser"]'
# Simplifies into an atomic vector
fromJSON(json)[1] "Mario" "Peach" NA "Bowser"
Thank you for peer feedback! I had a lot of fun reading these.
Now online
Due November 13th
GitHub post (used for peer feedback) AND Brightspace
Three Weeks: don’t wait until the very end
Should be less demanding than MP #01 and MP#02
Pay attention to the rubric
Proposal feedback sent by email this afternoon. Please contact if not received.
Next Week: Mid-Term Check-In Presentations
Tentative Topics
Any requests?
Brightspace - Wednesdays at 11:45
Next pre-assignment is November 13th
Thank you for FAQs and (honest) team feedback. Keep it coming!
Change: MW Thursday Zoom OH will be 4:00pm to 5:00pm
No FAQs today. (New topic - data import)
From FiveThirtyEight
| Room | Team | Room | Team | |
|---|---|---|---|---|
| 1 | Rat Pack | 6 | Ca$h VZ | |
| 2 | Subway Surfers | 7 | Listing Legends | |
| 3 | Chart Toppers | 8 | TDSSG | |
| 4 | Metro Mindset | 9 | Broker T’s | |
| 5 | Apple Watch | 10 | EVengers |
Data can be found at https://raw.githubusercontent.com/fivethirtyeight/data/refs/heads/master/candy-power-ranking/candy-data.csv
Read into R (readr::read_csv) and make 3 plots:
RTwo topics:
🎃End a bit early for Halloween🎃
From abstrax.io
JSON:
JavaScript Object Notationdicts of dicts of dicts) than R data.framesExample:
{
"data": {
"id": 27992,
"title": "A Sunday on La Grande Jatte — 1884",
"image_id": "1adf2696-8489-499b-cad2-821d7fde4b33"
},
"config": {
"iiif_url": "https://www.artic.edu/iiif/2",
}
}
Read JSON in R with jsonlite package (alternatives exist)
$utc_offset
[1] "-05:00"
$timezone
[1] "America/New_York"
$day_of_week
[1] 3
$day_of_year
[1] 1
$datetime
[1] "2025-01-01T04:13:36.302497-05:00"
Compare to browser access
download.filefunction (url, destfile, method, quiet = FALSE, mode = "w", cacheOK = TRUE,
extra = getOption("download.file.extra"), headers = NULL,
...)
NULL
Basic file download capabilities:
url: sourcedestfile: where on your computer to store itmethod: what software to use in the background to downloadHTTP
ftp, smtp, ssh, …“Low-level” mechanism of internet transfer
R packages add a friendly UXhttr2 for low-level work (today)HTTP has two stages:
Modern (easy) APIs put most of the behavior in the URL
In Firefox: Right-Click + Inspect
In Chrome: Right-Click + Developer Tools
httr2httr2 (pronounced “hitter-2”) is low-level manipulation of HTTP.
Pretty simple so far:
example_url() starts a tiny local web host127.0.0.1 is localhostLive Demo Time
httr2 RequestsBuild a request:
req_methodreq_body_*req_cookies_setreq_auth_basic / req_oauthBehaviors:
req_cachereq_timeoutExecution:
req_performhttr2 ResponsesRequest status
resp_status / resp_status_descContent: - resp_header* - resp_body_*