Load dataset

t <- read.csv(“C:/Users/banda/OneDrive/Desktop/stt/project.csv”)

Arrange data by streams in descending order

jk <- t %>% arrange(desc(streams))

View top and bottom records

head(jk) tail(jk)

Summarize total streams by artist

artist_streams <- t %>% group_by(artist.s._name) %>% summarise(total_streams = sum(streams, na.rm = TRUE)) %>% arrange(desc(total_streams))

Filter for BTS ranking

bts_rank <- artist_streams %>% filter(artist.s._name == “BTS”)

BTS rank output

bts_rank

Basic Plots

plot(t\(released_day, t\)streams, main = “Spotify data”) plot(t\(streams, t\)released_month, pch = 21, bg = c(“purple”, “pink”, “green4”)[unclass(t\(artist_count)], main = "Spotify Data") plot(t\)released_year, t$streams, main = “Spotify data”)

Histogram of released months

hist(t$released_month, main = “Histogram”, xlab = “Released Month”, col = “pink”, border = “black”)

Other types of visualizations used:

- Heatmap

Subset the data to include only numeric columns

numeric_data <- jk[, sapply(jk, is.numeric)]

Calculate the correlation matrix

correlation_matrix <- cor(numeric_data)

Create a heatmap of the correlation matrix

heatmap(correlation_matrix, main = “Heatmap of Correlation Matrix”, xlab = “Variables”, ylab = “Variables”, col = heat.colors(12), symm = TRUE) # Select Top 20 Artists top_artists <- head(artist_streams, 20)

Set labels to artist names

labels <- top_artists$artist.s._name

Create Pie Chart

pie( top_artists$total_streams, labels = labels, main = “Top 20 Artists by Total Streams”, col = rainbow(20) ) # Select Top 5 Artists top5 <- head(artist_streams, 5)

Create Bar Plot

barplot( top5\(total_streams, names.arg = top5\)artist.s._name, col = “skyblue”, main = “Top 5 Artists by Total Streams”, xlab = “Artist”, ylab = “Total Streams”, las = 2 # Make x-axis labels vertical )