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:<
If we are using data.table, the CJ can be used
data.table
CJ
CJ(Location=loc, date= dates,Model= mods)[, Temperature:= temp][, .(Mean = mean(Temperature)), by = .(Location, date)]