Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knitr throwing error on commented-out R code #1567

Closed
woodwards opened this issue Jul 2, 2018 · 3 comments
Closed

Knitr throwing error on commented-out R code #1567

woodwards opened this issue Jul 2, 2018 · 3 comments
Milestone

Comments

@woodwards
Copy link

woodwards commented Jul 2, 2018

I have a long RMD document which Runs correctly, but is throwing an error when Knitting, on this comment line (which is not in a chunk).

<!-- Average soil moisture = `r round(mean(data_sm$mean_sm, na.rm=TRUE))` -->

Knitr is trying to evaluate the R expression between the backticks in this line (there is an expected error because data_sm doesn't exist).

It works if I remove the backticks.

@yihui yihui added this to the v1.21 milestone Jul 2, 2018
@yihui
Copy link
Owner

yihui commented Jul 2, 2018

Duplicate of #1363

Currently you have to comment out the inline code, e.g.,

<!-- Average soil moisture = `r #round(mean(data_sm$mean_sm, na.rm=TRUE))` -->

@yihui yihui marked this as a duplicate of #1363 Jul 2, 2018
@yihui yihui closed this as completed Dec 9, 2018
@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
@yihui
Copy link
Owner

yihui commented Jun 18, 2024

Just for the record, commented-out R code is ignored in litedown: https://github.com/yihui/litedown

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants