Hi Chris,
I am working on coding a loop to estimate pairwise home range overlaps, CDEs, and pairwise and simulated distance functions. The function and code is running and produces the output plot but I'm receiving an error and warning that I was wondering if you may be able to shed some light on.
The code is here where wild_1 is the telemetry object list:
overlap_fun = function(x, y) {
dir <- paste(out.dir,"/AKDE_Group1/Overlap/", sep="")
outfile = paste(dir, "Overlap_A0", x, "_A0", y, ".png", sep = "")
png(file=outfile, width = 1000, height = 500, res=72)
par(mfrow=c(1,1))
ctmm::plot(wild_1[c(x, y)],
UD=B.AKDE[c(x, y)],
col = c("#e76f51", "#264653"),
col.DF=c("#f4a261", "#2a9d8f"),
col.grid = NA,
main = paste("Overlap A0", x, " - A0", y, sep = ""))
dev.off()
}
# Run function for group 1
for(i in 1:(length(wild_1))) {
for (j in (i + 1):length(wild_1)){
if (i < j){
overlap_fun(x = i, y = j)
}
}
}
The error and warnings I receive are:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘extent’ for signature ‘"NULL"’
In addition: There were 50 or more warnings (use warnings() to see the first 50)
Warning messages:
1: In plot.window(...) : "col.DF" is not a graphical parameter
2: In plot.xy(xy, type, ...) : "col.DF" is not a graphical parameter
3: In axis(side = side, at = at, labels = labels, ...) :
"col.DF" is not a graphical parameter...
An additional error I am getting later in the code is regarding the timezone after using the distances() function. When I run the following code:
DISTS <- distances(wild_1[c("A05", "A07")],
B.FITS[c("A05", "A07")])
I receive this error:
Error in as.POSIXlt.POSIXct(x, tz) : invalid 'tz' value
I can plot the distance estimate by time but I can't view the elements of the DISTS object and I'm unsure if the time axis is reliable on the plots.
Thank you so much for your thoughts on this!
Best,
Meredith