I am wondering how to use the "by" function to group by and sum multiple columns. If I wanted to groupby one column I can do it by this
someData = DataFrame(:Countries => ["Afganistan","Albainia","Albainia","Andorra","Angola","Angola"],:population => rand(100:1000,6), :GDP => rand(1:100,6))
by(someData, :Countries, df ->DataFrame(pop_sum = sum(df[:population])))
However, I wanted to get the sum of both population and GDP. I tried something like below which is of course incorrect. Any ideas?
by(someData, :Countries, df ->DataFrame(pop_sum, GDP_sum = sum(df[[:population,:GDP]])))