0

I don't succeed to modify a data frame, I tried with melt and dcast commands but I don't get what I was expecting. Please, can you help me ? Thank you very much.

My table looks like this :

Prov ;  Equ;  Rep;   Sum
North;   WC;    1; 12566
North;   WC;    2;  1692
North;   IS;    1; 13228
North;   IS;    2;  1030
North;   CL;    1;  2506
North;   CL;    2; 11752
South;   WC;    1; 65216
South;   WC;    2;   878
South;   IS;    1; 65404
South;   IS;    2;   690
South;   CL;    1; 30737
South;   CL;    2; 35357

And I would like to get that :

Prov ; Equ;     1;     2
North;  WC; 12566;  1692
North;  IS; 13228;  1030
North;  CL;  2506; 11752
South;  WC; 65216;   878
South;  IS; 65404;   690
South;  IS; 30737; 35357

Please, could you help me to resolve this little problem ?

Thank you very much.

PS : please, note that Prov, Equ and Rep are character format.

Mickey_NC
  • 269
  • 1
  • 5
  • 17
  • have you tried the methods suggested [in this post](http://stackoverflow.com/q/5890584/5977215) ? – SymbolixAU Mar 23 '17 at 23:43
  • Ok, it works now thanks to you SymbolixAUand the links you gave me. I've used the command spread : spread(table, key = Rep, value = Sum). Thank you very much. Have a nice day. – Mickey_NC Mar 24 '17 at 00:18

0 Answers0