Need to add new rows to a spreadsheet based on a column value.


I have a dataset where I need a single row for every event type that happens at a given time. 10,000-20,000 rows total.

Instead of entering each row manually, I would like to have a column with the number of events that happen on a given day, then use that value to add that number of rows for each event type.

For example, there are 89 events of type 1 on day 2, 76 events of type 1 and 36 events of type 2 on day 3. I would want a datasheet that reads the cell value 89, and adds 89 rows of type 1 day 2 to the sheet, then 76 rows of type 1 day 3, 36 rows type 2 day 3, etc......

Is there a package that would allow me to read that value and create that number of rows for that value in my datasheet?

Thank you!

Congratulations on your first post.

base R has functions for iterating and reading files.
This can be achieved by combining them.

If you publish the specific data and the completed data(show data form you want), we may be able to suggest a solution.

Publishing data that can be tried is a good way to make questions and answers easier.

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.