Skip to content
Prev 4907 / 7420 Next

loss of infolocs data when using redisltraj

Dear Liz,

I guess the problem is both technical (the dimensions of the data frames, 
as you pointed out) and biological (how does information associated to 
given steps make sense after interpolation?). You're suggesting to put in 
NAs for the newly interpolated points, which is probably a safe approach if 
the data is considered at the location level, and not at the step level.

Anyway, one issue with 'redisltraj' is that it is written in C, which makes 
editing not very easy... One way to achieve what you want, I think (not 
tested, you'll have to try it by yourself), would be to:

1) Put missing locations back in the trajectory using setNA:

tr1 <- setNA(tr1, tr1[[1]][1, "date"], 60, units = "sec")

This way, you will have the correct dimensions for the main df and the 
infolocs for each ltraj element, but NAs for the coordinates of the missing 
locs.

2) Storing the infolocs somewhere:

info <- infolocs(tr1)

3) Removing the missing locations (!) with na.omit, and interpolate the 
trajectory, as you did before:

tr1.interp <- redisltraj(na.omit(tr1), 60, type = "time"))

4) Now you should be able to transfer the infolocs:

infolocs(tr1.interp) <- info

Let me know if that works!
Mathieu.


Le 10/02/2015 11:52, Elizabeth Morgan a ?crit :