'How to do a proximity analysis in R with multiple individuals?

I have a large data set of GPS coordinates for both deer an cattle. My ultimate goal is to identify if deer and cattle are interacting. I have used prox() in the wildlifeDI package to report fixes that are within a specified time and distance between a pair of individuals. However, this package only works for 2 individuals and I need to do this with 30 deer and 10 cows. Any ideas on how to do this? I would eventually like a plot that shows distances between individuals at different time periods and across seasons.

Example with a pair of individuals below. Thanks

structure(list(Id = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L), .Label = c("A628", "A629", "A630", "A631", "A632", "A633", 
"A634", "A635", "A636", "A637", "A82117", "A82118", "A82119", 
"A82120", "A82121", "A82122", "A82123", "A82124", "A82125", "A82126", 
"A82127", "A82129", "A82130", "A82131", "A82132", "A82133", "A82134", 
"A82135", "A82136", "A82137", "A82139", "A82140", "A82141", "A82142", 
"A82143", "A82144", "A82145", "A82146", "B628", "B631", "B636", 
"B82118", "B82119", "B82121", "B82128", "B82129", "B82130", "B82131", 
"B82133", "B82135", "B82139"), class = "factor"), Species = structure(c(1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("cow", "deer"
), class = "factor"), DateTime = structure(c(1559367000, 1559368800, 
1559370600, 1559372400, 1559374200, 1559376000, 1559377800, 1559379600, 
1559381400, 1559383200), class = c("POSIXct", "POSIXt"), tzone = "CST6CDT"), 
    Longitude = c(-97.4696704, -97.4697802, -97.4726202, -97.4727169, 
    -97.4726265, -97.4727287, -97.472626, -97.4727101, -97.4727052, 
    -97.4726732), Latitude = c(26.5934121, 26.5933775, 26.5920012, 
    26.5921041, 26.5920486, 26.5920433, 26.5920564, 26.5920726, 
    26.5920519, 26.5920538)), row.names = c(NA, 10L), class = "data.frame")
deer1_traj <- as.ltraj(xy = cow[,c("Longitude","Latitude")], date = cow$DateTime,
                     id=cow$Id, typeII = TRUE)

cow1_traj <- as.ltraj(xy = cow[,c("Longitude","Latitude")], date = cow$DateTime,
                     id=cow$Id, typeII = TRUE)

Prox(deer1_traj,cow1_traj, tc=60*60, dc=50)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source