Summarize data.table by group

前端 未结 2 575
萌比男神i
萌比男神i 2021-02-15 12:41

I am working with a huge data table in R containing monthly measurements of temperature for multiple locations, taken by different sources.

The dataset looks like this:<

2条回答
  •  梦毁少年i
    2021-02-15 13:07

    If we are using data.table, the CJ can be used

     CJ(Location=loc, date= dates,Model= mods)[, 
             Temperature:= temp][, .(Mean = mean(Temperature)), by = .(Location, date)]
    

提交回复
热议问题