Ye_Zaw
September 9, 2021, 6:15pm
1
Received "Error in split_chain(match.call(), env = env) :
could not find function "split_chain" message.
As per online community suggestion, split_chain error is gone after downgrading to magrittr 1.5 from version 2.0.1.
Though split_chain error is fixed, the other packages are not working with version magrittr 1.5 and prompted error message to upgrade to 2.0.1. Any one facing same issue? happened in both R ver 3.6.1 and 4.1.0
Have you tried installing the latest {magrittr} and then loading {tidyverse} after all other packages? I know very little about the cause of the error, but some quick Googling turned up this temporary solution. For a permanent solution you need to figure out which other package is at fault and get the author to fix it.
opened 10:43PM - 12 Dec 20 UTC
closed 08:01AM - 26 Jan 22 UTC
Hi folks,
I had originally thought this issue was specific to just me so I di… dn'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 via `devtools::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):
```r
c("a","b","c") %>% purrr::map(print)
Error in split_chain(match.call(), env = env) :
could not find function "split_chain"
```
While browsing within that function, the `%>%` is clearly referencing the old version of the pipe:
```r
function (lhs, rhs)
{
parent <- parent.frame()
env <- new.env(parent = parent)
chain_parts <- split_chain(match.call(), env = env)
pipes <- chain_parts[["pipes"]]
rhss <- chain_parts[["rhss"]]
lhs <- chain_parts[["lhs"]]
env[["_function_list"]] <- lapply(1:length(rhss), function(i) wrap_function(rhss[[i]],
pipes[[i]], parent))
env[["_fseq"]] <- `class<-`(eval(quote(function(value) freduce(value,
`_function_list`)), env, env), c("fseq", "function"))
env[["freduce"]] <- freduce
if (is_placeholder(lhs)) {
env[["_fseq"]]
}
else {
env[["_lhs"]] <- eval(lhs, parent, parent)
result <- withVisible(eval(quote(`_fseq`(`_lhs`)), env,
env))
if (is_compound_pipe(pipes[[1L]])) {
eval(call("<-", lhs, result[["value"]]), parent,
parent)
}
else {
if (result[["visible"]])
result[["value"]]
else invisible(result[["value"]])
}
}
}
<bytecode: 0x562bfab03748>
<environment: 0x562bfab045f0>
```
While outside of debug / the package itself, assigning `%>%` = magrittr::`%>%` produces the new version version of the pipe correctly.
Session info in details:
<details>
─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 3.6.1 (2019-07-05)
os Ubuntu 18.04.5 LTS
system x86_64, linux-gnu
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/New_York
date 2020-12-12
─ 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)
</details>
I'm hoping someone else who's having this issue can provide a cleaner reprex.
Ye_Zaw
September 11, 2021, 6:59am
3
Uninstalled R, R studio and tried with latest versions, no luck with the same Win 10 PC.
It works on fresh install on another Win 10 machine.
Thanks.. I came through the link you shared too.
Starting in a fresh R session, what packages are you loading (in order) when %>% results in the "split_chain" error?
Ye_Zaw
September 12, 2021, 7:54am
5
Uninstalled R 3.6.3, 4.1.0 and 4.1.1, also R Studio (rstudio may not necessarily)
Rename the folders all relate to 'R' .. working directory and program installation folder (here in Windows C:\Program files)
Reinstall 4.1.1, install the tidyverse and dependencies package itself, fixed the errors. No more "split_chain" error.
Assuming somewhere conflicts the packages during R version upgrades. (don't know exactly where .. )
system
Closed
October 3, 2021, 7:54am
6
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.