#I have data in a matrix with longitude (x coordinates) regularly spaced at
2.8 degrees and lat (y coordinates) at 2.5 degrees.I want to Resample my
matrix z to a different resolution of say 1x1 in R without using
interpolation (e.g inter in Akima package) because this distorts the data
i.e. The data should not vary smoothly in space. What I want is analogous to
resample in a GIS withoout smoothing, something like assigning the new pixel
with the average or maximum of the contents in the pixel location. Ideally
think of it like cutting a piece of cloth into tiny bits that retain the
information!

x<-seq(29,36,2.8)#lon
y<-seq(-4,6,2.5)#lat
z<-matrix(runif(length(x)*length(y)),length(x),length(y))# my original
matrix
par(mfrow=c(2,2))
image(x,y,z,col=cm.colors(20))# plots the data as is

#Using Interpolation with Akima Interp
library(akima)
xd<-seq(29,36,1)# new lon
yd<-seq(-4,6,1) # new lat
old.kords<-expand.grid(x,y)
zd<-interp(old.kords[,1],old.kords[,2],c(z),xd,yd)
image(xd,yd,zd$z,col=cm.colors(20))# shows that interpolation has distorted
the spatial pattern. What i want is similar pattern but with finer grid.
Interp clearly cannot do this.

# so how do i resample without changing the pattern.

-- 
<a href="http://inside-r.org/download" title="Download R"><img src="
http://inside-r.org/sites/all/themes/rweb/assets/badges/download-r-badge-125-blue.png"
border="0" /></a>

	[[alternative HTML version deleted]]

