[R-sig-Geo] Again, coordinate interpolation with NAs

Mario A. Pardo biomario at gmail.com
Wed Aug 29 18:04:05 CEST 2012


Hi all,

I'm changing the way of my question, since it was missunderstood before.

Given:

lon <- c(-115.86, -115.83, NA, -115.78, -115.78, -115.75, NA, -115.68, 
-115.66)
lat <- c(  29.76,   29.61, NA,   29.55,   29.53,   29.41, NA, 29.13,   
29.09)

I need a new set of coordinates interpolated at a given resolution, 
let's say one data point each xx kilometers or degrees, or at a given 
proportion of the total length, etc.

BUT,

Think of this coordinates as transect points, and I need to keep the 
NAs, since they mark cut offs in my transect. The only think that I need 
is to increase the number of data points in each transect. That means 
that the new.lon would be constitued by values interpolated between the 
first two points (-115.86 and -115.83); after them, a NA should be 
placed, marking a cut off in the transect, then the interpolated data of 
the next three points (-115.78, -115.78 and -115.75), then a NA... and 
so forth. Off course, the new.lat should be the same length as new.lon 
with NAs placed at the same places. As far as I have tried, neither the 
function "approx" or "expand.grid" can do that. I know this is not a 
Matllab list, but since I recently moved from Matlab to R, I just want 
to point out that the function "interpm" does exactly that, just in case 
somebody here knows it.

Thanks! and sorry for the insistence.

-- 
mario



More information about the R-sig-Geo mailing list