0

I have a dataset that has four columns, date, domain, impressions, revenue. All entries under domain have three entries for one date. How do I combine all the domains for one date?

Example of dataset:

Date Domain Impressions Revenue
2021-01-31 domain 1 1000 2000
2021-01-31 domain 1 1000 2000
2021-01-31 domain 2 5000 2000
2021-01-31 domain 2 5000 2000
2021-03-31 domain 3 1000 2000
2021-03-31 domain 3 1000 2000

How i want the table to look:

Date Domain Impressions Revenue
2021-01-31 domain 1 2000 4000
2021-01-31 domain 2 10000 4000
2021-03-31 domain 3 2000 4000

I've tried using aggregate but that doesn't work on char and I've also tried lapply but that doesn't keep the dates separate.

Phil
  • 7,287
  • 3
  • 36
  • 66

0 Answers0