-1

Is there a way in excel, Python, or R to convert data that is in the format of time and quantity per date into one long column. For instance:

Current format:

Instead I want this data to be one long column of 17 0s followed by 1 1 and 176 0s etc.

Thank you in advance for any help.

To elaborate the data looks like this:

Current data:

And I need this data to look like this:

Final result:

  • Please add data using `dput` and not as images. Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). – Ronak Shah Jun 15 '20 at 03:50

1 Answers1

1

One option with uncount

 library(tidyr)
 uncount(dat, quantity)

Or with rep

with(dat, rep(time, quantity))