Executing Perl 6 code in Rmarkdown

后端 未结 3 1849
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 22:33

I want to write some tutorials on Perl 6. For this I believe Rmarkdown would be of great help.

So I am trying to execute Perl 6 code within Rmarkdown docum

3条回答
  •  逝去的感伤
    2021-02-19 23:06

    You had two problems in your example. First, I think you can still use the existing perl engine (perl6 is not a valid engine name). Second, the engine.path option should point to the path of the executable instead of the directory name, e.g.

    ---
    title: "Example"
    output: html_document
    ---
    
    ```{perl, engine.path='C:\\rakudo\\bin\\perl6.exe'}
    my $s= "knitr is really good";
    say $s;
    ```
    

    You can also set the engine path globally for the perl engine:

    ```{r, setup, include=FALSE}
    knitr::opts_chunk$set(engine.path = list(
      perl = 'C:\\rakudo\\bin\\perl6.exe'
    ))
    ```
    

提交回复
热议问题