dbspitz / migrateR

Shared tools for analyzing animal movement behavior in R
6 stars 0 forks source link

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘burst’ for signature ‘"ltraj", "missing"’ when making mvmt #17

Closed eldritchmayo closed 1 year ago

eldritchmayo commented 1 year ago

I have a dataset of three animals which I have split into a list of ltraj objects (Base).

set.coordinates <- function(x){coordinates(x) <- c("Long","Lat"); x}
set.proj4string <- function(x){proj4string(x) <- CRS("+proj=longlat +datum=WGS84"); x}
Base_ind <- lapply(Base_ind, set.coordinates)
Base_ind <- lapply(Base_ind, set.proj4string)

make.ltraj <- function(q){as.ltraj(xy=coordinates(q), date=q$TelemDate, id=q$AID,
                                   burst = q$AID, infolocs = q[4])} 

#infolocs elev argument is in different format because if I used q$elev I would get "Error in if (nrow(infolocs) != nrow(xy)) 
#stop("infolocs should have the same number of rows as xy") :
#argument is of length zero"

Base_ind_tr <- lapply(Base_ind, make.ltraj)

make.nsd <- function(x){mvmtClass(x)}

Base.nsd <- lapply(Base_ind_tr, make.nsd) 

After the last command I get the error in the title.

burst exists as a attribute of the ltraj objects.

I have also gotten the error for individual animals and for all of them in a single data frame.

eldritchmayo commented 1 year ago

I solved it by reinstalling adehabitatLT

eldritchmayo commented 1 year ago

Additional info, migrateR seems to have some conflict with some other packages. It works fine if I library just it.