I am having a very simple data frame as below.
cat_group total abort_rate cancel_rate success_rate
100 1804 18.8 45.1 31.8
200 4118 17.7 30.0 48.3
500 14041 19.2 16.9 60.0
I am trying to put this data on a plot such that on the x-axis, I will have cat_group and then I would line plot all the other variables total, abort_rate, cancel_rate and success_rate. My idea is to show how each of these variables vary according to the value in cat_group. I would need four lines in total, one for each variable in a different colour
But when I use the below plot function in R, I am seeing the error: geom_path: Each group consist of only one observation. Do you need to adjust the group aesthetic?
ggplot(my_data_frame, aes(category)) +
geom_line(aes(y = abort_rate, colour = "abort_rate")) +
geom_line(aes(y = success_rate, colour = "success_rate"))+
geom_line(aes(y = success_rate, colour = "total"))+
geom_line(aes(y = success_rate, colour = "cancel_rate"))
Any suggestions on how to resolve this issue?



categorycolumn in your data.frame. Please fix. And you shouldmeltto switch from wide to long format.