Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Modifiy Table with R: Grouping of data 'intellegent'

$
0
0

I have a scenario where even with Excel I am not sure how thsi can be automated rather than doing manually.

My Excel chart look like so:

Country      Customer     Device     Level       DueDate
Germany      Aldi         XYZ        3           12.12.20
Germany      Aldi         ABC        3           08.12.20
Germany      Aldi         ZUI        4           08.12.20
USA          LIDL         XYZ        2           12.12.20
USA          LIDL         ABC        2           12.12.20
Jordan       Netto        XYZ        4           12.12.20
Jordan       Netto        ZUI        3           01.11.20

I hope I recreate the situation correctly. My aim is to sum up rows where the Country and Customeris identical and just differs in the Devicepropertie. These shoul be grouped int one row/item by creating a additional row (or replace existing one?) with the following conditions:

  • in column Device list all devices mentioned seperated by ;or similar
  • For Level choose the maximum value
  • For DueDatechoose the minimum value

So for example grouping three beginning elements into one could have this format:

Country          Customer         Device          Level          DueDate
Germany          Aldi          XYZ;ABC;ZUI        4              08.12.20  <--- NEW
USA              LIDL             XYZ             2              12.12.20
USA              LIDL             ABC             2              12.12.20
Jordan           Netto            XYZ             4              12.12.20
Jordan           Netto            ZUI             3              01.11.20

So the grouped rows are replaced by the new one. I currently know what I have to do but have noe clue how to perform this. MAybe this is also possible in Excel? I don't know any intelligence which check if different cells contains the same value and then combine them using a pattern. Could this be easier done wih R or should this be done by hand?


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>