r语言 - 使用GNU parallel从命令行呈现许多Rmds



要从命令行编写Rmd,您可以执行以下操作,它将创建一个HTML

Rscript -e "rmarkdown::knit('test.Rmd')"

我想为许多使用GNU并行的Rmds做这件事,我已经尝试过这个和各种版本,我在

周围移动引号
find -name "*.Rmd" | parallel Rscript -e "rmarkdown::render('{}')"

但是我总是出错。

/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `Rscript -e rmarkdown::render('./test.Rmd')'

我认为这与引号在哪里有关,因为我得到不同的错误取决于我把它们放在哪里。有什么问题吗?它是不是在做一些有趣的事情,比如只尝试并行化Rscript,而不是它后面的东西?

Fromman parallel:

If you get errors like:
sh: -c: line 0: syntax error near unexpected token
sh: Syntax error: Unterminated quoted string
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
zsh:1: no matches found:
then you might try using -q.

:

find -name "*.Rmd" | parallel -q Rscript -e "rmarkdown::render('{}')"

最新更新