Multiple varibles/columns representing the same thing (date)


I have a dataset which is a little complicated for visualisation.

The column names are as follow:
country; molecule; pack; units_sold _09_2013; units_sold _12_2013; units_sold _02_2014; ......the dates go all the way up to units sold _10_2020
so from 2013 uptill 2020.
There are a total of 175 columns but currently, I am interested in 55.
I want to make a graph with sold _09_2013.......units_sold_10_2020. Which show the number of drugs sold in each month/year. I want this on the x-axis so I can plot trends of drug consumption in different countries with time/month/year but I can't seem to find a solution to plot them as one on the x-axis.
I have attached a picture of a graph I am interested to construct with my dataset.

Any suggestions will be appreciated. How can I get multiple columns
(which are dates on which drug was sold) on the x-axis. How to plot a graph?

You could use pivot_longer() to bring all those columns and there values into one column and then plot it on the X axis.

You can check more about pivot longer at the link below:

Or, if you have a data sample I can take a look.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.