[R-sig-Geo] spsample

MacQueen, Don macqueen1 at llnl.gov
Fri Jul 10 17:23:08 CEST 2015


I'm not so deeply familiar with spsample that I know of a way to do this
directly.

However, I think it would be pretty easy to use spsample to first obtain
more points than needed, then calculate all the distances from the center,
then use the base::sample function to select a weighted sample, with
weights based on the distance from the center (see the prob argument to
sample).

-Don


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 7/10/15, 2:59 AM, "R-sig-Geo on behalf of Luca Candeloro"
<r-sig-geo-bounces at r-project.org on behalf of luca.candeloro at gmail.com>
wrote:

>Hi,
>following the example found in SpeciesDistributionModelling, a given
>number
>of points is drawn randomly within a circle:
>
>x <- circles(pts, d=50000, lonlat=T, col='light gray')
># sample randomly from all circles
>> samp1 <- spsample(x at polygons, 250, type='random', iter=25)
>
>Is there a way to specify weigths decreasing from the circle center, so
>that random points are most likely near it?
>
>thanks ,
>Luca
>
>	[[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list