Reflection draft — revise after running and reviewing

This lab connects AI-assisted coding with my group’s Bluesky skincare project. AI can help organize the cleaning steps, count common words, apply a sentiment dictionary, and create an interactive chart. However, producing a chart does not prove that the analysis is correct. The earlier data include repeated observations across scrapes, and some search terms can have meanings unrelated to skincare. This version therefore checks post identifiers, keeps one text per post for the overall analysis, and separates posts with no dictionary matches from posts with balanced positive and negative matches. Before submitting, I need to run the code, review the sampled posts, and describe one specific result or mistake that I verified myself.

My critique is that AI can make a basic word-counting method sound more conclusive than it is. A positive word does not necessarily mean that someone likes a skincare brand: sarcasm, negation, advertising, and comments about another topic can change the meaning. Human judgment is still needed to decide whether posts are relevant and whether the findings answer the research question. The lab’s emphasis on checking and improving AI output is useful because it makes verification part of the assignment. A helpful improvement would be to specify a minimum number of posts to review and explain whether sentiment should describe the whole post or the named brand. After completing the lab, I should revise this draft to reflect my own experience and include the actual verification results.

Question and scope

What words appear frequently in our collected skincare conversations, and how does dictionary-based sentiment vary across search groups? This is a convenience sample of public posts, not a representative survey of customers. Sephora is a retailer, the five named companies are product brands, and the skincare keyword is a broad topic. Search-group comparisons describe the collected texts, not market share, sales, or product quality.

The five-brand and general-skincare records were read directly from the newly uploaded Excel workbooks. The 200 Sephora observations were retained from the earlier Skincare_Project_Analysis.Rmd, because no Sephora workbook was attached in this message. Their provenance remains the earlier normalized report. Source filename, sheet, row, and post identifiers remain available internally. Existing sentiment fields are not treated as verified human labels. The cleaned source data are embedded so knitting does not require a Bluesky login or separate spreadsheets.

Supplied material How it is used
Skincare_All_Brands_Two_Scrapes (1)(1).xlsx Reads the ten brand scrape sheets, yielding 1,000 observations; summary, comparison, and Unique Posts sheets are not added as new posts.
Skincare_Both_Scrapes_003 (1).xlsx Reads Scrape 1 and Scrape 2, yielding 200 observations.
Skincare_Both_Scrapes_003(2).xlsx Verified byte-identical to the other general-skincare workbook; excluded as a duplicate file.
Skincare_Project_Analysis.docx Supplies project context and earlier interpretations to critique; prose is not counted as social media data.
Skincare_Brands_Bluesky(1).Rmd Documents brand collection queries and collection safeguards.
Skincare_All_Brands_Two_Scrapes(1).Rmd Documents the consecutive two-scrape collection design.
Skincare_Bluesky_Project(1).Rmd Documents the general-skincare collection and manual labeling design.
Earlier normalized report: Sephora records Retains the earlier 200 observations; not a newly uploaded or newly collected sample.

The collection scripts are reviewed as documentation; they are not executed by this lab. Running them again would create a different dataset. For the 1,200 directly uploaded observations, post text and the saved sentiment/relevance fields match their counterparts in the earlier normalized report.

Setup

Install missing packages once in the R console before knitting:

install.packages(c("dplyr", "tidyr", "stringr", "readr", "jsonlite",
                   "tidytext", "ggplot2", "plotly", "knitr", "rmarkdown"))

1. Clean and verify the input

Remove rows without text or a post identifier. Remove URLs and standalone account mentions from the analysis text, while preserving the original text for checking. Preserve emojis and hashtags in the cleaned text, although the word-based method below does not interpret emojis. Do not delete repeated wording automatically: different people can post the same words.

valid <- raw_posts |>
  mutate(across(c(uri, post_text, group), ~str_squish(coalesce(as.character(.x), ""))),
         batch = as.integer(batch)) |>
  filter(uri != "", post_text != "")
# Later batch wins within a group. Original row order resolves any remaining tie.
group_posts <- valid |>
  arrange(group, uri, desc(batch)) |>
  distinct(group, uri, .keep_all=TRUE)
# A post matching several searches is counted once overall.
posts <- group_posts |>
  arrange(uri, desc(batch), group) |>
  distinct(uri, .keep_all=TRUE) |>
  mutate(post_id = row_number(),
         clean_text = post_text |>
           str_remove_all("https?://\\S+|www\\.\\S+") |>
           str_remove_all("(?<!\\S)@[A-Za-z0-9._-]+") |>
           str_squish())
membership <- group_posts |> distinct(group, uri) |>
  left_join(posts |> select(uri, post_id), by="uri")
flow <- tibble(
  Stage=c("Imported observations", "Rows with text and identifier",
          "Unique group/post pairs", "Unique posts overall"),
  Count=c(nrow(raw_posts), nrow(valid), nrow(group_posts), nrow(posts)))
knitr::kable(flow)
Stage Count
Imported observations 1400
Rows with text and identifier 1396
Unique group/post pairs 767
Unique posts overall 764
stopifnot(nrow(posts) == n_distinct(valid$uri),
          !anyDuplicated(posts$uri), !anyDuplicated(membership[c("group","uri")]),
          nrow(valid) <= nrow(raw_posts))

Independent inspection of the embedded CSV found 1,400 source rows, 1,396 rows with nonblank text and identifier, 767 unique search-group/post pairs, and 764 unique post identifiers. The earlier Word report lists 766 distinct identifiers before removing blank post text. Four rows with blank text account for two distinct identifiers, explaining why the text-analysis sample contains 764 unique posts. Compare these counts with the table above. The three extra group/post pairs reflect posts matching more than one search. The normalized input contained no completed relevance labels, so off-topic posts have not been screened out.

2. Text analysis

Tokenize each unique post into lowercase words. Remove stop words only for the frequency chart. Keep the full word-token table for sentiment so that the sentiment pipeline does not silently discard dictionary words through frequency-chart filtering. Word counts are occurrences, not numbers of people.

tokens <- posts |> select(post_id, clean_text) |>
  unnest_tokens(word, clean_text)
frequency_tokens <- tokens |>
  anti_join(tidytext::stop_words, by="word") |>
  filter(str_detect(word, "[[:alpha:]]"))
word_counts <- frequency_tokens |> count(word, sort=TRUE)
knitr::kable(head(word_counts, 20), col.names=c("Word", "Occurrences"))
Word Occurrences
skincare 253
sephora 177
skin 158
cerave 153
cetaphil 111
la 107
roche 101
free 97
rhode 95
posay 88
cream 80
moisturizer 79
niacinamide 77
acid 72
dry 68
ordinary 64
cleanser 60
beauty 57
facial 55
de 54
if (nrow(word_counts)) {
  word_counts |> slice_head(n=15) |>
    ggplot(aes(x=reorder(word, n), y=n)) +
    geom_col(fill="#437F76") + coord_flip() + theme_minimal() +
    labs(title="Most common non-stop words in unique posts",
         x=NULL, y="Word occurrences")
}

Frequent words show recurring vocabulary. Read their surrounding posts before interpreting them as customer priorities; search terms, names, advertisements, and irrelevant matches can dominate the list.

3. Sentiment analysis

Use the English Bing lexicon, after removing duplicate word/label pairs and excluding words assigned conflicting labels. This is a documented modification of the dictionary: excluded words make no contribution to the score. Each remaining matched positive word contributes +1 and each matched negative word contributes -1. The post score is positive matches minus negative matches. A zero score with matches is called Balanced matches; a post with no matches is No matches. Neither category proves neutral sentiment. This method scores the whole post, not sentiment directed specifically at a brand.

lexicon_raw <- tidytext::get_sentiments("bing") |>
  distinct(word, sentiment)
# Exclude words assigned both positive and negative labels.
ambiguous_words <- lexicon_raw |>
  count(word, name="labels") |>
  filter(labels > 1L)
lexicon <- lexicon_raw |>
  anti_join(ambiguous_words, by="word")
stopifnot(!anyDuplicated(lexicon$word))
cat("Words excluded for conflicting labels:", nrow(ambiguous_words), "\n")
## Words excluded for conflicting labels: 3
knitr::kable(ambiguous_words)
word labels
envious 2
enviously 2
enviousness 2
hits <- tokens |> inner_join(lexicon, by="word")
counts <- hits |> group_by(post_id) |>
  summarise(positive=sum(sentiment=="positive"),
            negative=sum(sentiment=="negative"), .groups="drop")
scored <- posts |> left_join(counts, by="post_id") |>
  mutate(across(c(positive,negative), ~coalesce(.x, 0L)),
         matched=positive+negative,
         score=positive-negative,
         label=case_when(matched==0 ~ "No matches",
                         score>0 ~ "Positive matches",
                         score<0 ~ "Negative matches",
                         TRUE ~ "Balanced matches"))
overall <- scored |> count(label, name="posts") |>
  mutate(percent=100*posts/sum(posts))
knitr::kable(overall, digits=1)
label posts percent
Balanced matches 52 6.8
Negative matches 108 14.1
No matches 255 33.4
Positive matches 349 45.7
coverage <- 100 * mean(scored$matched>0)
cat(sprintf("Dictionary matches occur in %.1f%% of unique posts.\n", coverage))
## Dictionary matches occur in 66.6% of unique posts.
stopifnot(sum(overall$posts)==nrow(posts),
          sum(scored$matched)==nrow(hits),
          sum(scored$score)==sum(hits$sentiment=="positive")-
                             sum(hits$sentiment=="negative"))
knitr::kable(hits |> count(sentiment, word, sort=TRUE) |>
               group_by(sentiment) |> slice_head(n=10) |> ungroup())
sentiment word n
negative bad 8
negative cheap 8
negative rough 8
negative allergy 6
negative complex 6
negative fucking 6
negative greasy 6
negative hard 6
negative sorry 5
negative angry 4
positive free 97
positive like 64
positive beauty 57
positive good 36
positive gentle 34
positive sensitive 31
positive glow 29
positive love 21
positive beautifully 15
positive right 14

4. Interactive plotly chart

Hover to see exact counts and percentages. Click legend categories to hide or show them. The denominator is all unique posts within each search group, including posts with no dictionary matches. A post can appear in multiple groups; do not sum group counts to get the overall number of unique posts.

label_levels <- c("Positive matches","Negative matches","Balanced matches","No matches")
group_summary <- membership |>
  left_join(scored |> select(post_id,label), by="post_id") |>
  count(group, label, name="posts") |>
  complete(group, label=label_levels, fill=list(posts=0L)) |>
  group_by(group) |>
  mutate(total=sum(posts), percent=100*posts/total) |> ungroup() |>
  mutate(label=factor(label, levels=label_levels),
         hover=paste0("Search group: ",group,
                      "<br>Category: ",label,"<br>Posts: ",posts,
                      "<br>Group total: ",total,
                      "<br>Percent: ",round(percent,1),"%"))
stopifnot(all(abs((group_summary |> group_by(group) |>
                    summarise(p=sum(percent)))$p-100) < 1e-8))
p <- ggplot(group_summary, aes(x=group, y=percent, fill=label, text=hover)) +
  geom_col() + coord_flip() + theme_minimal() +
  scale_fill_manual(values=c("#43887D","#C75E62","#D5B36B","#ADB4BC")) +
  labs(title="Dictionary match categories by search group",
       x=NULL,y="Percent of unique posts within group",fill=NULL)
plotly::ggplotly(p, tooltip="text")
knitr::kable(group_summary |> select(group,label,posts,total,percent), digits=1)
group label posts total percent
CeraVe Balanced matches 6 100 6.0
CeraVe Negative matches 19 100 19.0
CeraVe No matches 30 100 30.0
CeraVe Positive matches 45 100 45.0
Cetaphil Balanced matches 4 100 4.0
Cetaphil Negative matches 19 100 19.0
Cetaphil No matches 36 100 36.0
Cetaphil Positive matches 41 100 41.0
La Roche-Posay Balanced matches 1 100 1.0
La Roche-Posay Negative matches 6 100 6.0
La Roche-Posay No matches 52 100 52.0
La Roche-Posay Positive matches 41 100 41.0
Rhode Balanced matches 9 98 9.2
Rhode Negative matches 6 98 6.1
Rhode No matches 29 98 29.6
Rhode Positive matches 54 98 55.1
Sephora Balanced matches 12 169 7.1
Sephora Negative matches 34 169 20.1
Sephora No matches 67 169 39.6
Sephora Positive matches 56 169 33.1
Skincare keyword Balanced matches 7 100 7.0
Skincare keyword Negative matches 16 100 16.0
Skincare keyword No matches 19 100 19.0
Skincare keyword Positive matches 58 100 58.0
The Ordinary Balanced matches 13 100 13.0
The Ordinary Negative matches 10 100 10.0
The Ordinary No matches 22 100 22.0
The Ordinary Positive matches 55 100 55.0

