0

I am trying to rearrange data frame. I want to assign unique values from a column as rows and then place values from other columns in it. Also another column has to be merged based on the unique values. Please check the example data as I feel my explanation is not that clear.

Original Data

 date         value     pointid
20080211    0.127176584 912
20080211    0.183719306 857
20080211    0.137604321 921
20080211    0.216375169 801
20080211    0.13065917  909
20080211    0.133545315 855
20080501    0.109766831 912
20080501    0.140768784 857
20080501    0.10956354  921
20080501    0.198252819 801
20080501    0.104955153 855
20080517    0.097610717 912
20080517    0.130558299 857
20080517    0.103438949 921
20080517    0.177195366 801
20080517    0.099684468 855

Expected Dataframe

Date            912         857         921         801         909         855
20080211    0.127176584 0.183719306 0.137604321 0.216375169 0.13065917  0.133545315
20080501    0.109766831 0.140768784 0.10956354  0.198252819             0.104955153
20080517    0.097610717 0.130558299 0.103438949 0.177195366             0.099684468
dhyeyey
  • 15
  • 3

1 Answers1

-1

Try spread(date,pointid,value)

June7
  • 19,874
  • 8
  • 24
  • 34
yoyomada
  • 14
  • 1