0

I have over a hundred files in excel that in general have the same format of : Screenshot of format

they are all different lengths too!

I want to combine the data of all the different excels sheet into this format:

Desired format

So far my thinking is:

  1. create a new column in every excel sheet that is titled Day
  2. combine day column and Steps column in some kind of join that combines the title of the two columns to say day{1}steps and have the data of where they intersect be the data that goes in that row

Is this the right thought process on how to do that? Any tips on how to get to my end result?

  • I'd use dplyr `group_by` + `summarize` to get flights and steps per day per user. Then tidyr::pivot_wider` to put those into wide format. – Jon Spring May 07 '21 at 14:41
  • BTW, it will be much easier for people to help you here if you can provide a sample of code that generates an R object (e.g. after the import from excel) with sample input data. https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Jon Spring May 07 '21 at 14:44

0 Answers0