0

enter image description hereI have an R dataset with different IATA Codes. Unfortunately, there are some equal IATA codes with different destination values (e.g. MCO).

How can I sum up the departure values per IATA Code, to finally have every IATA code only once?

I already tried to loop over it but don't know if that's the right approach ...

Andre Wildberg
  • 12,344
  • 3
  • 12
  • 29
Lukas
  • 11
  • 1
  • Perhaps `df1 %>% group_by(from, to) %>% summarise(Departures = sum(Departures))` – akrun Nov 09 '22 at 16:11
  • Have you looked into the `dplyr` package and `group_by`? – VvdL Nov 09 '22 at 16:12
  • It looks like you're new to SO; welcome to the community! If you want great answers quickly, it's best to make your question reproducible. This includes sample data like the output from `dput()` or `reprex::reprex()`. Check it out: [making R reproducible questions](https://stackoverflow.com/q/5963269). – Kat Nov 10 '22 at 16:40

0 Answers0