Dear r-friends,

Starting from a random position of a matrix, I would like find the position 
(index) of max values using 3x3 and 5x5 windows. Just supose that I have 
something like:

set.seed(1)
my.values<-round(runif(441)*21,0)
my.matrix<-matrix(my.values,21)
image(my.matrix,xaxs="r",yaxs="r",col=heat.colors(10))
start.pos<-c(0.5,0.5) # this position are c(11,11)
points(start.pos[1]~start.pos[2])

So I would like to see what are the values great than the value of my current 
position, and go for the position where the value are great. When the greatest 
value are present on more than one neighbour position, so I would like use a 
5x5 window to decide how "path" could help me to maximize the value.

>From a random position, I will stop when no more values (using 3x3 and 5x5 
>windows) are great than the position that I reach up.

I know that there are some GIS solutions that do this, but I really need use R 
to implement in a package that I am programing now.

Kind regards,

miltinho

__________________________________________________


        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to