luisDVA / annotater

Annotate Package Load Calls
https://annotater.liomys.mx/
Other
99 stars 2 forks source link

Error when trying to use the addins (Error: `false` must be a character vector, not a logical vector) #4

Closed kzkedzierska closed 4 years ago

kzkedzierska commented 4 years ago

Hiya!

I saw your package on Twitter and it looks amazing! Unfortunately, it does not work for me... I attach the error message and sessionInfo() details below. Let me know if there is anything else that might be useful.

Error: `false` must be a character vector, not a logical vector
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_error()
<error/rlang_error>
`false` must be a character vector, not a logical vector
Backtrace:
  1. (function () ...
  7. dplyr::if_else(n == 1, "none", repo)
  8. dplyr:::replace_with(...)
  9. dplyr:::check_type(val, x, name)
 10. dplyr:::glubort(header, "must be {friendly_type_of(template)}, not {friendly_type_of(x)}")
Run `rlang::last_trace()` to see the full context.
> rlang::last_trace()
<error/rlang_error>
`false` must be a character vector, not a logical vector
Backtrace:
     █
  1. ├─(function () ...
  2. │ └─annotater::annotate_repo_source(contents_parsed)
  3. │   ├─stats::na.omit(...)
  4. │   ├─dplyr::mutate(...)
  5. │   └─dplyr:::mutate.tbl_df(...)
  6. │     └─dplyr:::mutate_impl(.data, dots, caller_env())
  7. └─dplyr::if_else(n == 1, "none", repo)
  8.   └─dplyr:::replace_with(...)
  9.     └─dplyr:::check_type(val, x, name)
 10.       └─dplyr:::glubort(header, "must be {friendly_type_of(template)}, not {friendly_type_of(x)}")
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
 [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3       tidyr_1.0.2      crayon_1.3.4     dplyr_0.8.4      assertthat_0.2.1
 [6] R6_2.4.1         lifecycle_0.1.0  magrittr_1.5     pillar_1.4.3     rlang_0.4.4     
[11] stringi_1.4.6    rstudioapi_0.11  vctrs_0.2.3      tools_3.6.1      stringr_1.4.0   
[16] glue_1.3.1       purrr_0.3.3      annotater_0.1.1  compiler_3.6.1   pkgconfig_2.0.3 
[21] tidyselect_1.0.0 tibble_2.1.3    
kzkedzierska commented 4 years ago

I just saw this example

library(annotater)
test_string <-c("library(boot)\nrequire(Matrix)")
writeLines(annotate_pckg_calls(test_string))

and that fixed it... :D The false Error was still there, but then another restart made it work. (I did restart RStudio after installing the package, so it wasn't the restart that fixed it I think). Nothing else left here to do I suppose.

luisDVA commented 4 years ago

thanks for the feedback. I tried and couldn't reproduce the error but I'll keep an eye out for any weird behaviors.

luisDVA commented 4 years ago

Hi again, I found the problem. That error comes up when you call the functions using the addins panel when your focus (blinking cursor) is on the console pane rather than on your script. I'll mention this in the documentation and work on writing a more useful warning.

luisDVA commented 4 years ago

closed in https://github.com/luisDVA/annotater/commit/dc2ef1858af9e06064ec0eaecfd45f93fac4c14a