humboldt.occ.rarefy | R Documentation |
Rarefy occurrence points
humboldt.occ.rarefy(
in.pts,
colxy = 2:3,
rarefy.dist = 0,
rarefy.units = "km",
run.silent.rar = F
)
in.pts |
input data frame |
colxy |
columns corresponding to longitude and latitude |
rarefy.dist |
distance to rarefy points (values need to be in km[recommended] or decimal degrees). See associated parameter rarefy.units. |
rarefy.units |
the units of rarefy.dist parameter, either "km" for kilometers or "dd" for decimal degrees |
run.silent.rar |
if run.silent=T, texts boxes displaying progress will not be displayed |
A script to systematically select localities within a specified area at specified spatial resolution. The outcome is always the same and is not random. This reduces sampling biases in downstream analyses- you should do it! Output is a reduced dataset with less spatial autocorrelation.
library(humboldt)
##load environmental variables for all sites of the study area 1 (env1). Column names should be x,y,X1,X2,...,Xn)
env1<-read.delim("env1.txt",h=T,sep="\t")
## load environmental variables for all sites of the study area 2 (env2). Column names should be x,y,X1,X2,...,Xn)
env2<-read.delim("env2.txt",h=T,sep="\t")
## remove NAs and make sure all variables are imported as numbers
env1<-humboldt.scrub.env(env1)
env2<-humboldt.scrub.env(env2)
##load occurrence sites for the species at study area 1 (env1). Column names should be 'sp', 'x','y'
occ.sp1<-na.exclude(read.delim("sp1.txt",h=T,sep="\t"))
##load occurrence sites for the species at study area 2 (env2). Column names should be 'sp', 'x','y'
occ.sp2<-na.exclude(read.delim("sp2.txt",h=T,sep="\t"))
##remove occurrences closer than a minimum distance to each other (remove aggregation). Setting min.dist=0 will remove no occurrence.
occ.sp1<-humboldt.occ.rarefy(in.pts=occ.sp1,colxy=2:3, rarefy.dist = 50, rarefy.units = "km")
occ.sp2<-humboldt.occ.rarefy(in.pts=occ.sp2,colxy=2:3, rarefy.dist = 50, rarefy.units = "km")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.