Pipe `%<>%` does not work when package `MuMIn` is loaded
iago-pssjd opened this issue · comments
This is a problem that involves another CRAN package, so I do not believe it is only a magrittr
issue, but I let you know this strange behaviour because it only happens with development magrittr
, not with the CRAN version.
The other package is MuMIn
. With it installed together with magrittr
the pipe %<>%
does not work (I tried in R 4.0.3
and 3.6.3
).
data(iris)
library(magrittr)
library(dplyr)
library(MuMIn)
iris %<>% dplyr::select(Species) %>% dplyr::distinct()
Species
1 setosa
2 versicolor
3 virginica
iris
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
...
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.7 LTS
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] MuMIn_1.43.17 dplyr_1.0.2
loaded via a namespace (and not attached):
[1] lattice_0.20-41 crayon_1.3.4 grid_4.0.3 R6_2.4.1 nlme_3.1-149
[6] lifecycle_0.2.0 stats4_4.0.3 magrittr_2.0.0 pillar_1.4.6 rlang_0.4.7
[11] rstudioapi_0.11 Matrix_1.2-18 vctrs_0.3.4 generics_0.0.2 ellipsis_0.3.1
[16] tools_4.0.3 glue_1.4.2 purrr_0.3.4 compiler_4.0.3 pkgconfig_2.0.3
[21] tidyselect_1.1.0 tibble_3.0.3
I can reproduce. This is very mysterious.
library(magrittr)
library(dplyr)
iris %<>% dplyr::select(Species) %>% dplyr::distinct()
str(iris)
#> 'data.frame': 3 obs. of 1 variable:
#> $ Species: Factor w/ 3 levels "setosa","versicolor",..: 1 2 3
rm(iris)
library(MuMIn)
iris %<>% dplyr::select(Species) %>% dplyr::distinct()
str(iris)
#> 'data.frame': 150 obs. of 5 variables:
#> $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
#> $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
#> $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
#> $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
#> $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
Thanks for reporting!