I use R and RStudio a lot at university for homework assignments. The assignments are usually along the lines of: "Proof theorem xy and implement your solution in R".
Currently, I mainly rely on Wolframalpha and Maple for symbolic computations, but I would like to work completely in RStudio to solve such problems.
I know that R has an interface to Sympy called rSympy and that there are computer algebra systems like RYacas. However, since RStudio can execute Python scripts if they are stored in a .Py file and send them to the RStudio console, I was wondering if it is somehow possible to use Python code within knitr chunks with engine="python" and send the script to the RStudio console without having to knit the entire document?
The workflow I am looking for is the following:
- Have an .RMD file in RStudio with a chunk with engine="python"
- Import sympy and do some symbolic computations
- Execute the python chunk and immediately see output in RStudio console (like one can do with normal R chunks) without knitting the entire document
- Ideally, it would also be possible to access the python results so that I can convert them to a R formula etc.
See this link for a screenshot: https://www.dropbox.com/s/hn8azii7cji4suz/stackexchange_question.tiff?dl=0
If you know a more elegant way to do symbolic computations in R+RStudio, I am also looking forward to your answers!
Thanks a lot to everyone who is willing to help me:) This has been bugging me for quite some time now...