mablab / sftrack

sftrack: Modern classes for tracking and movement data
https://mablab.org/sftrack/
Other
53 stars 2 forks source link

"NAs not allowed in burst" error to build vignettes #22

Closed basille closed 4 years ago

basille commented 4 years ago

Installing with remotes with vignettes throws an error:

> remotes::install_github("mablab/sftrack", build_opts = c("--no-resave-data", "--no-manual"), build_vignettes = TRUE)
Downloading GitHub repo mablab/sftrack@master
✔  checking for file ‘/tmp/Rtmp2iVtLu/remotes17c4ebdc442/mablab-sftrack-6902309/DESCRIPTION’ ...
─  preparing ‘sftrack’:
✔  checking DESCRIPTION meta-information ...
─  installing the package to build vignettes
E  creating vignettes (4.2s)
   Loading required package: sp
   Loading required package: ade4
   Loading required package: adehabitatMA
   Loading required package: CircStats
   Loading required package: MASS
   Loading required package: boot
   Quitting from lines 112-122 (sftrack2_reading.Rmd) 
   Error: processing vignette 'sftrack2_reading.Rmd' failed with diagnostics:
   NAs not allowed in burst
   Execution halted
Error: Failed to install 'sftrack' from GitHub:
  System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> Loading required package: sp
E> Loading required package: ade4
E> Loading required package: adehabitatMA
E> Loading required package: CircStats
E> Loading required package: MASS
E> Loading required package: boot
E> Quitting from lines 112-122 (sftrack2_reading.Rmd) 
E> Error: processing vignette 'sftrack2_reading.Rmd' failed with diagnostics:
E> NAs not allowed in burst
E> Execution halted
>

Simple install without vignettes runs fine (remotes::install_github("mablab/sftrack")).

Session info:

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] ps_1.3.3          fansi_0.4.1       prettyunits_1.1.1 withr_2.2.0      
 [5] crayon_1.3.4      rprojroot_1.3-2   assertthat_0.2.1  R6_2.4.1         
 [9] backports_1.1.8   cli_2.0.2         curl_4.3          remotes_2.1.1    
[13] callr_3.4.3       tools_3.3.3       glue_1.4.1        processx_3.4.3   
[17] pkgbuild_1.1.0   
birderboone commented 4 years ago

After our previous discussions on this and looking into it further as I cant reproduce it. I couldn't really prove anything without me reinstalling R as 3.3.3 on my system. I definitely agree its likely some change around 3.4 as no other users above that seem to be having an issue.

The code 'snags' during check_NA_burst, but only when constructing a burst from an ltraj. The problem comes down to that your R believes it can't convert our character vector to a factor without it becoming malformed, which it does automatically when unlisting the burst list at that stage. However, your R never snagged check_NA_burst while building an as_sftrack.data.frame. And theres nothing overly amiss in the code. I suspect theres just some attribute thats getting held over in the character vector from R <3.4 that wont allow it to auto convert. But I can't prove what it is.

I remade the check_NA_burst to contain a vapply (instead of unlist) which should bypass the requirement to convert anything to a factor. Let me know if this hotfix worked. This is an equally if not more efficient operation than the unlist anyway.

We'll keep this in mind and let me know if it ever snags again on 3.3.3.

basille commented 4 years ago

Thanks for tracking it down! I remember now it has something to do with factors, and how they changed around 3.4…

The fix did the work: I could install the master branch with vignettes (with the code above), and all 5 vignettes now show properly. Thanks!