[R] How to average values from grid cells with coordinates

lily li chocold12 @ending from gm@il@com
Wed May 16 06:23:23 CEST 2018


Hi R users,

I have a question about data processing. I have such a dataset, while each
black grid cell has a few attributes and the corresponding attribute
values. The latitude and longitude of the center of each grid cell are
given also.

Then I want to average the attribute values from four adjacent grid cells
to get the average value for the center of each red grid cell. Thus, there
are the same number of attributes, but different values. The red grid cells
do not overlap. I was thinking to write such a script that can ID each
black grid cell, for example, 1, 2, 3, 4, ..., then the corresponding four
grid cells will be used to average for the red grid cell. But I just have
the latitude and longitude, attribute values for the black cells, and also
latitude and longitude for the red cells, how to write such a script in R.
Could anyone give me suggestion about the work flow? Thanks very much.

I attached the picture of the grid cells here.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gridcell2.pdf
Type: application/pdf
Size: 320961 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20180515/82d71ed1/attachment.pdf>


More information about the R-help mailing list