eth-mds / ricu

🏥 ICU data with R 🏥
https://eth-mds.github.io/ricu/
GNU General Public License v3.0
37 stars 10 forks source link

namespace conflict with units package #9

Closed prockenschaub closed 2 years ago

prockenschaub commented 2 years ago

First of, this package is amazing! This is exactly what I have been looking for and this will save me some major headaches down the line. Thank you for doing all the hard work for me and creating this package.

Unfortunately, while exploring the package I've run into a (apparent) conflict when using the units package with ricu.

Problem

After installing units=0.8-8 and restarting the R session, loading ricu fails with the following error message:

library(ricu)
#> Error: package or namespace load failed for 'ricu':
#>  .onLoad failed in loadNamespace() for 'ricu', details:
#>   call: ud_map_symbols(symbol, ut_unit)
#>   error: Unit already maps to "h"

This problem does not occur if I install units while ricu is already loaded. All bits that I've tried so far (mainly the examples in the JSS paper) work in that case --- until I restart the R session, after which the above error occurs again.

Session info

sessionInfo()
#> R version 4.1.2 (2021-11-01)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 22000)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United Kingdom.1252 
#> [2] LC_CTYPE=English_United Kingdom.1252   
#> [3] LC_MONETARY=English_United Kingdom.1252
#> [4] LC_NUMERIC=C                           
#> [5] LC_TIME=English_United Kingdom.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.28   withr_2.4.2     magrittr_2.0.1  reprex_2.0.1   
#>  [5] evaluate_0.14   highr_0.9       stringi_1.7.5   rlang_0.4.12   
#>  [9] cli_3.1.0       rstudioapi_0.13 fs_1.5.0        rmarkdown_2.11 
#> [13] tools_4.1.2     stringr_1.4.0   glue_1.5.0      xfun_0.28      
#> [17] yaml_2.2.1      fastmap_1.1.0   compiler_4.1.2  htmltools_0.5.2
#> [21] knitr_1.36
prockenschaub commented 2 years ago

Some more probing identified the following line as the offender:

https://github.com/eth-mds/ricu/blob/87780560df0da04d4b80496a7190fe0a7f9451a4/R/setup-attach.R#L149

prockenschaub commented 2 years ago

Seems to be a recent issue with units package on Windows r-quantities/units#301. Downgrading to units=0.7-2 fixes the issue.

prockenschaub commented 2 years ago

After reinstalling ricu recently, I realised that this issue seems to have resolved itself (or was resolved by a recent commit). Closing this for now.