I am trying to create this graph in R from the database named df1. The variable on the x-axis is a string variable (a combination of months and years). This is the R code that I have tried. The x-axis is not in the correct order. The graph generated in Excel (which is the correct grpah) and the one generated using ggplot are not the same.
Any suggestions to solve my problem is appreciated.
library(tidyverse)
df1 %>% pivot_longer(-1) %>%
ggplot(aes(x=timeWindow,y=value,group=name, color=name))+
geom_line()
What I am getting now
Dataset(df1)
What I am supposed to get (this is generated from Excel)
Prasanna is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.