Kniting Python code in RStudio

Community

I'm new to Python and have been working with Python code inside RStudio and am currently having a problem kniting a R Notebook. Each individual Python section seems to work but when I knit it I receive a pandoc error and I'm not sure what it is telling me...

processing file: IntermediatePython.Rmd
|..... | 7%
inline R code fragments

|......... | 13%
label: setup (with options)
List of 1
$ include: logi FALSE

|.............. | 20%
ordinary text without R code

|................... | 27%
label: unnamed-chunk-1 (with options)
List of 1
$ engine: chr "python"

|....................... | 33%
ordinary text without R code

|............................ | 40%
label: unnamed-chunk-2 (with options)
List of 1
$ engine: chr "python"

|................................. | 47%
ordinary text without R code

|..................................... | 53%
label: unnamed-chunk-3 (with options)
List of 1
$ engine: chr "python"

|.......................................... | 60%
ordinary text without R code

|............................................... | 67%
label: unnamed-chunk-4 (with options)
List of 1
$ engine: chr "python"

|................................................... | 73%
ordinary text without R code

|........................................................ | 80%
label: unnamed-chunk-5 (with options)
List of 1
$ engine: chr "python"

|............................................................. | 87%
ordinary text without R code

|................................................................. | 93%
label: unnamed-chunk-6 (with options)
List of 1
$ engine: chr "python"

|......................................................................| 100%
ordinary text without R code

output file: IntermediatePython.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS IntermediatePython.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output IntermediatePython.html --lua-filter "C:\Users\reichmaj\Documents\R\win-library\4.1\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\reichmaj\Documents\R\win-library\4.1\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --variable bs3=TRUE --standalone --section-divs --template "C:\Users\reichmaj\Documents\R\win-library\4.1\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable theme=cerulean --include-in-header "C:\Users\reichmaj\AppData\Local\Temp\RtmpCETUi3\rmarkdown-str41c41ca51bb8.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --variable code_folding=hide --variable code_menu=1
File IntermediatePython_files/figure-html/unnamed-chunk-1-1.png not found in resource path
Error: pandoc document conversion failed with error 99
Execution halted


Apparently the issue has to do with the python "plt.plot()" and or "plt.show()" commands in RStudio. If I use something like

# call Python from R
plot(py$year, py$pop, type = "l")

R Notebook with knit. Is there a better way to handle this?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.