Quiz 3 Study Guide

Weeks 9 - 10

Author
Affiliation

Dr. Robin Donatello

Chico State
DATA 385 - Fall 2026

Published

November 1, 2026

What to expect

Quiz 3 covers data privacy (week 9) and scraping, functions, and iteration (week 10). You are allowed one page of notes.

Topic summaries

Data privacy

Personal data is anything that can be linked back to a person. Taking the name off does not always make data anonymous, and a prompt you send to an AI tool is a disclosure.

  • “Anonymous” is not always anonymous. One column may not identify you, but a combination can. ZIP code, birth date and sex together are enough to identify most people in the US.
  • Only paste public information, fake data, de-identified data, and generic code into an AI tool. If you are not sure whether data is sensitive, assume it is.
  • Know what each law protects and who has to follow it:
    • HIPAA: health information held by health care providers and health plans
    • FERPA: student education records, such as grades and transcripts
    • CCPA: personal information of California residents, collected by large for-profit businesses
    • GDPR: personal data of people in the EU, no matter where the company is
  • To study a rule, ask the same questions each time: whose data does it protect, what counts as protected, who has to follow it, what does it require or allow, and how strong is the enforcement.

Scraping

Before you scrape, decide whether you should, not only whether you can. Public is not the same as okay.

  • The checklist: robots.txt, terms of service, what data it is, load, and an official alternative.
  • robots.txt is a request to robots, not a lock. If it allows a page, the terms of service still apply.
  • A clear “no” in the site’s own rules ends it. An LLM cannot give permission that only the site can give.
  • Be kind to the server. Request only the pages you need, pause between requests, and save what you scrape so you do not request it again every time you render.
  • If the site offers a download or an API, check that first.
  • Key functions: read_html(), html_table(), html_element() and html_elements(), html_text(), html_attr()
  • html_table() gives you a list with one data frame per table. html_text() pulls out the visible text, and html_attr("href") pulls out the web address behind a link.

Functions

A function takes inputs, does some steps, and gives you back a result. Write one when you have copied and pasted the same code more than twice.

  • Parts of a function: the name, the arguments inside function(), and the steps inside the curly braces.
  • A function returns the last value it computes.
  • An argument with a default value is optional. An argument with no default has to be given a value when you call the function.
  • Predict what a call returns before you run it. Check which value goes with which argument.

Iteration

Iteration means running the same function over many inputs, like many web pages.

  • map(x, f) runs the function f on each element of x. The first argument is what you map over, and the second is the function.
  • Extra arguments you add after the function are passed to it on every call.
  • The result type depends on the variant: map() gives a list, map_dbl() gives a numeric vector, and map_chr() gives a character vector. If the function’s result does not fit the type, you get an error.
  • Mapping a function that returns a data frame gives a list of data frames. list_rbind() stacks them into one.

Advice on how to prepare

  • Predict, then check. Write a small function and call it with a missing argument, a swapped order, and an extra value. Write down what you expect, then run it.
  • Re-read the checklist. Go through the five items on a site you use and decide, with reasons, whether you would scrape it.
  • Redo AE08 and HW 4. Explain what scrape_prop() and map() do on each line.
  • Explain it to a classmate without looking. If you can’t, that’s the topic to review.
  • Your one page of notes: make it yourself, organize it by task, and put a tiny example next to each rule.