Hi, Juergen,
Happy new yaer!
I have problem with this script, I'm using same data same script but not getting same result. Can you help me with this?
this is the script:
library(camtrapR)
data(recordTableSample)
ClocktimeToTimeRad <- function(Clocktime,
timeformat = "%Y-%m-%d %H:%M:%S"){
DateTime2 <- strptime(as.character(Clocktime), format = timeformat, tz = "UTC")
Time2 <- format(DateTime2, format = "%H:%M:%S", usetz = FALSE)
Time.rad <- (as.numeric(as.POSIXct(strptime(Time2, format = "%H:%M:%S", tz = "UTC"))) -
as.numeric(as.POSIXct(strptime("0", format = "%S", tz = "UTC")))) / 3600 * (pi/12)
return(Time.rad)
}
recordTableSample$TimeRad <- ClocktimeToTimeRad(recordTableSample$DateTimeOriginal)
library(overlap)
list_records_radial_time <- activityDensity(recordTable = recordTableSample,
allSpecies = TRUE,
writePNG = FALSE,
plotR = F)
str(list_records_radial_time) ##I have problem here, it only able to detect one species while the other 4 listed as NA.
names(list_records_radial_time)
densities <- lapply(list_records_radial_time, densityPlot)
plot(densities[[1]], type = "l", lwd = 3, ylim = c(0, max(sapply(densities, FUN = function(df){df$y})))) # plot densities of first species in list
lines(densities[[2]], col = "black", lty = 3, lwd = 3)
lines(densities[[3]], col = "black", lty = 5, lwd = 3)
Thanks for your attention ^^