Skip to content

Ignore {knitr} chunks that use Rcpp engine? #928

@IndrajeetPatil

Description

@IndrajeetPatil

In a way, a follow-up to #312.

Should {styler} ignore {knitr} R code chunk with Rcpp engine?

For example, if I try to style an .Rmd file containing the following chunk,

```{r, engine='Rcpp'}
#include <Rcpp.h>
using namespace Rcpp;
```

it will (understandably) produce the following error:

Error in `parse_safely()`:
! <text>:2:7: unexpected symbol
1: #include <Rcpp.h>
2: using namespace
         ^

But this file might also contain a number of other R code chunks with engine = 'R', and none of them will be styled due to the offending Rcpp engine chunk.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions