[R-sig-Geo] customized focal mean

Mathieu Rajerison mathieu.rajerison at gmail.com
Wed Mar 18 13:55:14 CET 2015


Hi,

Maybe you could look at raster::focal function and w (matrix of weights
arguments)
http://www.inside-r.org/packages/cran/raster/docs/focal

"w
matrix of weights (the moving window), e.g. a 3 by 3 matrix with values 1;
see Details. The matrix does not need to be square, but the sides must be
odd numbers. If you need even sides, you can add a column or row with
weights of zero"

2015-03-12 6:37 GMT+01:00 hariom <hariom.cs1 at gmail.com>:

> Hello list,
>
> I want to customized focal mean in which my concern is to replace mean
> value
> with the matrix such as:
>
> *2 2 2* 2
> *2 1 2* 1
> *1 2 4* 2
> 2 1 2 2
>
> first generate the mean of 3*3 matrix and then replace with entire matrix
> and it will work throughout the raster data.
> first matrix mean is 2 and  it will replace and continue.....
>
>  2 *2 2 2*
>  2 *2 2 1*
>  2 *2 2 2*
>
>
> Please help me i will appreciate for your time and concern
>
> Hariom singh
> Research scholar IIT Roorkee
>
>
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/customized-focal-mean-tp7587890.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list