[R-sig-Geo] Looking for an R package for focal statistics (moving window) within a 3D neighborhood

Verbesselt, Jan jan.verbesselt at wur.nl
Mon Aug 31 16:30:27 CEST 2015

Check out GRASS functionality


which can be very efficient as nicely combined with R via




On 31/08/15 10:43, "R-sig-Geo on behalf of Jose Tanago"
<r-sig-geo-bounces at r-project.org on behalf of josetanago at gmail.com> wrote:

>I am writing an algorithm in R for 3D point data sets (centers of voxels),
>read as an R data.frame  with 4 columns (x,y,z values and an attribute).
>They can be big (e.g. millions rows).
>I am trying to find any R package that has any function for computing a 3D
>neighborhood (filter or statistics,...). If such funtion{package}  already
>exists it would be great!, but if not, at least any function from a
>non-spatial R-package that could be useful to build an ad-hoc 3D
>neighborhood function might work as well.
>Does anyone know a preexisting R package that has a neighborhood
>or any tips how could be implemented with other packages (customizing or
>building from a more generic package)??
>The problem that the function would help: Check the values of the
>column for all the points within a 3D neighborhood from any point (any
>instance in the data.frame differing less than  "a" value in X,Y,Z,
>coordinates). (i.e. A sort of moving window for a raster but in a 3D
>neighborhood). Then, transform the "cell" or 3D point attribute value, if
>condition is fulfilled for any of the 3D neighbors.
>If there is no package with a 3D neighborhood function, I though maybe is
>possible to create a custom function that for each instance (point)
>evaluates all others points XYZ  in the data.frame and computing a
>neighborhood attribute value by selecting only the ones within a distance
>in XYZ. But I am not very sure how to make something like this in a
>reasonable way, I guess evaluating all other points xyz will take very
>with millions rows.
>Thanks a lot for any idea!
>Jose Tanago
>Lab. of Remote Sensing, Wageningen University
>	[[alternative HTML version deleted]]
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org

More information about the R-sig-Geo mailing list