Reflection
Paragraph 1 – Critiquing the AI output. The AI’s
first draft of the code ran quickly, but it treated the spreadsheet as
if it were already clean. It did not notice that the data still contains
an exact duplicate post, or that likes_plus_reposts is an
Excel formula column rather than raw data. It also removed stop words
before scoring sentiment, which silently throws away words the
lexicon would have scored, and it reported the dictionary score as if it
were the truth. When I checked it against the 20 posts I labeled by hand
in the Sentiment sample sheet, the lexicon agreed with my
labels only 29% of the time. The lexicon misses domain language (“is
down”, “outage”, “hung up on me”) and cannot handle negation or sarcasm,
and it labels very few posts Negative even though customer-service
complaints are obviously negative to a human reader. The row numbers in
my hand-labeled sheet also did not line up with the
Scrape 1 sheet (they run up to 382 while the data has 279
rows), so the AI’s suggestion to join on row number would have matched
the wrong posts; joining on the post text fixed it.
Paragraph 2 – What human judgment still contributes.
The AI cannot decide what counts as a relevant post. Many posts
only mention Verizon in passing (a bus-route bot that mentions “Verizon
Place”, local TV channel listings, a court case), and I had to decide
whether to keep them, flag them, or drop them (my cleaned file keeps 96
of the 279 scraped posts). I also had to decide that a repeated post
should count once, that “down” in “Verizon is down” is negative even
though the lexicon does not know that, and that a result I could not
reproduce by hand (the hand-calculation check) should not be trusted.
Writing a narrower prompt (package, inputs, output, constraints) and
asking for a second pass made the code much better, but only because I
knew what to ask for after inspecting the data and testing the output
myself. The AI is a fast first-draft writer, but I feel that humans are
still responsible for verifying the numbers and the interpretation.
Lab feedback It was nice seeing how descriptive and
structureda prompt needs to be in order for AI to efficiently work. I
think the lab has a great way of showing students that AI can not be
completely relied on.
1. Prompts I used with the AI
| 1 – original |
“Write R code to clean my BlueSky Verizon dataset, do text analysis
and sentiment analysis, and make a plotly chart.” |
Vague. The AI guessed column names, did not handle NA text or
duplicates, and removed stop words before sentiment scoring. |
| 2 – improved |
“I have an Excel file (sheet Cleaned posts) with
columns
text, author_handle, timestamp, likes, reposts, replies, likes_plus_reposts.
Use readxl, tidytext, dplyr,
plotly. Drop rows with missing text, remove exact duplicate
posts, strip URLs/@handles/hashtags. Tokenize, remove stop words
plus custom words (verizon, amp, https…), show the top 15 words and
bigrams. Score sentiment with the Bing lexicon at the post level
(positive − negative) using all words, not the
stop-word-filtered ones. Put each step in its own chunk with
comments.” |
Better structure. Still no validation, so I asked for round 3. |
| 3 – verification |
“Add checks: (a) row counts reconcile at every step, (b) recompute
engagement and compare to the sheet, (c) hand-calculate sentiment for
one post, (d) compare lexicon labels with my 20 hand-labeled posts in
the Sentiment sample sheet and show a confusion matrix.
Join on post text, not row number.” |
Exposed the lexicon’s weaknesses (see Section 6). |
2. Load the data
library(tidyverse) # dplyr, tidyr, ggplot2, stringr, readr
library(readxl) # read the .xlsx file
library(lubridate) # dates
library(tidytext) # unnest_tokens, stop_words, get_sentiments
library(plotly) # interactive charts
library(knitr) # kable tables
# Put both .xlsx files in the same folder as this .Rmd
path <- "Lillian_Week10_Verizon_cleaned.xlsx" # cleaned posts
path_manual <- "Lillian_Week10_Verizon.xlsx" # original file: has my hand-labeled sample
raw <- read_excel(path, sheet = "Cleaned posts")
glimpse(raw)
## Rows: 96
## Columns: 9
## $ text <chr> "One of the cables on our modem is FUBAR so I had…
## $ author_handle <chr> "crutchingreader.bsky.social", "tomorrowarchive.c…
## $ timestamp <dttm> 2026-10-22 21:37:06, 2026-10-22 20:34:24, 2026-1…
## $ likes <dbl> 0, 0, 1, 4, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0…
## $ reposts <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
## $ replies <dbl> 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0…
## $ likes_plus_reposts <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
## $ why_kept <chr> "Negative opinion / experience", "Negative opinio…
## $ original_row_in_file <dbl> 2, 4, 6, 9, 10, 17, 19, 21, 22, 25, 27, 30, 37, 4…
3. Clean the data
Cleaning steps, with a count after each so nothing disappears
silently:
- Check the
likes_plus_reposts formula column against my
own recomputation. (This file was cleaned by hand, so the formula cells
may have no saved values and the check can pass without comparing
anything.)
- Drop posts with no text (none expected after manual cleaning).
- Drop exact duplicate posts (same text), keeping the earliest.
- Create a cleaned text column (URLs, @handles,
# symbols and non-letters
removed).
# 1. the sheet's likes_plus_reposts is an Excel formula; recompute and compare
stopifnot(all(raw$likes + raw$reposts == raw$likes_plus_reposts, na.rm = TRUE))
n_raw <- nrow(raw)
posts <- raw %>%
mutate(
text = str_squish(text),
engagement = likes + reposts # recomputed, not trusted from Excel
) %>%
select(-likes_plus_reposts)
n_missing <- sum(is.na(posts$text) | posts$text == "")
posts <- posts %>% filter(!is.na(text), text != "")
posts <- posts %>%
arrange(timestamp) %>%
distinct(text, .keep_all = TRUE) # earliest copy of each post
n_dupes <- (n_raw - n_missing) - nrow(posts)
posts <- posts %>%
mutate(
post_id = row_number(),
mentions_verizon = str_detect(str_to_lower(text), "verizon"),
clean_text = text %>%
str_remove_all("https?://\\S+|www\\.\\S+|\\b\\S+\\.(com|org|net|ly|link|social)\\S*") %>%
str_remove_all("@\\S+") %>%
str_replace_all("#", " ") %>%
str_replace_all("[^A-Za-z' ]", " ") %>%
str_squish() %>%
str_to_lower()
)
tibble(
step = c("Raw rows", "Missing text removed", "Exact duplicates removed", "Rows analysed"),
count = c(n_raw, n_missing, n_dupes, nrow(posts))
) %>% kable()
| Raw rows |
96 |
| Missing text removed |
0 |
| Exact duplicates removed |
1 |
| Rows analysed |
95 |
# sanity check: the arithmetic must reconcile
stopifnot(n_raw - n_missing - n_dupes == nrow(posts))
range(posts$timestamp)
## [1] "2026-10-18 02:10:40 UTC" "2026-10-22 21:37:06 UTC"
posts %>% count(day = as.Date(timestamp)) %>% kable()
| 2026-10-18 |
12 |
| 2026-10-19 |
29 |
| 2026-10-20 |
23 |
| 2026-10-21 |
14 |
| 2026-10-22 |
17 |
4. Text analysis
# all tokens (used for sentiment: we do NOT drop stop words first)
tokens_all <- posts %>%
select(post_id, clean_text) %>%
unnest_tokens(word, clean_text)
# analysis tokens (stop words + custom noise removed; used for word counts)
custom_stop <- tibble(word = c("verizon", "amp", "https", "http", "www", "com",
"bsky", "rt", "it's", "i'm", "don't", "dont"))
tokens <- tokens_all %>%
anti_join(stop_words, by = "word") %>%
anti_join(custom_stop, by = "word") %>%
filter(str_length(word) > 2)
top_words <- tokens %>% count(word, sort = TRUE) %>% slice_head(n = 15)
kable(top_words)
| phone |
18 |
| service |
17 |
| fios |
15 |
| mobile |
13 |
| starz |
12 |
| iphone |
10 |
| plan |
10 |
| internet |
8 |
| business |
7 |
| customers |
7 |
| time |
6 |
| call |
5 |
| color |
5 |
| duo |
5 |
| month |
5 |
plot_ly(
top_words %>% mutate(word = fct_reorder(word, n)),
x = ~n, y = ~word, type = "bar", orientation = "h",
hovertemplate = "%{y}: %{x} uses<extra></extra>"
) %>%
layout(title = "Top 15 words in Verizon posts (stop words removed)",
xaxis = list(title = "Number of uses"),
yaxis = list(title = ""))
bigrams <- posts %>%
select(post_id, clean_text) %>%
unnest_tokens(bigram, clean_text, token = "ngrams", n = 2) %>%
filter(!is.na(bigram)) %>%
separate(bigram, c("w1", "w2"), sep = " ") %>%
filter(!w1 %in% stop_words$word, !w2 %in% stop_words$word,
!w1 %in% custom_stop$word, !w2 %in% custom_stop$word) %>%
count(w1, w2, sort = TRUE) %>%
unite(bigram, w1, w2, sep = " ")
kable(slice_head(bigrams, n = 10))
| iphone duo |
4 |
| carriage pact |
3 |
| customer service |
3 |
| celebrities lifestyle |
2 |
| cell service |
2 |
| color choice |
2 |
| disney hulu |
2 |
| distribution agreement |
2 |
| falls massively |
2 |
| family plan |
2 |
5. Sentiment analysis (Bing lexicon)
Each post gets positive words − negative words using the
Bing lexicon. Score > 0 is Positive, < 0 is Negative, 0 is Neutral
(including posts with no lexicon words).
bing <- get_sentiments("bing") %>% distinct(word, .keep_all = TRUE)
word_sent <- tokens_all %>% inner_join(bing, by = "word")
post_sent <- word_sent %>%
count(post_id, sentiment) %>%
pivot_wider(names_from = sentiment, values_from = n, values_fill = 0)
# make sure both columns exist even if one sentiment never occurs
for (col in c("positive", "negative")) {
if (!col %in% names(post_sent)) post_sent[[col]] <- 0L
}
posts <- posts %>%
left_join(post_sent, by = "post_id") %>%
mutate(
positive = replace_na(positive, 0),
negative = replace_na(negative, 0),
score = positive - negative,
label = case_when(score > 0 ~ "Positive",
score < 0 ~ "Negative",
TRUE ~ "Neutral")
)
sent_summary <- posts %>%
count(label) %>%
mutate(percent = round(100 * n / sum(n), 1))
kable(sent_summary)
| Negative |
29 |
30.5 |
| Neutral |
35 |
36.8 |
| Positive |
31 |
32.6 |
stopifnot(sum(sent_summary$n) == nrow(posts))
word_sent %>%
count(word, sentiment, sort = TRUE) %>%
group_by(sentiment) %>%
slice_head(n = 8) %>%
ungroup() %>%
kable()
| fuck |
negative |
4 |
| bad |
negative |
3 |
| dead |
negative |
3 |
| sucks |
negative |
3 |
| error |
negative |
2 |
| falls |
negative |
2 |
| issue |
negative |
2 |
| issues |
negative |
2 |
| like |
positive |
7 |
| right |
positive |
7 |
| better |
positive |
4 |
| good |
positive |
3 |
| pretty |
positive |
3 |
| well |
positive |
3 |
| available |
positive |
2 |
| guarantee |
positive |
2 |
6. Verify the results
6a. Hand calculation for one post
Pick the post with the most sentiment words, list the scored words,
and check the score by hand.
example <- posts %>% slice_max(positive + negative, n = 1, with_ties = FALSE)
example$text
## [1] "Do not know if my job is trying to add Signal blockers to stop people on their phone all the time, my phone is slowly dying more and more or just a general my Verizon being bad At least it works outside and it’s nice out so it’s not all bad"
word_sent %>%
filter(post_id == example$post_id) %>%
select(word, sentiment) %>%
kable()
| slowly |
negative |
| dying |
negative |
| bad |
negative |
| works |
positive |
| nice |
positive |
| bad |
negative |
# count by hand from the table above, then compare:
c(positive = example$positive, negative = example$negative, score = example$score)
## positive negative score
## 2 4 -2
6b. Compare with my own labels (Sentiment sample
sheet)
I hand-labeled 20 posts. The row_in_Scrape_1 numbers in
that sheet do not match the original Scrape 1 rows, and
many of the 20 labeled posts were removed during cleaning, so I join on
the post text and only the posts that survived are
compared.
manual <- read_excel(path_manual, sheet = "Sentiment sample") %>%
select(text, manual_tag = tag) %>%
filter(!is.na(text), !is.na(manual_tag)) %>%
mutate(text = str_squish(text))
compare <- manual %>%
inner_join(posts %>% select(text, label, score), by = "text") %>%
distinct(text, .keep_all = TRUE)
cat("Hand-labeled posts:", nrow(manual),
"| matched to cleaned data:", nrow(compare), "\n")
## Hand-labeled posts: 20 | matched to cleaned data: 4
table(Manual = compare$manual_tag, Lexicon = compare$label)
## Lexicon
## Manual Negative Neutral Positive
## Negative 0 0 1
## Neutral 1 0 1
## Positive 0 1 0
agreement <- mean(compare$manual_tag == compare$label)
cat("Agreement with my labels:", round(100 * agreement), "%\n")
## Agreement with my labels: 0 %
compare %>%
filter(manual_tag != label) %>%
select(text, manual_tag, lexicon = label, score) %>%
kable()
| Verizon is reportedly down for some customers right
now. Are you one of them? #Verizon #VerizonDown https://statusisdown.com/service/verizon/ |
Negative |
Positive |
1 |
| Starz is back on Verizon Fios TV. |
Positive |
Neutral |
0 |
| T-Mobile retains 5G crown as AT&T falls massively
behind Verizon in standalone access |
Neutral |
Negative |
-1 |
| I woke up late and fumbled things, but still have an
iPhone Duo that should be here in October. Verizon reset my color choice
so I am getting white instead of blue. Not a deal breaker though and
better than waiting till next year to get the color I wanted. |
Neutral |
Positive |
1 |
6c. Sanity checks
stopifnot(
!anyNA(posts$text),
!any(duplicated(posts$text)),
all(posts$engagement >= 0),
all(posts$timestamp >= min(raw$timestamp)),
all(posts$timestamp <= max(raw$timestamp))
)
cat("All sanity checks passed.\n")
## All sanity checks passed.
Findings to write up in my own words: compare the %
Positive/Negative/Neutral from the lexicon with my hand labels; look at
the disagreement table above for examples where the lexicon missed
outage or customer-service complaints, and where posts are not really
about Verizon service at all.
7. Interactive chart: posts per day by sentiment
daily <- posts %>%
mutate(day = as.Date(timestamp)) %>%
count(day, label)
plot_ly(
daily, x = ~day, y = ~n, color = ~label,
colors = c(Negative = "#c0392b", Neutral = "#95a5a6", Positive = "#2e86c1"),
type = "bar",
hovertemplate = "%{x}<br>%{y} posts<extra>%{fullData.name}</extra>"
) %>%
layout(
barmode = "stack",
title = "BlueSky posts mentioning Verizon, by day and sentiment",
xaxis = list(title = "Date (UTC)"),
yaxis = list(title = "Number of posts"),
legend = list(title = list(text = "Sentiment"))
)
Most-engaged posts (likes + reposts):
posts %>%
arrange(desc(engagement)) %>%
slice_head(n = 5) %>%
select(author_handle, engagement, label, text) %>%
kable()
| numb.comfortab.ly |
45 |
Positive |
In my experience Internet providers not often live up
to advertised speeds. Verizon FiOS gigabit pretty much does. Pretty
neat, considering I am connected to the router via Wi-Fi. |
| seanforfive.com |
22 |
Neutral |
Verizon chatbot got into an argument with me about
whether it was a person or not |
| bert60hz.bsky.social |
20 |
Neutral |
verizon talkin bout trade in your phone for an iPhone
18 I gave them my iPhone 11 and they beat my ass |
| itsdrlittle.bsky.social |
14 |
Positive |
Verizon better stop texting me. Talking bout some “save
up to $1100 of.” Why does a phone even cost that much to make such a
discount possible? |
| illiarieka.me |
10 |
Negative |
Verizon, fix your fuckin shit! I am so sick of the last
month having our internet cut out. This has disrupted not only my flow
but the flow of the others living with me. It is ridiculous and need to
be comped for this. What is the point of having a service we cant
use??? |