#Core area designation technique from Vander Wal and Rodgers (2012) #This current version only treats one animal at a time and requries a dataframe with at least three columns: #my.data$X (must be a capital "X") for the X coordinate #my.data$Y (must be a capital "Y") for the Y coordinate #This function relies on kernel.area (from adehabitatHR); currently it uses the kernel.area defaults, though the function can be modified to accomodate other parameters #Similarly this function relies on nls() to fit the curve which may require different starting parameters depending on your data #Cut and past the following 11 lines of code: library(adehabitatHR) core.area<-function(data){ IVseq<-seq(0.01,0.99,0.01)#sequence of isopleth volumes kernel.areas<-as.numeric(as.character(kernel.area(kernelUD(SpatialPoints(data[,c("X","Y")])),percent=c(1:99))))#areas within the isopleths, modify kernel parameters here including coordinate systems df<-as.data.frame(cbind(IVseq,kernel.areas/max(kernel.areas)))#create a dataframe with the percent area (PA) and isopleth volume (IV) scaled from 0-1 colnames(df)<-c("IV","PA")#name the columns nls.fit<-nls(PA~(b0)*(exp(b1*IV)), data=df, start=list(b0=0.01, b1=4.2), na.action="na.omit", model=TRUE)#Caution: Starting parameters may differ for your data. b0<-summary(nls.fit)$coefficients[1,1]#b0 coefficient b1<-summary(nls.fit)$coefficients[2,1]#b0 coefficient (-log(b0*b1)/b1)#isopleth volume where the curve's slope = 1 } #Then with your dataframe loaded into R and configured, #you should be able to substitute its name for "my.data" in the following line of code and recieve the core area calculation core.area(my.data) #Example using adehabitatHR data: # Load the data data(puechabonsp)#load example data loc<-as.data.frame(puechabonsp$relocs)#convert example data into a dataframe loc<-loc[loc$Name=="Brock",]#select one animal from the dataframe #Run core.area core.area(loc) #if you have any questions please don't hesitate to contact me: eric.vanderwal@usask.ca #Literature cited # Calenge, C. (2006) The package adehabitat for the R software: a tool for the analysis of space and habitat use by animals. Ecological Modelling, 197, 516-519 # Vander Wal and Rodgers (2012) An individual-based quantitative approach for delineating core areas of animal space use. Ecological Modelling, 224, 48-53