UC San Diego
COGS 137 - Fall 2026
2026-10-28
Due Dates:
Note: - lab03 (check feedback on GH issue) and lab04 grades posted
Note: We’ll discuss oral communication closer to the end of the quarter, when you’ll have to present out loud.
❓ What does it mean to “consider your audience?”
Simply: You do the work so they don’t have to.
…also the aesthetic-usability effect exists: people perceive polished, attractive work as easier to use (and are more forgiving of its flaws).
General Audience
✔ background
🚫 limit technical details
🎉 emphasize take-home

Technical Audience
⬇ limit background
💻 all-the-details
🎉 emphasize take-home

In written reports: Balance b/w short and informative (goal: concise)
Avoid: “Analyzing NHANES”
Better: “Data from the NHANES study shows that diet is related to overall health”
On visualizations: emphasize the take-home! (what’s learned or what action to take)
Avoid: “Boxplot of gender”
Better: “Twice as many females as males included for analysis”
Avoid: “Tickets vs. Time”
Better: “Staff unable to respond to incoming tickets; need to hire 2 FTEs”
Your audience has time to process…but the explanation has to be there!
Visually: more on a single visualization
Yes, often there are different visualizations for reports/papers than for presentations/lectures.
❓ What makes this an effective visualization for a written communication?
Source: Storytelling with data by cole nussbaumer knaflic
---
title: "Document Title"
format:
html:
toc: true
toc-depth: 3
---
---
title: "Document Title"
format:
html:
theme: united
highlight-style: tango
---
---
title: "Document Title"
format:
html:
fig-width: 7
fig-height: 6
---
---
title: "Document Title"
format:
html:
code-fold: true
---
.html file---
title: "Document Title"
format:
html:
embed-resources: true
---
_files/ folder…and break if the .html is shared/submitted on its ownWarning
GitHub does not render .html files. Clicking your report on GitHub shows the source code. That’s expected! It doesn’t mean your render failed. Download the file and open it in a browser to check it.
#|eval: whether to execute the code chunkecho: whether to include the code in the outputinclude: false: run the code, but show nothing (code or output) in the rendered document. Great for setup chunks (e.g., loading packages)warning, message, and error: whether to show warnings, messages, or errors in the rendered documentfig-width and fig-height: control the width/height of plotsfig-cap: add a caption to a figure---
title: "Document Title"
execute:
warning: false
message: false
---
Typing numbers into your text by hand means they go stale (or are just wrong!) when your data or analysis changes.
Instead, compute them with inline code:
The mtcars dataset includes `r nrow(mtcars)` cars, with an average fuel efficiency of `r round(mean(mtcars$mpg), 1)` mpg.…which renders as:
The mtcars dataset includes 32 cars, with an average fuel efficiency of 20.1 mpg.
The numbers in your conclusions are always the numbers from your analysis.
When are citations needed?
“We will be doing our analysis using two different data sets created by two different groups: Donohue and Mustard + Lott, or simply Lott”
“Right to Carry Laws refer to laws that specify how citizens are allowed to carry concealed handguns when they’re away from home without a permit”
“In this case study, we are examining the relationship between unemployment rate, poverty rate, police staffing, and violent crime rate.”
“In the United States, the second amendment permits the right to bear arms, and this law has not been changed since its creation in 1791.”
“The Right to Carry Laws (RTC) is defined as”a law that specifies if and how citizens are allowed to have a firearm on their person or nearby in public.””
Reminder: You do NOT get docked points for citing others’ work. You can be at risk of an Academic Integrity violation if you don’t. When in doubt, give credit.
How to specify a footnote in text:
How to include the footnote’s reference:
❓ While generating your first draft, how can GenAI be helpful?
❓ After you have a first draft, how can GenAI be helpful?
❓ While completing your cs01, what to avoid with GenAI?
ggplot(penguins, aes(y = fct_rev(fct_infreq(species)), fill = species)) +
geom_bar() +
geom_text(stat='count', aes(label=after_stat(count)), hjust = 1.5, color = "white", size = 7) +
scale_x_continuous(expand = c(0, 0)) +
scale_fill_manual(values = c("#454545", rep("#adadad", 2))) +
labs(title = "Adelie Penguins are the most common in Antarctica",
subtitle = "Frequency of each penguin species studied near Palmer Station, Antarctica") +
theme_minimal(base_size = 14) +
theme(axis.text.x = element_blank(),
plot.title.position = "plot",
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
axis.title = element_blank(),
legend.position = "none")
Note
A reminder that when you’re doing EDA, you’re going to generate a lot of plots. Don’t spend your time making all of them beautiful. Save that for the “editing” portion of your case study. Once you know which are needed to tell your story, add them in.
penguins |>
group_by(species) |>
summarize(n = n(),
mean_mass = mean(body_mass_g, na.rm = TRUE),
mean_flipper = mean(flipper_length_mm, na.rm = TRUE)) |>
arrange(desc(n)) |>
kable(col.names = c("Species", "N", "Body mass (g)", "Flipper length (mm)"),
digits = 0,
format.args = list(big.mark = ","),
caption = "Gentoo penguins are the largest, despite Adelie being most common") |>
kable_styling(full_width = FALSE)| Species | N | Body mass (g) | Flipper length (mm) |
|---|---|---|---|
| Adelie | 152 | 3,701 | 190 |
| Gentoo | 124 | 5,076 | 217 |
| Chinstrap | 68 | 3,733 | 196 |
33.6234 is rarely more useful than 34# A tibble: 3 x 4, <fct>, <dbl>) in a report