0

I am trying to reformat my data from the dataframe below. We 3 columns and what I'd like to do is make the column 'radius' with 4 unique variables: 200,400,600,800 become row headers while keeping the link between the 'shape_ID' and 'variable'. This can be seen in my desired data frame below

shape_ID variable radius
3 5 200
3 8 400
3 5 600
3 2 800
4 12 200
4 7 400
4 10 600
4 12 800
5 18 200
5 1 400
5 3 600
5 5 800

the desired data frame with the unique variables from 'radius' now as row headers.

shape_ID 200 400 600 800
3 5 8 5 2
4 12 7 10 12
5 18 1 3 5

I presume i need the transpose command but i have struggled to get it functioning just to work on a particular column.

lapgoch
  • 33
  • 5

0 Answers0