Thanks! Works great. I have more questions on this, so I'll continue here:
Now that I have the weighted mean, is it possible to reduce the size of mountain based on this weighted mean such the original matrix remains 21x21 while the mountain shrinks/converges. Step for my analysis: 1) Find centroid/weighted mean of the mountain -> DONE 2) Use centroid value and shrink the mountain to user specified size (half or quarter). 3) Keep the matrix size to 21x21 (or whatever the original size was). Basically make the area around the mountain flat (insert zeros using rbind, cbind?) 4) Compare this mountain with other 21x21 matrices, i.e. perform cross-correlation between them. I know this is a lot. Thanks for any ideas. -- View this message in context: http://r.789695.n4.nabble.com/Centre-of-gravity-of-a-mountain-tp3032319p3033227.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org 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.