import the required libraries

function creates a time series plot with lines for different groups. It takes data, time column name, value column name, and group column name as input and outputs a ggplot with labels and title

plot_time_series <-function(data,time_col,value_col,group_col)
{
  data[[group_col]]<- as.factor(data[[group_col]])
  ggplot(data,aes_string(x=time_col ,y=value_col,group=group_col,color=group_col))+
    geom_line()+
    labs(
      
      x="time",
      y="value",
      color="group"
    )+
    theme_minimal()+
    ggtitle(paste("time series treand of ",value_col,"by",group_col))
}

import the dataset and call the function and get the required graph

## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.