org-babel 如何摆脱作为 shell 一个输入的 R 代码输出中的 [1]

org-babel how to get rid of [1] in the output of an R code that is the input of a shell one

R 包含 [#] 标记作为每个元素索引的标签,但不幸的是,当此输出用作另一个块的输入时,这是一个问题。

我已经尝试使用 cat 来摆脱它,但是这样我没有得到任何结果。对此有什么想法吗?

#+name: aux
#+begin_src R :results output
a <- c(-2, 2, 4, 5, 6, 7, -6, -4, 99, 101, -9, 2, 0, 1, 3, 123, 345, 678, 987, 543, 3567)
a
#+end_src

#+begin_src shell :results output :var ls=aux
for l in $ls; do
    echo "processing $l"
done;
#+end_src

#+RESULTS:
#+begin_example
processing [1]
processing -2
processing 2
processing 4
processing 5
processing 6
processing 7
processing -6
processing -4
processing 99
processing 101
processing -9
processing 2
processing 0
processing 1
processing 3
processing [16]
processing 123
processing 345
processing 678
processing 987
processing 543
processing 3567
#+end_example

cat 应该可以,你只需要打印到 stdout,

#+begin_src R :results output
a <- c(-2, 2, 4, 5, 6, 7, -6, -4, 99, 101, -9, 2, 0, 1, 3, 123, 345, 678, 987, 543, 3567)
cat(a, file=stdout())
#+end_src

#+RESULTS: aux
: -2 2 4 5 6 7 -6 -4 99 101 -9 2 0 1 3 123 345 678 987 543 3567

或者,使用 :results value verbatim 也行。