Dokumen ini menampilkan visualisasi data Google Trends mengenai platform music streaming di Indonesia menggunakan R Markdown.
library(readr)
## Warning: package 'readr' was built under R version 4.3.3
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
## Warning: package 'tidyr' was built under R version 4.3.3
library(ggplot2)
data_time <- read_csv("googletrends.csv")
## Rows: 53 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (3): Apple Music, Spotify, YouTube Music
## date (1): Time
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(data_time)
## # A tibble: 6 × 4
## Time `Apple Music` Spotify `YouTube Music`
## <date> <dbl> <dbl> <dbl>
## 1 2025-05-04 4 2 86
## 2 2025-05-11 5 3 86
## 3 2025-05-18 4 3 93
## 4 2025-05-25 4 7 86
## 5 2025-06-01 4 4 78
## 6 2025-06-08 4 1 81
data_time <- data_time[-1, ]
colnames(data_time) <- c(
"date",
"Spotify",
"AppleMusic",
"YouTubeMusic"
)
df_long <- pivot_longer(
data_time,
cols = c(Spotify, AppleMusic, YouTubeMusic),
names_to = "Platform",
values_to = "Hits"
)
df_long$Hits <- as.numeric(df_long$Hits)
ggplot(df_long,
aes(x = date,
y = Hits,
color = Platform,
group = Platform)) +
geom_line(size = 1) +
labs(
title = "Perbandingan Tren Music Streaming di Indonesia",
x = "Waktu",
y = "Skor Popularitas"
) +
theme_minimal()
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once per session.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.