0

Unfortunately, I'm totally lost with R. I grew up with SPSS, which I really regret right now.

My problem:

  1. I have several Excel files
  2. In each file I have several rows, which belong to one specific participant. Each row consists of several columns. E.g. for participant A several rows with several columns, for participant B several rows with several columns and so on
  3. My goal is to have just one row for each participant with all the data in columns
  4. This means, I need a syntax which moves the second row of participant A (and so on) to the column end of the first row
  5. Afterwards the next row of participant A needs to be moved to the end of the first row. This should be iterated until I have only one row for participant A with all the data in columns.
  6. Then I need to do same for participant B, C and so on

Is there a possibility to do this with r? I'm so lost.

Best, Jonas

  • 1
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Let's assume you can correctly import your data so skip the Excel file part. – MrFlick Apr 18 '18 at 19:27
  • Do you have the id for the participant in each of the rows? Do the rows within participant have individual identifiers? Would be good to show some sample rows (maybe for 2 people and just a few columns each) and then what you would like the final outcome to be. – Elin Apr 18 '18 at 19:27
  • Thank you for your quick reply. I'll look into the reproducible example tomorrow (it's late here). When you click on the [link](https://drive.google.com/open?id=1f3C-Qxub6ojPGbnsywsx9kuzndBwXITm) you see two screenshots which show you how it should look like for participant "kg01t2". It's from Excel but I think you'll get the idea. Thank you again. I'm so happy that I got a reply. My mood is better again. Best, Jonas – Jonas Zimmermann Apr 18 '18 at 21:02
  • Don't feel discouraged if you get down votes, when you edit your question to follow the standard format (no screenshots please) people will take off the down votes. – Elin Apr 19 '18 at 00:33

0 Answers0