ctmm-initiative / ctmm

Continuous-Time Movement Modeling. Functions for identifying, fitting, and applying continuous-space, continuous-time stochastic movement models to animal tracking data.
http://biology.umd.edu/movement.html
47 stars 10 forks source link

try to fix the node stack error #6

Closed xhdong-umd closed 7 years ago

xhdong-umd commented 7 years ago

problem

issue #5 , error in example of variogram.fit.html

#Load package and data
library(ctmm)
data(buffalo)

#Extract movement data for a single animal
cilla <- buffalo[[1]]

#Calculate variogram
SVF <- variogram(cilla)
#> Error in `[.data.frame`(x, ...): node stack overflow

# generate a visual fit of the variogram (requires RStudio)
variogram.fit(SVF)
#> Error in variogram.fit(SVF): object 'SVF' not found

error cause

line 24

I'm not quite sure how the original code works. I guess the purpose is to get the data frame part of data, then pick columns x, y. My code have same result in simple test, verified by identical(z, temp).

I don't know why the original code failed sometime but works in many time, and if my code will have same result in all cases. Just this fixed the error without need of restart R session. And in building references there are lots of examples running, it will be impossible to restart R session before every example.

xhdong-umd commented 7 years ago

After the problem is fixed, the package site need to be regenerated. We could only update the reference part with pkgdown::build_reference(lazy = FALSE)

chfleming commented 7 years ago

Your code is what is intended---to pull out some columns of the data.frame and cast them as a matrix. I will merge your code and fix the other cases where I call "[.data.frame" on a telemetry object... which I thought should be kosher as telemetry is just a data.frame with an extra attr slot.

xhdong-umd commented 7 years ago

This is the only real information I can find about node stack overflow error. I still not quite understand it, seemed to be related to recursion?

this is a general problem with any function that does dispatch on ...