I have monthly .csv data from 2007-2017 with monthly average temperature for 100 stations located in some counties. I have a total of 300 counties. I want to do IDW to calculate the monthly average temperature for all the 300 counties. I want to code this IDW using the three closest stations from each county centroid. And also for the 3 closest up to 50 km.
I have no idea how to do this with my panel data with 11 years, 12 months each and 300 counties.
Thank you!!
Cheers!
station,county,long,lat,t1,t2,...t120 #t1 = 2007-01-01, etc.
the location variables can be converted to a simple feature point object, using the {sf} package. If counties are in the US, the {tidycensus} package will fetch counties as simple feature polygon objects. sf can derive the centroid of each county. Depending on preferences, you can then calculate either simple euclidian distances or geodetic distances.