We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would appear that .else is not evaluated when passed to modify_if(). Unless I've missed something, I can only assume that this is a bug?
.else
modify_if()
library(magrittr) # with map_if, .else condition works as expected purrr::map_if(1:10, ~(. < 5), ~(. = 1L), .else = ~(. = 10L)) %>% purrr::as_vector() #> [1] 1 1 1 1 10 10 10 10 10 10 # with modify_if, .else condition does not appear to be evaluated purrr::modify_if(1:10, ~(. < 5), ~(. = 1L), .else = ~(. = 10L)) #> [1] 1 1 1 1 5 6 7 8 9 10 sessionInfo() #> R version 3.6.1 (2019-07-05) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Ubuntu 18.04.3 LTS #> #> Matrix products: default #> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1 #> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1 #> #> locale: #> [1] LC_CTYPE=en_ZA.UTF-8 LC_NUMERIC=C #> [3] LC_TIME=en_ZA.UTF-8 LC_COLLATE=en_ZA.UTF-8 #> [5] LC_MONETARY=en_ZA.UTF-8 LC_MESSAGES=en_ZA.UTF-8 #> [7] LC_PAPER=en_ZA.UTF-8 LC_NAME=C #> [9] LC_ADDRESS=C LC_TELEPHONE=C #> [11] LC_MEASUREMENT=en_ZA.UTF-8 LC_IDENTIFICATION=C #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] magrittr_1.5 #> #> loaded via a namespace (and not attached): #> [1] compiler_3.6.1 tools_3.6.1 htmltools_0.3.6 yaml_2.2.0 #> [5] Rcpp_1.0.2 stringi_1.4.3 rmarkdown_1.15 highr_0.8 #> [9] knitr_1.24 stringr_1.4.0 xfun_0.9 digest_0.6.20 #> [13] rlang_0.4.0 evaluate_0.14 purrr_0.3.2.9000
Created on 2019-08-29 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered:
oops I now see you've already sent a PR.
Sorry, something went wrong.
Use .else in atomic modification
aff6dc5
Fixes #701. Originally implemented by @mgrlich in #724.
Use .else in atomic modification (#916)
c544db0
Successfully merging a pull request may close this issue.
It would appear that
.else
is not evaluated when passed tomodify_if()
. Unless I've missed something, I can only assume that this is a bug?Created on 2019-08-29 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: