Artificial intelligence (ChatGPT) was used as an assisting tool throughout this assignment to help generate R code, troubleshoot errors, organize the R Markdown report, and create data visualizations. AI also assisted with drafting explanations and interpreting statistical and sentiment analysis methods.
However, I reviewed the AI-generated code, verified calculations, and evaluated the results using my own judgment. I understand that AI-generated information may contain errors, and I take responsibility for the accuracy, interpretation, and final presentation of this assignment.
For this assignment, I used AI to help create an R Markdown report that analyzes a retail survey dataset and Bluesky social media posts. AI helped me generate R code for importing data, checking missing values, calculating descriptive statistics, cleaning text, performing sentiment analysis, and creating visualizations. I learned that writing detailed prompts made the code more useful because I could specify the variables, packages, and output I needed. AI also helped me understand unfamiliar R functions and troubleshoot errors.
Although AI was helpful, I learned that the generated code still required human verification. I experienced problems with incorrect file paths and R Markdown formatting, which prevented my code from running correctly. I had to correct those issues and check the calculations myself. I also learned that AI cannot fully interpret the meaning of survey responses or social media posts. Human judgment is important for understanding the data, identifying limitations, and drawing appropriate conclusions.
Help me create R code to analyze a retail survey dataset and create an interactive graph.
Create an R Markdown report using an Excel retail survey dataset. Import the data with readxl, calculate descriptive statistics, check for missing values and duplicate respondent IDs, and independently verify the average response to Q1.
Generate R code to create an interactive Plotly bar chart comparing the average responses to Q1 through Q4. Include a descriptive title, axis labels, and hover information. Make sure the code can be knitted into an HTML report.
Using a CSV file containing Bluesky social media posts, create R code to clean text, remove common stop words, calculate word frequencies, and perform sentiment analysis using the Bing sentiment lexicon. Create interactive visualizations and include calculations that verify the analysis.
library(readxl)
library(ggplot2)
library(plotly)
library(dplyr)
library(tidyr)
library(tidytext)
library(stringr)
survey <- read_excel(
"/cloud/home/r3962696/R/x86_64-pc-linux-gnu-library/lab 9/Cleaned_retail_survey-1.xlsx"
)
head(survey)
## # A tibble: 6 × 13
## Respondent_ID Q1 Q2 Q3 Q4 Q5_1 Q5_2 Q5_3 Q5_4 Q5_5 Q6_1
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 9 1 3 3 2 1 1 1 1 1 2
## 2 11 2 2 3 2 1 1 2 1 1 2
## 3 12 2 3 3 4 2 2 1 1 2 2
## 4 13 2 2 2 3 1 1 2 1 1 3
## 5 15 2 2 2 2 1 1 1 1 1 3
## 6 19 3 4 4 2 1 1 1 1 1 1
## # ℹ 2 more variables: Q6_2 <dbl>, Q6_3 <dbl>
summary(survey)
## Respondent_ID Q1 Q2 Q3 Q4
## Min. : 9.00 Min. :1 Min. :2.000 Min. :2.000 Min. :2.00
## 1st Qu.:11.25 1st Qu.:2 1st Qu.:2.000 1st Qu.:2.250 1st Qu.:2.00
## Median :12.50 Median :2 Median :2.500 Median :3.000 Median :2.00
## Mean :13.17 Mean :2 Mean :2.667 Mean :2.833 Mean :2.50
## 3rd Qu.:14.50 3rd Qu.:2 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.:2.75
## Max. :19.00 Max. :3 Max. :4.000 Max. :4.000 Max. :4.00
## Q5_1 Q5_2 Q5_3 Q5_4 Q5_5
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1 Min. :1.000
## 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:1.000 1st Qu.:1 1st Qu.:1.000
## Median :1.000 Median :1.000 Median :1.000 Median :1 Median :1.000
## Mean :1.167 Mean :1.167 Mean :1.333 Mean :1 Mean :1.167
## 3rd Qu.:1.000 3rd Qu.:1.000 3rd Qu.:1.750 3rd Qu.:1 3rd Qu.:1.000
## Max. :2.000 Max. :2.000 Max. :2.000 Max. :1 Max. :2.000
## Q6_1 Q6_2 Q6_3
## Min. :1.000 Min. :1 Min. :1.000
## 1st Qu.:2.000 1st Qu.:2 1st Qu.:1.000
## Median :2.000 Median :2 Median :1.500
## Mean :2.167 Mean :2 Mean :1.833
## 3rd Qu.:2.750 3rd Qu.:2 3rd Qu.:2.750
## Max. :3.000 Max. :3 Max. :3.000
The dataset was examined for missing values, duplicate respondent IDs, and incorrect data types.
# Number of rows and columns
dim(survey)
## [1] 6 13
# Column names
names(survey)
## [1] "Respondent_ID" "Q1" "Q2" "Q3"
## [5] "Q4" "Q5_1" "Q5_2" "Q5_3"
## [9] "Q5_4" "Q5_5" "Q6_1" "Q6_2"
## [13] "Q6_3"
# Missing values
colSums(is.na(survey))
## Respondent_ID Q1 Q2 Q3 Q4
## 0 0 0 0 0
## Q5_1 Q5_2 Q5_3 Q5_4 Q5_5
## 0 0 0 0 0
## Q6_1 Q6_2 Q6_3
## 0 0 0
# Duplicate respondent IDs
sum(duplicated(survey$Respondent_ID))
## [1] 0
# Variable structure
str(survey)
## tibble [6 × 13] (S3: tbl_df/tbl/data.frame)
## $ Respondent_ID: num [1:6] 9 11 12 13 15 19
## $ Q1 : num [1:6] 1 2 2 2 2 3
## $ Q2 : num [1:6] 3 2 3 2 2 4
## $ Q3 : num [1:6] 3 3 3 2 2 4
## $ Q4 : num [1:6] 2 2 4 3 2 2
## $ Q5_1 : num [1:6] 1 1 2 1 1 1
## $ Q5_2 : num [1:6] 1 1 2 1 1 1
## $ Q5_3 : num [1:6] 1 2 1 2 1 1
## $ Q5_4 : num [1:6] 1 1 1 1 1 1
## $ Q5_5 : num [1:6] 1 1 2 1 1 1
## $ Q6_1 : num [1:6] 2 2 2 3 3 1
## $ Q6_2 : num [1:6] 2 3 2 2 2 1
## $ Q6_3 : num [1:6] 2 1 3 1 3 1
# Verify average Q1 response
mean(survey$Q1, na.rm = TRUE)
## [1] 2
summary(survey$Q1)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1 2 2 2 2 3
# Independent calculation
q1_values <- survey$Q1[!is.na(survey$Q1)]
manual_mean <- sum(q1_values) / length(q1_values)
manual_mean
## [1] 2
# Confirm calculations match
stopifnot(
isTRUE(all.equal(
mean(q1_values),
manual_mean
))
)
I calculated the average response for Q1 through Q4 to compare the survey results.
questions <- c("Q1", "Q2", "Q3", "Q4")
averages <- sapply(
survey[questions],
mean,
na.rm = TRUE
)
print(averages)
## Q1 Q2 Q3 Q4
## 2.000000 2.666667 2.833333 2.500000
average_data <- data.frame(
Question = names(averages),
Average = as.numeric(averages)
)
This interactive Plotly chart compares the average responses to Q1 through Q4.
This graph shows how respondents answered each of the first four survey questions.
The retail survey dataset contained six respondents and 13 variables. I used descriptive statistics to examine the responses and compare averages across the first four questions.
The average response to Q1 was 2.0. I verified this result using both the mean() function and a separate calculation using the total responses divided by the number of observations.
The interactive chart makes it easier to compare survey responses. However, because the dataset contains only six respondents, the results cannot be generalized to a larger population without additional evidence.
The next section analyzes Bluesky social media posts.
posts <- read.csv(
"/cloud/home/r3962696/R/x86_64-pc-linux-gnu-library/lab 9/bluesky_posts.csv",
stringsAsFactors = FALSE,
check.names = FALSE
)
dim(posts)
## [1] 100 23
names(posts)
## [1] "uri" "cid" "author_handle" "author_name"
## [5] "text" "author_data" "post_data" "embed_data"
## [9] "reply_count" "repost_count" "like_count" "quote_count"
## [13] "bookmark_count" "indexed_at" "created_at" "in_reply_to"
## [17] "in_reply_root" "quotes" "tags" "mentions"
## [21] "links" "langs" "labels"
head(posts)
## uri
## 1 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjayz62s22n
## 2 at://did:plc:hl7k6yrlpy45vqgquayi3pgj/app.bsky.feed.post/3myjavmr2y22s
## 3 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjarkxork2n
## 4 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n
## 5 at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj6hkyl2s22
## 6 at://did:plc:5jwnvdavdtwwkhcgfif6syzs/app.bsky.feed.post/3myj5myijy22p
## cid
## 1 bafyreiaj2nroczhe6h72hhxldowrevgztjhr3iqplbohc3wltucaalmdfu
## 2 bafyreicbrkctxpdrg53hs23b5dx23vb4i5a3rdzaztz2cfr4cbkyrytd24
## 3 bafyreicsec6xpmnpyzhnpnhephdnsna6oihwixzoibvpjbmnzqv6eszp4u
## 4 bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq
## 5 bafyreidarumrpghinl3baxcxwjqixszx57k345dppj2jtldhwizpj6z6cm
## 6 bafyreiexovzcvhg6vsrnvfuvkjepe4ru7z562ctsoouas33ydhy67d3maa
## author_handle author_name
## 1 indeedagem.blacksky.app <NA>
## 2 rodgarrett.bsky.social Rod Garrett
## 3 indeedagem.blacksky.app <NA>
## 4 indeedagem.blacksky.app <NA>
## 5 auntiekristy.bsky.social Mad Auntie Kristy
## 6 elnoraoldschool.bsky.social
## text
## 1 She shared on her story 😂
## 2 I'm not sure what Ulta sells but they have a Christmas commercial running already. Make it stop.
## 3 Do Ulta hairstylists have digital portfolios? Because I need proof.
## 4 Oop. The hairstylists are shading Ulta.
## 5 I also spent 10 minutes this evening helping an old woman replace makeup her daughter-in-law stole and when we were through, she announced it was a better experience than Ulta and my own makeup was done better than theirs. So. Win.
## 6 I was in my 30's before I went natural.. Before that, I was an every two weeks standing appointment. At a shop, where the first time I went, I was looking for that framed cosmetology license on the wall \n\nx.com/KristyT/stat...
## author_data
## 1 did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z
## 2 did:plc:hl7k6yrlpy45vqgquayi3pgj, rodgarrett.bsky.social, Rod Garrett, https://cdn.bsky.app/img/avatar/plain/did:plc:hl7k6yrlpy45vqgquayi3pgj/bafkreidsnz7mex7djkdx5bskaf4425naqn7ejmj4lfyzyyeb4gpc6yyr2e, all, followers, FALSE, FALSE, FALSE, FALSE, 2024-11-06T05:27:48.980Z
## 3 did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z
## 4 did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z
## 5 did:plc:lh3kycaagayvzbjzyjzfq6v6, auntiekristy.bsky.social, Mad Auntie Kristy, https://cdn.bsky.app/img/avatar/plain/did:plc:lh3kycaagayvzbjzyjzfq6v6/bafkreibhg3q44ql3ngagtsub5rl2mv5ddweoq7xtwydfkzr3dy3vv3ecvy, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:lh3kycaagayvzbjzyjzfq6v6, at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.actor.profile/self, bafyreihtyu7vnca6xomhieyrjgxp6zbhlr6ajbvchodvctc57jenvke2va, !no-unauthenticated, 1970-01-01T00:00:00.000Z, 2023-10-23T19:11:35.150Z
## 6 did:plc:5jwnvdavdtwwkhcgfif6syzs, elnoraoldschool.bsky.social, , https://cdn.bsky.app/img/avatar/plain/did:plc:5jwnvdavdtwwkhcgfif6syzs/bafkreibkszurovazaqio67ilyui3ap3gg7g73qimj65ecdkgy5osle5bje, followers, FALSE, FALSE, FALSE, FALSE, 2024-11-15T03:16:28.334Z
## post_data
## 1 app.bsky.feed.post, 2026-10-23T03:40:31.062Z, app.bsky.embed.recordWithMedia, app.bsky.embed.images, Dear algorithm, I don't give a fuck about people getting their hair done at Ulta. Please let's change the topic., 297, 1284, blob, bafkreigj37shgqzm3tx2l62ufui4drw5nzsl4rcqi5knunnlkjs6kdweka, image/jpeg, 280351, app.bsky.embed.record, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, en, She shared on her story 😂
## 2 app.bsky.feed.post, 2026-10-23T03:38:37.397Z, en, I'm not sure what Ulta sells but they have a Christmas commercial running already. Make it stop.
## 3 app.bsky.feed.post, 2026-10-23T03:36:21.303Z, en, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, Do Ulta hairstylists have digital portfolios? Because I need proof.
## 4 app.bsky.feed.post, 2026-10-23T03:29:50.569Z, en, Oop. The hairstylists are shading Ulta.
## 5 app.bsky.feed.post, 2026-10-23T02:54:58.304Z, en, bafyreihysubiutzsn7eah2fjksiag3h36me6rx4qzt4v2sxdqyc5dbqf5u, at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22, bafyreihysubiutzsn7eah2fjksiag3h36me6rx4qzt4v2sxdqyc5dbqf5u, at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22, I also spent 10 minutes this evening helping an old woman replace makeup her daughter-in-law stole and when we were through, she announced it was a better experience than Ulta and my own makeup was done better than theirs. So. Win.
## 6 app.bsky.feed.post, 2026-10-23T02:40:06.488Z, app.bsky.embed.external, The irony of the Ulta/JCPenney salon discourse is watching people flee the unprofessionalism they’ve spent years defending only to seek refuge in institutions that enforce the very norms that were pro..., blob, bafkreihk2ptgiicvcmsf2n4inddzvwx4yki3ya5r5azeh4kaicalzh4nqi, image/jpeg, 64578, Kristy Tillman (@KristyT) on X, https://x.com/KristyT/status/2113252046098805008, app.bsky.richtext.facet#link, https://x.com/KristyT/status/2113252046098805008, 226, 205, en, bafyreifmqjpzfqmd2q72uh7oe2bugmwtdzkvt2wsulbsjvd62zriljxbzu, at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27, bafyreifmqjpzfqmd2q72uh7oe2bugmwtdzkvt2wsulbsjvd62zriljxbzu, at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27, I was in my 30's before I went natural.. Before that, I was an every two weeks standing appointment. At a shop, where the first time I went, I was looking for that framed cosmetology license on the wall \n\nx.com/KristyT/stat...
## embed_data
## 1 https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreigj37shgqzm3tx2l62ufui4drw5nzsl4rcqi5knunnlkjs6kdweka, https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreigj37shgqzm3tx2l62ufui4drw5nzsl4rcqi5knunnlkjs6kdweka, Dear algorithm, I don't give a fuck about people getting their hair done at Ulta. Please let's change the topic., 297, 1284, app.bsky.embed.images#view, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z, app.bsky.feed.post, 2026-10-23T03:29:50.569Z, en, Oop. The hairstylists are shading Ulta., 0, 1, 0, 1, 1, 2, 2026-10-23T03:29:50.750Z, app.bsky.embed.record#viewRecord, app.bsky.embed.recordWithMedia#view
## 2
## 3
## 4
## 5
## 6 https://x.com/KristyT/status/2113252046098805008, Kristy Tillman (@KristyT) on X, The irony of the Ulta/JCPenney salon discourse is watching people flee the unprofessionalism they’ve spent years defending only to seek refuge in institutions that enforce the very norms that were pro..., https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:5jwnvdavdtwwkhcgfif6syzs/bafkreihk2ptgiicvcmsf2n4inddzvwx4yki3ya5r5azeh4kaicalzh4nqi, app.bsky.embed.external#view
## reply_count repost_count like_count quote_count bookmark_count
## 1 1 0 0 0 0
## 2 1 0 1 0 0
## 3 0 0 0 0 0
## 4 1 0 0 1 0
## 5 1 0 6 0 0
## 6 0 0 0 0 0
## indexed_at
## 1 31.846, 40, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 2 37.935, 38, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 3 21.737, 36, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 4 50.75, 29, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 5 58.743, 54, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## 6 8.338, 40, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## created_at
## 1 31.062, 40, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 2 37.397, 38, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 3 21.303, 36, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 4 50.569, 29, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 5 58.304, 54, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## 6 6.488, 40, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## in_reply_to
## 1 <NA>
## 2 <NA>
## 3 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n
## 4 <NA>
## 5 at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22
## 6 at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27
## in_reply_root quotes
## 1 <NA> <NA>
## 2 <NA> <NA>
## 3 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n <NA>
## 4 <NA> <NA>
## 5 at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22 <NA>
## 6 at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27 <NA>
## tags mentions links langs labels
## 1 en NA
## 2 en NA
## 3 en NA
## 4 en NA
## 5 en NA
## 6 https://x.com/KristyT/status/2113252046098805008 en NA
# Check dataset
dim(posts)
## [1] 100 23
names(posts)
## [1] "uri" "cid" "author_handle" "author_name"
## [5] "text" "author_data" "post_data" "embed_data"
## [9] "reply_count" "repost_count" "like_count" "quote_count"
## [13] "bookmark_count" "indexed_at" "created_at" "in_reply_to"
## [17] "in_reply_root" "quotes" "tags" "mentions"
## [21] "links" "langs" "labels"
head(posts)
## uri
## 1 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjayz62s22n
## 2 at://did:plc:hl7k6yrlpy45vqgquayi3pgj/app.bsky.feed.post/3myjavmr2y22s
## 3 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjarkxork2n
## 4 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n
## 5 at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj6hkyl2s22
## 6 at://did:plc:5jwnvdavdtwwkhcgfif6syzs/app.bsky.feed.post/3myj5myijy22p
## cid
## 1 bafyreiaj2nroczhe6h72hhxldowrevgztjhr3iqplbohc3wltucaalmdfu
## 2 bafyreicbrkctxpdrg53hs23b5dx23vb4i5a3rdzaztz2cfr4cbkyrytd24
## 3 bafyreicsec6xpmnpyzhnpnhephdnsna6oihwixzoibvpjbmnzqv6eszp4u
## 4 bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq
## 5 bafyreidarumrpghinl3baxcxwjqixszx57k345dppj2jtldhwizpj6z6cm
## 6 bafyreiexovzcvhg6vsrnvfuvkjepe4ru7z562ctsoouas33ydhy67d3maa
## author_handle author_name
## 1 indeedagem.blacksky.app <NA>
## 2 rodgarrett.bsky.social Rod Garrett
## 3 indeedagem.blacksky.app <NA>
## 4 indeedagem.blacksky.app <NA>
## 5 auntiekristy.bsky.social Mad Auntie Kristy
## 6 elnoraoldschool.bsky.social
## text
## 1 She shared on her story 😂
## 2 I'm not sure what Ulta sells but they have a Christmas commercial running already. Make it stop.
## 3 Do Ulta hairstylists have digital portfolios? Because I need proof.
## 4 Oop. The hairstylists are shading Ulta.
## 5 I also spent 10 minutes this evening helping an old woman replace makeup her daughter-in-law stole and when we were through, she announced it was a better experience than Ulta and my own makeup was done better than theirs. So. Win.
## 6 I was in my 30's before I went natural.. Before that, I was an every two weeks standing appointment. At a shop, where the first time I went, I was looking for that framed cosmetology license on the wall \n\nx.com/KristyT/stat...
## author_data
## 1 did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z
## 2 did:plc:hl7k6yrlpy45vqgquayi3pgj, rodgarrett.bsky.social, Rod Garrett, https://cdn.bsky.app/img/avatar/plain/did:plc:hl7k6yrlpy45vqgquayi3pgj/bafkreidsnz7mex7djkdx5bskaf4425naqn7ejmj4lfyzyyeb4gpc6yyr2e, all, followers, FALSE, FALSE, FALSE, FALSE, 2024-11-06T05:27:48.980Z
## 3 did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z
## 4 did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z
## 5 did:plc:lh3kycaagayvzbjzyjzfq6v6, auntiekristy.bsky.social, Mad Auntie Kristy, https://cdn.bsky.app/img/avatar/plain/did:plc:lh3kycaagayvzbjzyjzfq6v6/bafkreibhg3q44ql3ngagtsub5rl2mv5ddweoq7xtwydfkzr3dy3vv3ecvy, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:lh3kycaagayvzbjzyjzfq6v6, at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.actor.profile/self, bafyreihtyu7vnca6xomhieyrjgxp6zbhlr6ajbvchodvctc57jenvke2va, !no-unauthenticated, 1970-01-01T00:00:00.000Z, 2023-10-23T19:11:35.150Z
## 6 did:plc:5jwnvdavdtwwkhcgfif6syzs, elnoraoldschool.bsky.social, , https://cdn.bsky.app/img/avatar/plain/did:plc:5jwnvdavdtwwkhcgfif6syzs/bafkreibkszurovazaqio67ilyui3ap3gg7g73qimj65ecdkgy5osle5bje, followers, FALSE, FALSE, FALSE, FALSE, 2024-11-15T03:16:28.334Z
## post_data
## 1 app.bsky.feed.post, 2026-10-23T03:40:31.062Z, app.bsky.embed.recordWithMedia, app.bsky.embed.images, Dear algorithm, I don't give a fuck about people getting their hair done at Ulta. Please let's change the topic., 297, 1284, blob, bafkreigj37shgqzm3tx2l62ufui4drw5nzsl4rcqi5knunnlkjs6kdweka, image/jpeg, 280351, app.bsky.embed.record, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, en, She shared on her story 😂
## 2 app.bsky.feed.post, 2026-10-23T03:38:37.397Z, en, I'm not sure what Ulta sells but they have a Christmas commercial running already. Make it stop.
## 3 app.bsky.feed.post, 2026-10-23T03:36:21.303Z, en, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, Do Ulta hairstylists have digital portfolios? Because I need proof.
## 4 app.bsky.feed.post, 2026-10-23T03:29:50.569Z, en, Oop. The hairstylists are shading Ulta.
## 5 app.bsky.feed.post, 2026-10-23T02:54:58.304Z, en, bafyreihysubiutzsn7eah2fjksiag3h36me6rx4qzt4v2sxdqyc5dbqf5u, at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22, bafyreihysubiutzsn7eah2fjksiag3h36me6rx4qzt4v2sxdqyc5dbqf5u, at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22, I also spent 10 minutes this evening helping an old woman replace makeup her daughter-in-law stole and when we were through, she announced it was a better experience than Ulta and my own makeup was done better than theirs. So. Win.
## 6 app.bsky.feed.post, 2026-10-23T02:40:06.488Z, app.bsky.embed.external, The irony of the Ulta/JCPenney salon discourse is watching people flee the unprofessionalism they’ve spent years defending only to seek refuge in institutions that enforce the very norms that were pro..., blob, bafkreihk2ptgiicvcmsf2n4inddzvwx4yki3ya5r5azeh4kaicalzh4nqi, image/jpeg, 64578, Kristy Tillman (@KristyT) on X, https://x.com/KristyT/status/2113252046098805008, app.bsky.richtext.facet#link, https://x.com/KristyT/status/2113252046098805008, 226, 205, en, bafyreifmqjpzfqmd2q72uh7oe2bugmwtdzkvt2wsulbsjvd62zriljxbzu, at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27, bafyreifmqjpzfqmd2q72uh7oe2bugmwtdzkvt2wsulbsjvd62zriljxbzu, at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27, I was in my 30's before I went natural.. Before that, I was an every two weeks standing appointment. At a shop, where the first time I went, I was looking for that framed cosmetology license on the wall \n\nx.com/KristyT/stat...
## embed_data
## 1 https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreigj37shgqzm3tx2l62ufui4drw5nzsl4rcqi5knunnlkjs6kdweka, https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreigj37shgqzm3tx2l62ufui4drw5nzsl4rcqi5knunnlkjs6kdweka, Dear algorithm, I don't give a fuck about people getting their hair done at Ulta. Please let's change the topic., 297, 1284, app.bsky.embed.images#view, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n, bafyreih3ulhxdfsr5my5dewpbgua6knunpv6wxuzfe64cvxykqcm5mhymq, did:plc:ugut3oqrvwdpnpm7n52hquio, indeedagem.blacksky.app, https://cdn.bsky.app/img/avatar/plain/did:plc:ugut3oqrvwdpnpm7n52hquio/bafkreiadz3hfkx3p2etekmw3n2o2fhtt7huujwo5ashbvfdhytopzmxaji, following, following, followers, FALSE, FALSE, FALSE, FALSE, did:plc:ugut3oqrvwdpnpm7n52hquio, at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.actor.profile/self, bafyreih3zyep2e72eahsdrvnzsfsr6wn55deya5j66tif54mhrsuvx23ca, !no-unauthenticated, 2024-11-11T16:29:00.437Z, 2024-11-11T16:29:01.279Z, app.bsky.feed.post, 2026-10-23T03:29:50.569Z, en, Oop. The hairstylists are shading Ulta., 0, 1, 0, 1, 1, 2, 2026-10-23T03:29:50.750Z, app.bsky.embed.record#viewRecord, app.bsky.embed.recordWithMedia#view
## 2
## 3
## 4
## 5
## 6 https://x.com/KristyT/status/2113252046098805008, Kristy Tillman (@KristyT) on X, The irony of the Ulta/JCPenney salon discourse is watching people flee the unprofessionalism they’ve spent years defending only to seek refuge in institutions that enforce the very norms that were pro..., https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:5jwnvdavdtwwkhcgfif6syzs/bafkreihk2ptgiicvcmsf2n4inddzvwx4yki3ya5r5azeh4kaicalzh4nqi, app.bsky.embed.external#view
## reply_count repost_count like_count quote_count bookmark_count
## 1 1 0 0 0 0
## 2 1 0 1 0 0
## 3 0 0 0 0 0
## 4 1 0 0 1 0
## 5 1 0 6 0 0
## 6 0 0 0 0 0
## indexed_at
## 1 31.846, 40, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 2 37.935, 38, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 3 21.737, 36, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 4 50.75, 29, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 5 58.743, 54, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## 6 8.338, 40, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## created_at
## 1 31.062, 40, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 2 37.397, 38, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 3 21.303, 36, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 4 50.569, 29, 3, 23, 9, 126, 5, 295, 0, UTC, 0
## 5 58.304, 54, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## 6 6.488, 40, 2, 23, 9, 126, 5, 295, 0, UTC, 0
## in_reply_to
## 1 <NA>
## 2 <NA>
## 3 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n
## 4 <NA>
## 5 at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22
## 6 at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27
## in_reply_root quotes
## 1 <NA> <NA>
## 2 <NA> <NA>
## 3 at://did:plc:ugut3oqrvwdpnpm7n52hquio/app.bsky.feed.post/3myjafwdgm22n <NA>
## 4 <NA> <NA>
## 5 at://did:plc:lh3kycaagayvzbjzyjzfq6v6/app.bsky.feed.post/3myj67e42uk22 <NA>
## 6 at://did:plc:skl2s4plzkuiz4qoozt3xdyo/app.bsky.feed.post/3myhwcbyy2k27 <NA>
## tags mentions links langs labels
## 1 en NA
## 2 en NA
## 3 en NA
## 4 en NA
## 5 en NA
## 6 https://x.com/KristyT/status/2113252046098805008 en NA
# Check missing text
sum(is.na(posts$text))
## [1] 0
# Check duplicate posts
sum(duplicated(posts$text))
## [1] 8
## 10. Text Cleaning
I used the tidytext package to separate Bluesky posts into individual words and remove common English stop words.
``` r
# Assign unique IDs
posts$post_id <- seq_len(nrow(posts))
# Create tokens
clean_words <- posts %>%
select(post_id, text) %>%
mutate(text = as.character(text)) %>%
filter(
!is.na(text),
text != ""
) %>%
unnest_tokens(
word,
text
) %>%
anti_join(
stop_words,
by = "word"
) %>%
filter(
str_detect(word, "^[a-z]+$"),
nchar(word) > 2
)
head(clean_words)
## post_id word
## 1 1 shared
## 2 1 story
## 3 2 ulta
## 4 2 sells
## 5 2 christmas
## 6 2 commercial
cat(
"Total cleaned words:",
nrow(clean_words),
"\n"
)
## Total cleaned words: 1150
I counted the frequency of words in the Bluesky dataset to identify commonly discussed terms.
word_frequency <- clean_words %>%
count(
word,
sort = TRUE
)
head(word_frequency, 15)
## word n
## 1 ulta 93
## 2 beauty 22
## 3 black 22
## 4 hair 12
## 5 stylists 11
## 6 women 11
## 7 salon 10
## 8 friends 9
## 9 shop 8
## 10 buy 7
## 11 customer 7
## 12 price 7
## 13 holiday 6
## 14 https 6
## 15 kissed 6
# Verify total word counts
stopifnot(
sum(word_frequency$n) ==
nrow(clean_words)
)
This bar chart displays the 15 most frequently used words after cleaning the dataset.
I used the Bing sentiment lexicon to classify words as positive or negative.
bing <- get_sentiments("bing")
sentiment_words <- clean_words %>%
inner_join(
bing,
by = "word"
)
sentiment_counts <- sentiment_words %>%
count(
sentiment,
name = "count"
)
print(sentiment_counts)
## sentiment count
## 1 negative 38
## 2 positive 67
positive_count <- sum(
sentiment_counts$count[
sentiment_counts$sentiment == "positive"
]
)
negative_count <- sum(
sentiment_counts$count[
sentiment_counts$sentiment == "negative"
]
)
net_sentiment <- positive_count - negative_count
cat(
"Positive word matches:",
positive_count,
"\n"
)
## Positive word matches: 67
cat(
"Negative word matches:",
negative_count,
"\n"
)
## Negative word matches: 38
cat(
"Net sentiment score:",
net_sentiment,
"\n"
)
## Net sentiment score: 29
# Verify sentiment count totals
stopifnot(
sum(sentiment_counts$count) ==
nrow(sentiment_words)
)
This interactive Plotly chart compares the number of positive and negative words.
I also calculated sentiment scores for individual posts by assigning a positive word a value of 1 and a negative word a value of -1.
post_sentiment <- sentiment_words %>%
mutate(
score = ifelse(
sentiment == "positive",
1,
-1
)
) %>%
group_by(post_id) %>%
summarise(
sentiment_score = sum(score),
.groups = "drop"
)
head(post_sentiment)
## # A tibble: 6 × 2
## post_id sentiment_score
## <int> <dbl>
## 1 5 1
## 2 8 2
## 3 9 -1
## 4 10 1
## 5 16 5
## 6 17 1
summary(post_sentiment$sentiment_score)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -3.0000 -1.0000 1.0000 0.5088 1.0000 5.0000
I performed additional checks to verify that the AI-generated analysis produced consistent results.
# Review original post text
head(posts$text, 5)
## [1] "She shared on her story 😂"
## [2] "I'm not sure what Ulta sells but they have a Christmas commercial running already. Make it stop."
## [3] "Do Ulta hairstylists have digital portfolios? Because I need proof."
## [4] "Oop. The hairstylists are shading Ulta."
## [5] "I also spent 10 minutes this evening helping an old woman replace makeup her daughter-in-law stole and when we were through, she announced it was a better experience than Ulta and my own makeup was done better than theirs. So. Win."
# Review sentiment classifications
head(sentiment_words, 15)
## post_id word sentiment
## 1 5 helping positive
## 2 5 stole negative
## 3 5 win positive
## 4 8 free positive
## 5 8 stunning positive
## 6 9 allege negative
## 7 10 beauty positive
## 8 16 terrific positive
## 9 16 fastest positive
## 10 16 luxury positive
## 11 16 beauty positive
## 12 16 led positive
## 13 17 affordable positive
## 14 18 support positive
## 15 19 underpaid negative
# Confirm correct sentiment labels
stopifnot(
all(
sentiment_words$sentiment %in%
c("positive", "negative")
)
)
# Verify word counts
stopifnot(
sum(word_frequency$n) ==
nrow(clean_words)
)
# Verify sentiment totals
stopifnot(
positive_count + negative_count ==
nrow(sentiment_words)
)
cat("Verification checks completed.\n")
## Verification checks completed.
The text analysis identifies frequently occurring words in the collected Bluesky posts. Removing stop words helps emphasize terms that may provide more information about the topics being discussed.
The Bing sentiment analysis classifies words as positive or negative and calculates the number of matches in each category. The interactive graph makes it easier to compare these counts.
However, dictionary-based sentiment analysis does not fully understand sarcasm, context, negation, or political opinions. A positive or negative word does not necessarily indicate support for or opposition to a particular candidate. Human judgment is necessary when interpreting the findings.
AI was helpful because it generated R code for importing data, calculating statistics, cleaning text, performing sentiment analysis, and creating visualizations. It also helped me understand different R functions and organize my report.
However, the AI-generated code required adjustments. I encountered problems involving incorrect file paths and improper R Markdown formatting. These errors showed me that AI output must be checked before being accepted.
I also recognized that AI-generated sentiment analysis has limitations because dictionary-based classifications may not reflect the actual meaning of social media posts.
Human judgment contributed to this assignment by helping determine which variables were appropriate for analysis, verifying calculations, correcting errors, and interpreting results.
The retail survey contained a small sample, limiting the conclusions that could be drawn. The Bluesky dataset also required careful interpretation because social media discussions can contain sarcasm, ambiguous language, and opinions unrelated to the main research topic.
AI helped automate technical tasks, but evaluating the accuracy and meaning of the findings remained my responsibility.
This assignment helped me practice using AI to create R code for data analysis. I learned how to import datasets, perform verification checks, calculate descriptive statistics, clean text, conduct sentiment analysis, and generate interactive Plotly charts.
The experience demonstrated that AI can be useful for data analysis, but clear prompts, independent verification, and human judgment are essential for producing reliable results.