Brief description of the problem
I have an R script that is sourcing a custom function. The custom function contains a loop that manipulates a data frame and returns the manipulated version of the data frame. I am using the slice()
function to select particular rows of the data frame e.g.
test_alpha_1 <- as.data.frame(TCR_chains) %>%
slice(row_inner) %>%
select(TRAV, TRAJ, TRAC, CDR3alpha, CDR3alpha_nt) %>%
as.character()
row_inner
is a numeric
My code works completely fine when I run it locally on my computer and also when I run it on the head node of the server, but when I run it in a pipeline, I get the following error. However this error only occurs for 9/12 of my samples:
Error: `env` must be an environment
Backtrace:
█
1. ├─rmarkdown::render(...)
2. │ └─knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
3. │ └─knitr:::process_file(text, output)
4. │ ├─base::withCallingHandlers(...)
5. │ ├─knitr:::process_group(group)
6. │ └─knitr:::process_group.block(group)
7. │ └─knitr:::call_block(x)
8. │ └─knitr:::block_exec(params)
9. │ └─knitr:::eng_r(options)
10. │ ├─knitr:::in_dir(...)
11. │ └─knitr:::evaluate(...)
12. │ └─evaluate::evaluate(...)
13. │ └─evaluate:::evaluate_call(...)
14. │ ├─evaluate:::timing_fn(...)
15. │ ├─base:::handle(...)
16. │ ├─base::withCallingHandlers(...)
17. │ ├─base::withVisible(eval(expr, envir, enclos))
18. │ └─base::eval(expr, envir, enclos)
19. │ └─base::eval(expr, envir, enclos)
20. ├─global::alpha_beta_nt_clonotypes(TCR_chains)
21. │ └─`%>%`(...)
22. ├─dplyr::select(., TRAV_2, TRAJ_2, TRAC_2, CDR3alpha_2, CDR3alpha_nt_2)
23. ├─dplyr::slice(., row_inner)
24. └─dplyr:::slice.data.frame(., row_inner)
25. └─dplyr:::slice_rows(.data, ...)
26. └─rlang::enquos(...)
27. └─rlang:::endots(...)
28. └─rlang:::map(...)
29. └─base::lapply(.x, .f, ...)
30. └─rlang:::FUN(X[[i]], ...)
31. └─rlang::splice(...)
Execution halted
Looking at the code for the slice()
function, I have noticed this piece of code within slice_rows()
:
mask <- DataMask$new(.data, caller_env())
I am wondering whether the error may be something to do with the caller_env()
part. I am happy to share my scripts privately if it helps.
Many thanks,
Lucy
Conda environment:
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 1_gnu conda-forge
_r-mutex 1.0.1 anacondar_1 conda-forge
aiohttp 3.7.4.post0 py39h3811e60_0 conda-forge
apsw 3.34.0.r1 py39hf3435bc_0 conda-forge
async-timeout 3.0.1 py_1000 conda-forge
attrs 21.2.0 pyhd8ed1ab_0 conda-forge
bcrypt 3.2.0 py39h3811e60_1 conda-forge
binutils_impl_linux-64 2.35.1 h193b22a_2 conda-forge
binutils_linux-64 2.35 h67ddf6f_30 conda-forge
blas 1.1 openblas conda-forge
boto3 1.17.103 pyhd8ed1ab_0 conda-forge
botocore 1.20.103 pyhd8ed1ab_0 conda-forge
brotlipy 0.7.0 py39h3811e60_1001 conda-forge
bwidget 1.9.14 0 conda-forge
bzip2 1.0.8 h7f98852_4 conda-forge
c-ares 1.17.1 h7f98852_1 conda-forge
ca-certificates 2021.5.30 ha878542_0 conda-forge
cachetools 4.2.2 pyhd8ed1ab_0 conda-forge
cairo 1.16.0 h6cf1ce9_1008 conda-forge
certifi 2021.5.30 py39hf3d152e_0 conda-forge
cffi 1.14.5 py39he32792d_0 conda-forge
cgatcore 0.6.7 py_0 bioconda
chardet 4.0.0 py39hf3d152e_1 conda-forge
coreutils 8.32 h7b6447c_0
cryptography 3.4.7 py39hbca0aa6_0 conda-forge
curl 7.77.0 hea6ffbf_0 conda-forge
drmaa 0.7.9 py_1000 conda-forge
font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge
font-ttf-inconsolata 3.000 h77eed37_0 conda-forge
font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge
font-ttf-ubuntu 0.83 hab24e00_0 conda-forge
fontconfig 2.13.1 hba837de_1005 conda-forge
fonts-conda-ecosystem 1 0 conda-forge
fonts-conda-forge 1 0 conda-forge
freetype 2.10.4 h0708190_1 conda-forge
fribidi 1.0.10 h516909a_0 conda-forge
ftputil 5.0.1 pyhd8ed1ab_0 conda-forge
gcc_impl_linux-64 9.3.0 h70c0ae5_19 conda-forge
gcc_linux-64 9.3.0 hf25ea35_30 conda-forge
gettext 0.21.0 hf68c758_0
gevent 21.1.2 py39h3811e60_0 conda-forge
gfortran_impl_linux-64 9.3.0 hc4a2995_19 conda-forge
gfortran_linux-64 9.3.0 hdc58fab_30 conda-forge
google-api-core 1.30.0 pyhd8ed1ab_0 conda-forge
google-auth 1.32.0 pyh6c4a22f_0 conda-forge
google-cloud-core 1.7.1 pyh6c4a22f_0 conda-forge
google-cloud-sdk 347.0.0 py39hf3d152e_0 conda-forge
google-cloud-storage 1.39.0 pyhd3eb1b0_0
google-crc32c 1.1.2 py39hb81f231_0 conda-forge
google-resumable-media 1.3.1 pyh6c4a22f_0 conda-forge
googleapis-common-protos 1.53.0 py39hf3d152e_0 conda-forge
graphite2 1.3.14 h23475e2_0
greenlet 1.1.0 py39he80948d_0 conda-forge
grpcio 1.38.1 py39hff7568b_0 conda-forge
gsl 2.6 he838d99_2 conda-forge
gxx_impl_linux-64 9.3.0 hd87eabc_19 conda-forge
gxx_linux-64 9.3.0 h3fbe746_30 conda-forge
harfbuzz 2.8.1 h83ec7ef_0 conda-forge
icu 68.1 h58526e2_0 conda-forge
idna 2.10 pyh9f0ad1d_0 conda-forge
jbig 2.1 h7f98852_2003 conda-forge
jmespath 0.10.0 pyh9f0ad1d_0 conda-forge
jpeg 9d h516909a_0 conda-forge
kernel-headers_linux-64 2.6.32 h77966d4_13 conda-forge
krb5 1.19.1 hcc1bbae_0 conda-forge
ld_impl_linux-64 2.35.1 hea4e1c9_2 conda-forge
lerc 2.2.1 h9c3ff4c_0 conda-forge
libblas 3.9.0 9_openblas conda-forge
libcblas 3.9.0 9_openblas conda-forge
libcrc32c 1.1.1 he1b5a44_2 conda-forge
libcurl 7.77.0 h2574ce0_0 conda-forge
libdeflate 1.7 h7f98852_5 conda-forge
libedit 3.1.20210216 h27cfd23_1
libev 4.33 h516909a_1 conda-forge
libffi 3.3 h58526e2_2 conda-forge
libgcc-devel_linux-64 9.3.0 h7864c58_19 conda-forge
libgcc-ng 9.3.0 h2828fa1_19 conda-forge
libgfortran-ng 9.3.0 hff62375_19 conda-forge
libgfortran5 9.3.0 hff62375_19 conda-forge
libglib 2.68.3 h3e27bee_0 conda-forge
libgomp 9.3.0 h2828fa1_19 conda-forge
libiconv 1.16 h516909a_0 conda-forge
liblapack 3.9.0 9_openblas conda-forge
libnghttp2 1.43.0 h812cca2_0 conda-forge
libopenblas 0.3.15 pthreads_h8fe5266_1 conda-forge
libpng 1.6.37 hed695b0_2 conda-forge
libprotobuf 3.17.2 h780b84a_0 conda-forge
libsodium 1.0.18 h516909a_1 conda-forge
libssh2 1.9.0 ha56f1ee_6 conda-forge
libstdcxx-devel_linux-64 9.3.0 hb016644_19 conda-forge
libstdcxx-ng 9.3.0 h6de172a_19 conda-forge
libtiff 4.3.0 hf544144_1 conda-forge
libuuid 2.32.1 h14c3975_1000 conda-forge
libuv 1.41.0 h7f98852_0 conda-forge
libwebp-base 1.2.0 h7f98852_2 conda-forge
libxcb 1.14 h7b6447c_0
libxml2 2.9.12 h72842e0_0 conda-forge
lz4-c 1.9.3 h9c3ff4c_0 conda-forge
make 4.3 hd18ef5c_1 conda-forge
multidict 5.1.0 py39h3811e60_1 conda-forge
ncurses 6.2 h58526e2_4 conda-forge
nomkl 3.0 0
numpy 1.21.0 py39hdbf815f_0 conda-forge
openblas 0.3.15 pthreads_h4748800_1 conda-forge
openssl 1.1.1k h7f98852_0 conda-forge
packaging 20.9 pyh44b312d_0 conda-forge
pandas 1.2.5 py39hde0f152_0 conda-forge
pandoc 2.14.0.3 h7f98852_0 conda-forge
pango 1.48.6 hb8ff022_0 conda-forge
paramiko 2.7.2 pyh9f0ad1d_0 conda-forge
pcre 8.45 h9c3ff4c_0 conda-forge
pcre2 10.36 h032f7d1_1 conda-forge
pip 21.1.3 pyhd8ed1ab_0 conda-forge
pixman 0.40.0 h36c2ea0_0 conda-forge
protobuf 3.17.2 py39he80948d_0 conda-forge
pyasn1 0.4.8 py_0 conda-forge
pyasn1-modules 0.2.8 py_0
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pynacl 1.4.0 py39h3811e60_2 conda-forge
pyopenssl 20.0.1 pyhd8ed1ab_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pysftp 0.2.9 py_1 conda-forge
pysocks 1.7.1 py39hf3d152e_3 conda-forge
python 3.9.5 h49503c6_0_cpython conda-forge
python-dateutil 2.8.1 py_0 conda-forge
python_abi 3.9 2_cp39 conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyu2f 0.1.5 pyhd8ed1ab_0 conda-forge
pyyaml 5.4.1 py39h3811e60_0 conda-forge
r-askpass 1.1 r41hcfec24a_2 conda-forge
r-assertthat 0.2.1 r41hc72bb7e_2 conda-forge
r-backports 1.2.1 r41hcfec24a_0 conda-forge
r-base 4.1.0 h9e01966_1 conda-forge
r-base64enc 0.1_3 r41hcfec24a_1004 conda-forge
r-blob 1.2.1 r41hc72bb7e_1 conda-forge
r-brio 1.1.2 r41hcfec24a_0 conda-forge
r-broom 0.7.8 r41hc72bb7e_0 conda-forge
r-callr 3.7.0 r41hc72bb7e_0 conda-forge
r-cellranger 1.1.0 r41hc72bb7e_1003 conda-forge
r-cli 3.0.0 r41hc72bb7e_0 conda-forge
r-clipr 0.7.1 r41hc72bb7e_0 conda-forge
r-colorspace 2.0_2 r41hcfec24a_0 conda-forge
r-cpp11 0.3.1 r41hc72bb7e_0 conda-forge
r-crayon 1.4.1 r41hc72bb7e_0 conda-forge
r-curl 4.3.2 r41hcfec24a_0 conda-forge
r-data.table 1.14.0 r41hcfec24a_0 conda-forge
r-dbi 1.1.1 r41hc72bb7e_0 conda-forge
r-dbplyr 2.1.1 r41hc72bb7e_0 conda-forge
r-desc 1.3.0 r41hc72bb7e_0 conda-forge
r-diffobj 0.3.4 r41hcfec24a_0 conda-forge
r-digest 0.6.27 r41h03ef668_0 conda-forge
r-dplyr 1.0.7 r41h03ef668_0 conda-forge
r-dtplyr 1.1.0 r41hc72bb7e_0 conda-forge
r-ellipsis 0.3.2 r41hcfec24a_0 conda-forge
r-evaluate 0.14 r41hc72bb7e_2 conda-forge
r-fansi 0.4.2 r41hcfec24a_0 conda-forge
r-farver 2.1.0 r41h03ef668_0 conda-forge
r-forcats 0.5.1 r41hc72bb7e_0 conda-forge
r-fs 1.5.0 r41h03ef668_0 conda-forge
r-gargle 1.1.0 r41hc72bb7e_0 conda-forge
r-generics 0.1.0 r41hc72bb7e_0 conda-forge
r-ggplot2 3.3.5 r41hc72bb7e_0 conda-forge
r-glue 1.4.2 r41hcfec24a_0 conda-forge
r-googledrive 1.0.1 r41hc72bb7e_1 conda-forge
r-googlesheets4 0.3.0 r41hc72bb7e_0 conda-forge
r-gtable 0.3.0 r41hc72bb7e_3 conda-forge
r-haven 2.4.1 r41h2713e49_0 conda-forge
r-highr 0.9 r41hc72bb7e_0 conda-forge
r-hms 1.1.0 r41hc72bb7e_0 conda-forge
r-htmltools 0.5.1.1 r41h03ef668_0 conda-forge
r-httr 1.4.2 r41hc72bb7e_0 conda-forge
r-ids 1.0.1 r41hc72bb7e_1 conda-forge
r-isoband 0.2.4 r41h03ef668_0 conda-forge
r-jsonlite 1.7.2 r41hcfec24a_0 conda-forge
r-knitr 1.33 r41hc72bb7e_0 conda-forge
r-labeling 0.4.2 r41hc72bb7e_0 conda-forge
r-lattice 0.20_44 r41hcfec24a_0 conda-forge
r-lifecycle 1.0.0 r41hc72bb7e_0 conda-forge
r-lubridate 1.7.10 r41h03ef668_0 conda-forge
r-magrittr 2.0.1 r41hcfec24a_1 conda-forge
r-markdown 1.1 r41hcfec24a_1 conda-forge
r-mass 7.3_54 r41hcfec24a_0 conda-forge
r-matrix 1.3_4 r41he454529_0 conda-forge
r-mgcv 1.8_36 r41he454529_0 conda-forge
r-mime 0.11 r41hcfec24a_0 conda-forge
r-modelr 0.1.8 r41hc72bb7e_0 conda-forge
r-munsell 0.5.0 r41hc72bb7e_1003 conda-forge
r-nlme 3.1_152 r41h859d828_0 conda-forge
r-openssl 1.4.4 r41he36bf35_0 conda-forge
r-pillar 1.6.1 r41hc72bb7e_0 conda-forge
r-pkgconfig 2.0.3 r41hc72bb7e_1 conda-forge
r-pkgload 1.2.1 r41h03ef668_0 conda-forge
r-plyr 1.8.6 r41h03ef668_1 conda-forge
r-praise 1.0.0 r41hc72bb7e_1004 conda-forge
r-prettyunits 1.1.1 r41hc72bb7e_1 conda-forge
r-processx 3.5.2 r41hcfec24a_0 conda-forge
r-progress 1.2.2 r41hc72bb7e_2 conda-forge
r-ps 1.6.0 r41hcfec24a_0 conda-forge
r-purrr 0.3.4 r41hcfec24a_1 conda-forge
r-r6 2.5.0 r41hc72bb7e_0 conda-forge
r-rappdirs 0.3.3 r41hcfec24a_0 conda-forge
r-rcolorbrewer 1.1_2 r41h785f33e_1003 conda-forge
r-rcpp 1.0.6 r41h03ef668_0 conda-forge
r-readr 1.4.0 r41h03ef668_0 conda-forge
r-readxl 1.3.1 r41h2713e49_4 conda-forge
r-rematch 1.0.1 r41hc72bb7e_1003 conda-forge
r-rematch2 2.1.2 r41hc72bb7e_1 conda-forge
r-reprex 2.0.0 r41hc72bb7e_0 conda-forge
r-reshape2 1.4.4 r41h03ef668_1 conda-forge
r-rlang 0.4.11 r41hcfec24a_0 conda-forge
r-rmarkdown 2.9 r41hc72bb7e_0 conda-forge
r-rprojroot 2.0.2 r41hc72bb7e_0 conda-forge
r-rstudioapi 0.13 r41hc72bb7e_0 conda-forge
r-rvest 1.0.0 r41hc72bb7e_0 conda-forge
r-scales 1.1.1 r41hc72bb7e_0 conda-forge
r-selectr 0.4_2 r41hc72bb7e_1 conda-forge
r-stringi 1.6.2 r41hcabe038_0 conda-forge
r-stringr 1.4.0 r41hc72bb7e_2 conda-forge
r-sys 3.4 r41hcfec24a_0 conda-forge
r-testthat 3.0.3 r41h03ef668_0 conda-forge
r-tibble 3.1.2 r41hcfec24a_0 conda-forge
r-tidyr 1.1.3 r41h03ef668_0 conda-forge
r-tidyselect 1.1.1 r41hc72bb7e_0 conda-forge
r-tidyverse 1.3.1 r41hc72bb7e_0 conda-forge
r-tinytex 0.32 r41hc72bb7e_0 conda-forge
r-utf8 1.2.1 r41hcfec24a_0 conda-forge
r-uuid 0.1_4 r41hcfec24a_1 conda-forge
r-vctrs 0.3.8 r41hcfec24a_1 conda-forge
r-viridislite 0.4.0 r41hc72bb7e_0 conda-forge
r-waldo 0.2.5 r41hc72bb7e_0 conda-forge
r-withr 2.4.2 r41hc72bb7e_0 conda-forge
r-xfun 0.24 r41h03ef668_0 conda-forge
r-xml2 1.3.2 r41h03ef668_1 conda-forge
r-yaml 2.2.1 r41hcfec24a_1 conda-forge
readline 8.1 h46c0cb4_0 conda-forge
requests 2.25.1 pyhd3deb0d_0 conda-forge
rsa 4.7.2 pyh44b312d_0 conda-forge
ruffus 2.8.4 pyh864c0ab_1 bioconda
s3transfer 0.4.2 pyhd8ed1ab_0 conda-forge
sed 4.8 he412f7d_0 conda-forge
setuptools 52.0.0 py39h06a4308_0
six 1.16.0 pyh6c4a22f_0 conda-forge
sqlalchemy 1.4.20 py39h3811e60_0 conda-forge
sqlite 3.36.0 h9cd32fc_0 conda-forge
sysroot_linux-64 2.12 h77966d4_13 conda-forge
time 1.8 h516909a_0 conda-forge
tk 8.6.10 hed695b0_1 conda-forge
tktable 2.10 hb7b940f_3 conda-forge
typing-extensions 3.10.0.0 hd8ed1ab_0 conda-forge
typing_extensions 3.10.0.0 pyha770c72_0 conda-forge
tzdata 2021a he74cb21_0 conda-forge
urllib3 1.26.6 pyhd8ed1ab_0 conda-forge
wheel 0.36.2 pyhd3deb0d_0 conda-forge
xorg-kbproto 1.0.7 h14c3975_1002 conda-forge
xorg-libice 1.0.10 h516909a_0 conda-forge
xorg-libsm 1.2.3 hd9c2040_1000 conda-forge
xorg-libx11 1.7.2 h7f98852_0 conda-forge
xorg-libxext 1.3.4 h7f98852_1 conda-forge
xorg-libxrender 0.9.10 h7f98852_1003 conda-forge
xorg-libxt 1.2.1 h7f98852_2 conda-forge
xorg-renderproto 0.11.1 h14c3975_1002 conda-forge
xorg-xextproto 7.3.0 h14c3975_1002 conda-forge
xorg-xproto 7.0.31 h14c3975_1007 conda-forge
xz 5.2.5 h516909a_1 conda-forge
yaml 0.2.5 h516909a_0 conda-forge
yarl 1.5.1 py39h07f9747_0 conda-forge
zlib 1.2.11 h516909a_1010 conda-forge
zope.event 4.5.0 pyh9f0ad1d_0 conda-forge
zope.interface 5.4.0 py39h3811e60_0 conda-forge
zstd 1.5.0 ha95c52a_0 conda-forge