[R] sample points - sp package
MacQueen, Don
macqueen1 at llnl.gov
Fri Feb 10 01:09:29 CET 2012
I suggest you ask this question on r-sig-geo.
And it would be best if you could create a small self-contained example.
For example, what class of object is dataset2?
Is there any reason to expect that the coordinates of the sample will be
exactly the same as any of the coordinates in dataset2?
Probably, you will have to find a function that will find the point in
dataset2 that is nearest to each point in your sample. I believe there are
a few such functions among the R spatial packages, but I don't remember
any names.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 2/9/12 4:39 AM, "anaraster" <rrasterr at gmail.com> wrote:
>When I make a sample in sp, for example a random samping of 5 points in
>dataset1:
>
>sample.dataset1=spsample(dataset1, n = 5, "random")
>
>I have a sp object for the selected sampling...
>
>My question is : How can I extract from dataset2 the points & data for the
>coordinates(sample.dataset1) ?
>
>The dataset2 would be an object with the same area and coordinate system,
>but I would like to extract for the coordinates of sample.dataset1 the
>data
>in each point for dataset2.
>
>I didn't found a way to do this in the sp package docs, but I might have
>missed it.
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/sample-points-sp-package-tp4372673p4372673.h
>tml
>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.
More information about the R-help
mailing list