[R] Idetntifying nearest topographic contours to data points

From: sam.e <sam.engwell_at_bristol.ac.uk>
Date: Fri, 15 Apr 2011 09:18:58 -0700 (PDT)


Hi there,
I have two data sets, one of locations at different elevations (x,y,z) and the other of points that make up topographic contours (also x,y,z). I have used:

result<-apply(distppll(data2,cbind(topocon[-nrow(topocon),],topocon[-1,])),1,min)

where 'data2' are my measurement coordinates (x, y) and 'topocon' are my topographic contours (x,y). While this gives me an output of the distance from each data point to the nearest topographic contour point, I would also like to output the 'z' value of the nearest topographic point to each data point. Does anyone know how I could go about this?

Ideally what I would like to output is a matrix which has: data elevation (data2$z) distance to nearest contour elevation of nearest contour (topocon$z)

Any help would be much appreciated,
Sam

--
View this message in context: http://r.789695.n4.nabble.com/Idetntifying-nearest-topographic-contours-to-data-points-tp3452462p3452462.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Fri 15 Apr 2011 - 16:50:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 16 Apr 2011 - 02:10:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive