Data Source: This data source was scaped using the blue sky api/app password. The api was specifically looking for words with in posts that contained the word “Miata” and pull 100 posts to analize they text.

# Load all required libraries at the start
library(atrrr)
library(dplyr)
library(readr)     # Needed for write_csv()
library(tidytext)
library(ggplot2)
library(wordcloud)

Authentication: Add your Blue Sky credentials here to conduct your own text analysis.

# Authenticate and gather data
# auth("nlcastillo.bsky.social")

myfollowers <- get_followers(actor="nlcastillo.bsky.social", limit=4000)

post <- search_post("Miata")
write_csv(post, "Miata.csv")

Cleaning Text: This section cleans the text to remove any miscellaneous characters.

# Clean list columns and tokenise words
post_clean <- post %>%
  mutate(across(where(is.list), ~ sapply(., function(x) paste(x, collapse = "; "))))

words_cleaned <- post %>%
  select(text) %>%
  unnest_tokens(word, text) %>%
  anti_join(stop_words, by = "word") %>%
  filter(!stringr::str_detect(word, "^[0-9]+$")) %>%        
  filter(!stringr::str_detect(word, "http|https|t.co")) %>% 
  filter(word != "Miata")                                    

word_counts <- words_cleaned %>%
  count(word, sort = TRUE)

Top 10 Most Common Words:

print("Top 10 Most Common Terms:")
## [1] "Top 10 Most Common Terms:"
print(head(word_counts, 10))
## # A tibble: 10 × 2
##    word        n
##    <chr>   <int>
##  1 miata     207
##  2 mazda      51
##  3 car        27
##  4 mx         25
##  5 cars       17
##  6 time       11
##  7 drive      10
##  8 edition    10
##  9 driving     9
## 10 top         9

Top 15 Terms: This graph provides the 15 most used terms from the pool of 100 posts gathered during the data scraping process.

# Plot the top 15 terms
ggplot(head(word_counts, 15), aes(x = reorder(word, n), y = n)) +
  geom_col(fill = "steelblue") +
  coord_flip() +
  labs(
    title = "Top 15 Most Common Words in 'Miata' Bluesky Posts",
    x = "Words",
    y = "Count"
  ) +
  theme_minimal()

Word Cloud: Finally we use a word cloud to visualize how frequent certain words were used in the 100 posts.

# Load the color palette package needed for the wordcloud colors
library(RColorBrewer)
library(wordcloud)

# Generate the word cloud
wordcloud(
  words = word_counts$word, 
  freq = word_counts$n, 
  min.freq = 2,           
  max.words = 100,        
  random.order = FALSE,   
  colors = brewer.pal(8, "Dark2")
)

Findings: Scraping data for the word “Miata” provides deep insight into the public’s perception of the Mazda Miata sports car. Mazda has done an amazing job of advertising the Miata for numerous years, fostering a cross-generational love for the vehicle. Terms such as “love,” “driving,” and “racing” frequently appear within the word cloud, solidifying the Miata not just as a car, but as the definition of a culture. Overall, consumers value a high-quality product; by conducting this data scrape and analyzing the high volume of Miata posts, it is clear that brands like Mazda intentionally cultivate a passionate car culture to gain a cult following and ultimately drive up their sales.

Referance: https://www.autoblog.com/features/this-is-why-the-mazda-miata-has-a-cult-following