Assignment 1

Author

Mohamed Ali

Introdcution

First Categorical Analysis

Code
library(tidyverse)
top_albums <- read_csv(
  "https://jsuleiman.com/datasets/Rolling_Stones_Top_500_Albums.csv",
    locale = locale(encoding = "ISO-8859-2", asciify = TRUE))
Code
top_genres <- top_albums |> 
  count(Genre, sort = TRUE) |> 
  top_n(10, n)
ggplot(top_genres, aes(x = reorder(Genre, n), y = n)) +  
  geom_bar(stat = "identity", fill = "skyblue") +  
  labs(title = "Top 10 Most Common Genres", x = "Genre", y = "Count") +  
  theme_minimal() +  
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

Second Categorical Analysis

Code
library(tidyverse)
top_albums <- read_csv(
  "https://jsuleiman.com/datasets/Rolling_Stones_Top_500_Albums.csv",
    locale = locale(encoding = "ISO-8859-2", asciify = TRUE))
Code
top_genres <- top_albums |>  
  count(Genre, sort = TRUE) |>  
  top_n(10, n)

ggplot(top_genres, aes(x = Genre, y = n, size = n, fill = Genre)) +  
  geom_point(alpha = 0.7, shape = 21, color = "skyblue") +  
  scale_size(range = c(3, 15)) +  
  labs(title = "Top 10 Most Common Genres (Bubble Chart)", 
       x = "Genre", 
       y = "Count", 
       size = "Count") +  
  theme_minimal() +  
  theme(axis.text.x = element_text(angle = 45, hjust = 1))