-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Issue with inline R Notebook YAML header processing involving !expr #7545
Comments
@connorp Thank you for raising the issue, which I can reproduce in RStudio Desktop 1.4.673 on MacOS 10.15.6. We'll review it as we continue development of RStudio. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions. |
Adding that this is still an issue |
For reference, I believe this happens because there are still some R code in the IDE using yaml 📦 which use the default, leading to this warning being thrown Examples
As a workaround, setting For reference as mentioned above, rmarkdown sets |
FWIW the YAML package will probably use The message should disappear then, but maybe this will change some things as the IDE does rely on the default version and only has a handler for |
Does |
We could also evaluate whether we could make use of our embedded copy of yaml-cpp here. |
rmarkdown sets yaml_load <- function(...) yaml::yaml.load(..., eval.expr = TRUE)
yaml_load_file <- function(input, ...) yaml_load(read_utf8(input), ...) However, it only use the default provided handler for |
Bumping milestone as I suspect this is going to affect almost all rmarkdown users. |
Verified on build |
System details
Steps to reproduce the problem
(With R freshly restarted) Create a new R Notebook file via the RStudio File menu, with the following contents (the specific function passed via
!expr
is not important to the reprex.kable()
is used only as one example):Save the file.
Run the code block inline. Observe the warning messages in the console, in addition to the expected plot.
Restart R and clear output.
Run the code block inline again. This time, there is no warning message.
Describe the problem in detail
yaml.load()
now throws a warning when a YAML header includes an R expression to be evaluated, indicated by!expr
, unless theeval.expr = TRUE
option is explicitly set (and this warning will eventually be changed to an error). Thermarkdown
package sets this option and works fine in knitted R Markdown documents, but when code is run inline within an R Notebook in RStudio, the code executes as expected, but the warnings are also still reported:Describe the behavior you expected
The code should be run without any warnings issued, regardless of whether R has been restarted or outputs cleared. Further discussion in rstudio/rmarkdown#1093.
The text was updated successfully, but these errors were encountered: