[R-sig-Geo] Coordinate interpolation keeping NAs

Mario A. Pardo biomario at gmail.com
Wed Aug 29 01:38:09 CEST 2012


Greetings,

I'm sorry if this question is too basic, but I just recently moved to R.

Let's say I have:

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)

and I need a new set of coordinates c(new.lon, new.lat) with a higher 
resolution, following some interpolation criterium, but keeping the NAs 
where they should be, according to the original data.

Is there any function similar to 'approx' that does this? I tried with 
that one but I wasn't able to avoid the interpolation over the NAs. 
Also, I would like to establish that the interpolation follows a fixed 
distance, such as a coordinate point each xx kilometers or degrees.

Thanks a lot in advance!

-- 
mario



More information about the R-sig-Geo mailing list