5. Verify the method and critique the results

First, check three short constructed examples by hand. Under this lexicon, good contributes +1, bad contributes -1, and the negation in not good is ignored. The final example demonstrates a known limitation, not evidence that the post expresses approval.

examples <- tibble(example_id=1:3,
                   text=c("good good bad", "good bad", "not good"),
                   expected_score=c(1,0,1))
example_scores <- examples |>
  unnest_tokens(word,text) |>
  inner_join(lexicon, by="word") |>
  group_by(example_id) |>
  summarise(calculated_score=sum(if_else(sentiment=="positive",1L,-1L)),
            .groups="drop")
example_check <- examples |> left_join(example_scores, by="example_id")
knitr::kable(example_check)
example_id text expected_score calculated_score
1 good good bad 1 1
2 good bad 0 0
3 not good 1 1
stopifnot(all(example_check$expected_score==example_check$calculated_score))

Next, read up to ten actual posts and inspect the matched words. Judge relevance and sentiment toward skincare or the named company yourself. Record whether the algorithm appears misleading and why. This deterministic sample is for spot checking, not an estimate of accuracy for the entire dataset.

set.seed(3040)
audit_ids <- sample(scored$post_id, size=min(10L,nrow(scored)))
matched_words <- hits |> group_by(post_id) |>
  summarise(dictionary_words=paste0(word," (",sentiment,")",collapse=", "),
            .groups="drop")
audit <- scored |> filter(post_id %in% audit_ids) |>
  select(post_id,post_text,positive,negative,score,label) |>
  left_join(matched_words,by="post_id") |>
  mutate(dictionary_words=coalesce(dictionary_words,"No matches"))
knitr::kable(audit)
post_id post_text positive negative score label dictionary_words
183 youtu.be/7BBFZ4DlYkY?… #newvlog please watch my new vlog 0 0 0 No matches No matches
259 my most precious gel 1 0 1 Positive matches precious (positive)
380 Hailey Bieber has sold her skincare brand, Rhode, to E.l.f. Beauty for an impressive R18 billion, just three years after launching the brand. 2 0 2 Positive matches beauty (positive), impressive (positive)
412 🥇 Projet DUNE : trouver l’origine de la matière Au fond d’une ancienne mine d’or du Dakota du Sud, à 1 500 mètres sous la roche, les physiciens vont assembler DUNE à partir du 2 novembre,. 1 0 1 Positive matches fond (positive)
450 I got hella pores but my skincare was built to be hyper moisturized bc I am a dry dry woman. - Ceraphil Daily (works better than their Gentle Skin) - Toner exfoliant - Niacinamide serum - The Ordinary Moisturizer, very light feeling on the face - COSRX (KR) sunscreen ALWAYS 3 0 3 Positive matches works (positive), better (positive), gentle (positive)
517 Oh, and heavy duty lotion acquired!! 0 0 0 No matches No matches
548 Sephora YCH!!! I had too much fun drawing these, so I made a YCH Contact information is located on my site: silvertheprotogen.carrd.co #furry #furryart #art #digital #digitalart #SouthPark #Furry #furrydigital #furrymemes #furryartwork #furryartist 1 0 1 Positive matches fun (positive)
649 i absolutely need this perfume thars called “good girl” by caroline herrera but why does it have to be a high heel? is it supposed to make me want to chew on it??? 1 0 1 Positive matches good (positive)
719 CeraVe Renewing Salicylic Acid Cleanser, Formulated With Hyaluronic Acid, Niacinamide, & Ceramides, Gentle BHA Exfoliating Face Wash Smooths & Softens Skin, Non Comedogenic & Fragrance Free, 16 Ounce#CeraVe#RenewingSalicylicAcidCleanser#FacialCleanser#ExfoliatingFaceWash#BHA 2 0 2 Positive matches gentle (positive), free (positive)
745 Am I OD if I wash my face and put lotion on when after I finish my work out ? Because I’m waking up and washing my face, going to the gym, walking the dog, then washing my face again in the shower And then washing my face when I get home from work I feel like it’s too much but it’s all cerave 3 0 3 Positive matches work (positive), work (positive), like (positive)
# Write a local review template without overwriting completed work.
review_file <- "Skincare_Manual_Review.csv"
if (!file.exists(review_file)) {
  readr::write_csv(audit |> mutate(human_relevant="",human_sentiment="",reason=""),
                   review_file)
}

Complete these notes in this document after reviewing the displayed posts:

Review status: These human checks remain to be completed. No accuracy claim is made. Dictionary categories are not validated brand-sentiment labels. Repeated promotional text, non-English posts, sarcasm, negation, ambiguous names such as “The Ordinary” or “Rhode,” and the direction of the sentiment all need human review. Do not treat findings as product safety or effectiveness evidence.

Prompt record and submission

Initial request: The assignment instructions pasted into this conversation. Screenshot that message and the corresponding AI response as the actual first exchange. Keep the exact wording rather than replacing it with a reconstructed prompt.

Suggested improved prompt — send this yourself as a second message:

Review the Skincare_AI_Lab.Rmd you created for my Bluesky skincare project. Use dplyr, tidytext, ggplot2, and plotly. Check that duplicate scrapes do not inflate word counts, that posts matching several search groups are counted once overall, and that posts with no Bing dictionary matches are separate from balanced scores. Explain the manual examples, verify the percentage denominators, and help me improve the two-paragraph reflection using the results I report. Do not invent findings or claim that I completed checks I have not done.

Actual second request: “here is everything i have use this please,” accompanied by the project report, three collection scripts, the brand workbook, and two copies of the general-skincare workbook.

Second response summary: The assistant inspected the attachments, identified the duplicate workbook, rebuilt the embedded brand and general-skincare input from the uploaded sheets, retained the previously supplied Sephora records with an explicit source note, and explained the difference between 766 total post identifiers and 764 with usable text. This summary is a navigation aid, not an exact transcript; screenshot the actual messages and responses.

The first two requests provide the assignment and its files, but they do not clearly demonstrate your own specific package/input/output constraints. Send the suggested improved prompt above as an additional real exchange and include the response in your screenshot record. Add any errors or changes that helped finish the lab. Suggested prompts are not a record of completed exchanges.

Before submission, finish the human checks, personalize the two reflection paragraphs at the beginning, and knit this file to HTML in RStudio. Inspect the chart and code output. Use the HTML preview’s Publish control to publish to your RPubs account, then submit the published URL and your prompt/response screenshots to the required locations. Publishing has not been performed here.

Method references

sessionInfo()
## R version 4.6.2 (2026-10-29)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.5 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
## 
## locale:
##  [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
##  [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
##  [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
## [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
## 
## time zone: UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] ggplot2_4.0.4  tidytext_0.4.3 stringr_1.6.0  tidyr_1.3.2    dplyr_1.2.1   
## 
## loaded via a namespace (and not attached):
##  [1] janeaustenr_1.0.0   plotly_4.12.1       sass_0.4.10        
##  [4] generics_0.1.4      stringi_1.8.9       lattice_0.23-1     
##  [7] hms_1.1.4           digest_0.6.39       magrittr_2.0.5     
## [10] evaluate_1.0.5      grid_4.6.2          RColorBrewer_1.1-3 
## [13] fastmap_1.2.0       jsonlite_2.0.0      Matrix_1.7-6       
## [16] httr_1.4.9          purrr_1.2.2         crosstalk_1.2.2    
## [19] viridisLite_0.4.3   scales_1.4.0        jquerylib_0.1.4    
## [22] cli_3.6.6           crayon_1.5.3        rlang_1.3.0        
## [25] tokenizers_0.3.0    bit64_4.8.6         withr_3.0.3        
## [28] cachem_1.1.0        yaml_2.3.12         otel_0.3.0         
## [31] parallel_4.6.2      tools_4.6.2         tzdb_0.5.0         
## [34] vctrs_0.7.3         R6_2.6.1            lifecycle_1.0.5    
## [37] bit_4.6.0           htmlwidgets_1.6.4   vroom_1.7.1        
## [40] pkgconfig_2.0.3     pillar_1.11.1       bslib_0.12.0       
## [43] gtable_0.3.6        glue_1.8.1          data.table_1.18.6.1
## [46] Rcpp_1.1.2          xfun_0.62           tibble_3.3.1       
## [49] tidyselect_1.2.1    knitr_1.52          farver_2.1.2       
## [52] htmltools_0.5.9     SnowballC_0.7.1     labeling_0.4.3     
## [55] rmarkdown_2.32      readr_2.2.0         compiler_4.6.2     
## [58] S7_0.2.2