New issue
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
Error in split_chain for latest magrittr version #238
Comments
|
Could you please make a reprex with the reprex package, just to make sure there's nothing else going on in your session? And are you restarting your R session after installing magrittr? |
|
Having the same issue as @aaron-horowitz. I did restart R-Studio after installing the package, same issue. Until it is fixed, there are two workarounds for anyone encountering this now: devtools::install_version("magrittr", version = "1.5.0", repos = "http://cran.us.r-project.org")or, Manually assign `%>%` <- magrittr::`%>%\`session info
R version 4.0.2 (2020-06-22) Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): |
|
@alexeyza can you please use https://reprex.tidyverse.org to produce a reprex? Or at least include the code that is giving you the error? I would like to figure out the root cause of the issue before recommending fixes. |
|
While creating a reprex, I noticed that it is probably happening due to masking (by I'll need to figure out a way to maintain order of loading packages (when involving a multi-module Shiny app), and make sure I wonder if this is the same for @aaron-horowitz Here's the reprex: iris %>% group_by(Species) %>% mutate(avg = mean(Sepal.Length))
#> Error in iris %>% group_by(Species) %>% mutate(avg = mean(Sepal.Length)): could not find function "%>%"
library(tidyverse)
iris %>% group_by(Species) %>% mutate(avg = mean(Sepal.Length))
#> # A tibble: 150 x 6
#> # Groups: Species [3]
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species avg
#> <dbl> <dbl> <dbl> <dbl> <fct> <dbl>
#> 1 5.1 3.5 1.4 0.2 setosa 5.01
#> 2 4.9 3 1.4 0.2 setosa 5.01
#> 3 4.7 3.2 1.3 0.2 setosa 5.01
#> 4 4.6 3.1 1.5 0.2 setosa 5.01
#> 5 5 3.6 1.4 0.2 setosa 5.01
#> 6 5.4 3.9 1.7 0.4 setosa 5.01
#> 7 4.6 3.4 1.4 0.3 setosa 5.01
#> 8 5 3.4 1.5 0.2 setosa 5.01
#> 9 4.4 2.9 1.4 0.2 setosa 5.01
#> 10 4.9 3.1 1.5 0.1 setosa 5.01
#> # … with 140 more rows
library(qdap)
#> Loading required package: qdapDictionaries
#> Loading required package: qdapRegex
#>
#> Attaching package: 'qdapRegex'
#> The following object is masked from 'package:dplyr':
#>
#> explain
#> The following object is masked from 'package:ggplot2':
#>
#> %+%
#> Loading required package: qdapTools
#>
#> Attaching package: 'qdapTools'
#> The following object is masked from 'package:dplyr':
#>
#> id
#> Loading required package: RColorBrewer
#>
#> Attaching package: 'qdap'
#> The following object is masked from 'package:forcats':
#>
#> %>%
#> The following object is masked from 'package:stringr':
#>
#> %>%
#> The following object is masked from 'package:dplyr':
#>
#> %>%
#> The following object is masked from 'package:purrr':
#>
#> %>%
#> The following object is masked from 'package:tidyr':
#>
#> %>%
#> The following object is masked from 'package:tibble':
#>
#> %>%
#> The following objects are masked from 'package:base':
#>
#> Filter, proportions
iris %>% group_by(Species) %>% mutate(avg = mean(Sepal.Length))
#> Error in split_chain(match.call(), env = env): could not find function "split_chain"Created on 2020-12-13 by the reprex package (v0.3.0) |
|
You’ll notice that there are a bunch of warning about masking |
|
I see this as the way qdap uses the pipe. What is appropriate way to
re-export %>%?
https://github.com/trinker/qdap/blob/master/R/chaining.R
…On Sun, Dec 13, 2020 at 10:43 AM Hadley Wickham ***@***.***> wrote:
You’ll notice that there are a bunch of warning about masking %>% — the
root cause is probably that qdap copied in the source of %>% rather than
re-exporting it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#238 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2OABRE5LBFHT3KVEIPRIDSUUDO7ANCNFSM4UYXYCDA>
.
|
Yes re restarting R session after installing magrittr. I couldn't figure out how to make a reprex with the reprex package because I can only get the error to occur when I'm inside a package function (internal package, happy to share with you Hadley but it's not pretty enough to open source). I don't re-export the pipe in the package, I just use it internally. |
|
Hi everyone,
|
|
Here are some general resources that seem relevant to what went wrong here:
|
|
Thank you! I suspect other package others made the |
Hi folks,
I had originally thought this issue was specific to just me so I didn't file an issue report, but I see based on this twitter thread I am not alone.
The error appears to occur with the latest version of magrittr and an internal function
magrittr:::split_chain. If I force install v1.5 viadevtools::install_github('tidyverse/magrittr@v1.5')the issue is resolved.I'm struggling to come up with a reprex for this, but if I try to use a pipe on something as simple as below in the context of an existing function within a package (where the package accesses the pipe via
%>% = magrittr::%>%` in a utils.R file):While browsing within that function, the
%>%is clearly referencing the old version of the pipe:While outside of debug / the package itself, assigning
%>%= magrittr::%>%produces the new version version of the pipe correctly.Session info in details:
─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date lib source
assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.1)
backports 1.1.8 2020-06-17 [1] CRAN (R 3.6.1)
cli 2.2.0 2020-11-20 [1] CRAN (R 3.6.1)
clisymbols 1.2.0 2017-05-21 [1] CRAN (R 3.6.1)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.1)
digest 0.6.25 2020-02-23 [1] CRAN (R 3.6.1)
dplyr 1.0.2 2020-08-18 [1] CRAN (R 3.6.1)
ellipsis 0.3.1 2020-05-15 [1] CRAN (R 3.6.1)
evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.1)
fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.1)
fcuk * 0.1.3.1 2020-01-11 [1] Github (ThinkR-open/fcuk@49e4e27)
fs 1.5.0 2020-07-31 [1] CRAN (R 3.6.1)
generics 0.1.0 2020-10-31 [1] CRAN (R 3.6.1)
glue 1.4.1 2020-05-13 [1] CRAN (R 3.6.1)
htmltools 0.5.0 2020-06-16 [1] CRAN (R 3.6.1)
httr 1.4.2 2020-07-20 [1] CRAN (R 3.6.1)
jsonlite 1.7.0 2020-06-25 [1] CRAN (R 3.6.1)
knitr 1.29 2020-06-23 [1] CRAN (R 3.6.1)
lifecycle 0.2.0 2020-03-06 [1] CRAN (R 3.6.1)
magrittr 2.0.1 2020-11-17 [1] CRAN (R 3.6.1)
memuse 4.0-0 2017-11-10 [1] CRAN (R 3.6.1)
paletti 0.1.0 2019-09-20 [1] Github (EdwinTh/paletti@27e9a27)
pillar 1.4.6 2020-07-10 [1] CRAN (R 3.6.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 3.6.1)
prompt 1.0.0 2020-01-11 [1] Github (gaborcsardi/prompt@b332c42)
purrr 0.3.4 2020-04-17 [1] CRAN (R 3.6.1)
R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.1)
rlang 0.4.9 2020-11-26 [1] CRAN (R 3.6.1)
rmarkdown 2.3 2020-06-18 [1] CRAN (R 3.6.1)
rstudioapi 0.13 2020-11-12 [1] CRAN (R 3.6.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.1)
stringdist 0.9.5.5 2019-10-21 [1] CRAN (R 3.6.1)
stringi 1.4.6 2020-02-17 [1] CRAN (R 3.6.1)
stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.1)
styler 1.3.2 2020-02-23 [1] CRAN (R 3.6.1)
tibble 3.0.4 2020-10-12 [1] CRAN (R 3.6.1)
tidyselect 1.1.0 2020-05-11 [1] CRAN (R 3.6.1)
vctrs 0.3.2 2020-07-15 [1] CRAN (R 3.6.1)
whoami 1.3.0 2019-03-19 [1] CRAN (R 3.6.1)
withr 2.2.0 2020-04-20 [1] CRAN (R 3.6.1)
xfun 0.15 2020-06-21 [1] CRAN (R 3.6.1)
I'm hoping someone else who's having this issue can provide a cleaner reprex.
The text was updated successfully, but these errors were encountered: