Skip to content
Prev 374664 / 398513 Next

How to average values from grid cells with coordinates

Hi Jim,

Thanks. Yes, the two assumptions are correct, and they reflect the
datasets. I have an uncertainty about the code below. Why do you use
abs(blackcells[[i]]$lat - redcell$lat) <1 rather than a different number
than 1? Second, why to construct blackcells as a list, rather than a
dataframe. Because in a dataframe, each row can represent one grid cell,
while the three columns can represent the lati, lon, and pop. Thanks again
for your help.

for(i in 1:121) {
if(abs(blackcells[[i]]$lat-redcell$lat) < 1 &&
abs(blackcells[[i]]$lon-redcell$lon) < 1) {
close4[closen]<-i
closen<-closen+1
}
}
On Wed, May 16, 2018 at 2:45 AM, Jim Lemon <drjimlemon at gmail.com> wrote: