0

I have a dataset composed of the following columns

Subject_Number     Condition        .... other columns 
300                drug
300                placebo
299                placebo
298                drug
297                drug 
296                placebo

...

As you can see, each participant (e.g. participant number 300) has been analysed on two occasions once with the drug and once with a placebo

Now i am required to do the following: for each participant, I need to make it so the first condition is the drug and the second is the placebo:

Subject_Number     Condition        .... other columns 
300                drug
300                placebo
299                drug
298                placebo
297                drug 
296                placebo
...

Can you help me find out how to do this? Thanks!

I can sort or order the dataframe based on the condition column but then it will change the dataframe in a way where first it shows all the drug rows, then all the placebo rows together. I don't want that. I need to make it so within each subject number the drug row comes first and the placebo row comes second. Hope I explained myself!

DerKeller
  • 11
  • 2

0 Answers0