Pendahuluan

Data yang digunakan adalah data historis harian BBRI dengan menggunakan paket ‘ggplot’ dan ‘dplyr’

R Markdown

bbri <- read_csv("C:/Users/ASUS/Downloads/Data Historis BBRI.csv")
databri2 <- data.frame(Time = dmy(bbri$Tanggal), Price = bbri$Terakhir)
str(databri2)
## 'data.frame':    709 obs. of  2 variables:
##  $ Time : Date, format: "2026-03-16" "2026-03-13" ...
##  $ Price: num  3.5 3.51 3.57 3.58 3.56 3.57 3.67 3.75 3.69 3.77 ...
p <- ggplot(databri2, aes(x=Time, y=Price)) + 
  geom_line() +
  xlab("Date") 
p

Including Plots

p + scale_x_date(date_labels = "%b %Y", date_breaks = "2 months" )+
  theme_minimal()+
  theme(axis.text.x=element_text(angle=50, hjust=1))+
  geom_vline(xintercept = 
               as.Date("2024-03-16"),
             linetype = 2, color = 2, 
             linewidth = 1) +
  geom_vline(xintercept = 
               as.Date("2025-03-16"),
             linetype = 2, color = 2, 
             linewidth = 1) +
  scale_x_date(date_labels = "%b %Y", date_breaks = "3 months") +
  labs(title = "BBRI Stock Price (2023-2026)",
       x = "Date",
       y = "Closing Price (IDR)")