I am trying to plot two line graphs for two different years of dataframe. However, I am getting error:
geom_path: Each group consists of only one observation. Do you need to adjust the group
aesthetic?
Could you please advise how to solve it? Thanks
library(tidyverse) # example data df2<-data.frame(c(1000,700),c(2000,1500)) rownames(df2)<-c("Revenue", "EBITDA") colnames(df2)<-c("2020", "2021") # reshape dataset df2_upd = df2 %>% rownames_to_column("Financials") %>% gather(year, value, -Financials) print(df2_upd) # plot using the new dataset ggplot(data=df2_upd, aes(x=year, y=value, fill=Financials)) + geom_line()