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

Jose Tanago josetanago at gmail.com
Mon Aug 31 10:43:03 CEST 2015

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 function?,
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 attribute
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 a
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 long
with millions rows.

Thanks a lot for any idea!

Jose Tanago

Lab. of Remote Sensing, Wageningen University

	[[alternative HTML version deleted]]

More information about the R-sig-Geo mailing list