Sapsi
Sapsi

Reputation: 721

Specify a different R engine using options in rmarkdown chunks

I'm using rmarkdown and i would like some R chunks to submitted to a remote server. I have written an engine for this but i dont want a different name since i want R's syntax highlighting to be kept for this engine.

So i thought i might have something like

```{r remoteAPI=TRUE}


```

And then i could override knitr::knit_engines$get()$r and call the default engine if remoteAPI is missing or FALSE. However there isn't a default engine for R.

  1. So, how would i manually override the execution of R chunks without another engine.
  2. Or if i need to write another engine, e.g. remoteR, how can tell knitr to use R syntax for highlighting the output.

Upvotes: 1

Views: 120

Answers (1)

Sapsi
Sapsi

Reputation: 721

The second approach is trivial. Just before the return in your engine, set options$engine='r'. See https://github.com/saptarshiguha/rdatabricks/blob/master/R/knitr_engines.R#L36

Upvotes: 1

Related Questions