Alastair,

This probably is not what you are looking for, but if I were you, I would make a grid of points and then use a function to find species occurrence records within sequentially larger radii (or grid cells, if that is what you are after). Below are a few functions that I have utilized on a similar problem.

-Jes


# A function that finds all records within a given distance buffer from a point
find_recs = function(point, recs, buff){
dists = spDistsN1(recs, point, longlat=T) # In km
userecs = recs[dists<buff,]

return(userecs)
}

# A function that returns a species list from a vector of species names
# It removes genus spp. that are already represented by a species
get_species = function(x){
splitnames = strsplit(x, " ")
justgenus = unique(x[as.numeric(lapply(splitnames, length))==1])
allspecies = splitnames[as.numeric(lapply(splitnames, length))>1]
allspecies = unique(sapply(allspecies, function(s) paste(s[1],s[2])))
spgenera = unique(sapply(strsplit(allspecies, " "), function(y) y[1]))
keepgenera = justgenus[!(justgenus %in% spgenera)]

c(allspecies,keepgenera)
}

# A function that calculates average species richness of a sample of records
calc_rich_samp = function(recs, nsamp, reps){
mysamples = sapply(1:reps, function(x){
species_list = get_species(recs[sample(1:nrow(recs), nsamp, replace=F),]$scientificName)
length(species_list)
})

median(mysamples)
}


Jes Coyle

PhD Student, Royster Fellow
Wilson Hall 328, Dept. of Biology
University of North Carolina, Chapel Hill
jrcoyle@live.unc.edu
office: (919) 962-8795
cell: (541) 990-5986
http://jcoyle.web.unc.edu

	[[alternative HTML version deleted]]

