Need help to reshape data

Hi!

I have an example datasett like this

day b1 b2 b3
0 50 55 65
1 105 107 109
2 162 185 170

I want to rehape like this

day newname char
0 50 b1
1 105 b1
2 162 b1
0 55 b2
1 107 b2
2 185 b2
0 65 b3
1 109 b3
2 170 b3

Is it possible to do this fast in a loop or somthing? Because full dataset includes up to b66 and 47 days.

Regards Marit

Try the pivotlonger function as part of the tidyr package.

1 Like

This topic was automatically closed 7 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.