You can use, 'sample' function for sampling and may consider using
partition clustering for selecting your regions, see Cluster task view:
http://cran.r-project.org/web/views/Cluster.html
On 4 December 2012 00:53, KoopaTrooper <ncooper1 at tulane.edu>
wrote:> I am using package ks() to build 3D representations of bird territories and
> calculate territory volume from spatial data (simply x, y, and z
> coordinates). What I want to do is determine at what sample size (#
> locations collected) does the territory volume stop increasing. This should
> give me an idea of the number of points needed for future seasons.
>
> So I have a couple of birds each with 200 spatial locations (x,y,z). I want
> to run the following code (see below), but have R calculate territory size
> 100 times with 10 random points (no replacement), 100 times with 20 random
> points, 100 times with 30 random points, etc. I can figure out how to do
> this manually (i.e. create 100 individual files with 10 random points, 20
> random points, etc.) but I figure there must be a way to make my life
> easier. Any help would be appreciated. Even pointing me in the correct
> direction would be a big help. Thanks!
>
> Nathan
>
> #read data files (.csv's with 200 rows of x,y,z coordinates)
> a<-read.csv("A_PW_ASY_M_LII_2011.csv")
>
> #calls the plug-in bandwidth estimator
> Ha <- Hpi(a)
>
> #sets min/max grid size for each dimension
> minX<-min(a$X)-25
> minY<-min(a$Y)-25
> minZ<-0
>
> maxX<-max(a$X)+25
> maxY<-max(a$Y)+25
> maxZ<-max(a$Z)+5
>
> #creates kernel utilization distribution
> fhata <- kde(x=a, H=Ha, binned=FALSE, xmin=c(minX,minY,minZ),
> xmax=c(maxX,maxY,maxZ))
>
> #calculates territory volume at 95% isopleth
> Vol95<-contourSizes(fhata, cont=95)
>
>
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/Resampling-Help-Needed-tp4651973.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.