This is an R HTML document. When you click code chunk like this:

Time series plot (using ggfortify)
  library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
  library(ggfortify)

  autoplot(AirPassengers) +
    labs(title="AirPassengers")  # where AirPassengers is a 'ts' object
plot of chunk unnamed-chunk-1
Multiple Time Series on same ggplot (Approach 1)
  library(tidyverse)
  library(ggfortify)
                                      # Approach 1:
  data(economics, package="ggplot2")  # init data
  economics <- data.frame(economics)  # convert to dataframe
  ggplot(economics) +
    geom_line(aes(x=date, y=pce, color="pcs")) +
    geom_line(aes(x=date, y=unemploy, col="unemploy")) +
    scale_color_discrete(name="Legend") +
    labs(title="Economics")       # plot multiple time series using 'geom_line's
plot of chunk unnamed-chunk-2
Multiple Time Series on same ggplot (Approach 2)
  library(tidyverse)
  install.packages("reshape2")
## Installing package into 'C:/Users/admin/AppData/Local/R/win-library/4.4'
## (as 'lib' is unspecified)
## Error in contrib.url(repos, "source"): trying to use CRAN without setting a mirror
  library(reshape2)
## 
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
## 
##     smiths
  df <- melt(economics[, c("date", "pce", "unemploy")], id="date")
  ggplot(df) +
    geom_line(aes(x=date, y=value, color=variable)) +
    labs(title="Economics")           # plot multiple time series by melting
plot of chunk unnamed-chunk-3
Multiple Time Series using facet_wrap
  library(tidyverse)
  library(reshape2)

  df <- melt(economics[, c("date", "pce", "unemploy", "psavert")], id="date")
  ggplot(df) +
    geom_line(aes(x=date, y=value, color=variable))  +
    facet_wrap( ~ variable, scales="free")
plot of chunk unnamed-chunk-4