I use R and RStudio at university for homework a lot. Assignments are usually performed line by line: "The proof theorem is xy and we will implement your solution in R".
Currently, I mainly rely on Wolframalpha and Maple for symbolic computing, but I would like to work completely in RStudio to solve such problems.
I know that R has an interface with 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 possible to somehow use Python code in knitr pieces with engine = "python" and send the script to the console RStudio without having to knit an entire document?
The workflow I'm looking for is the following:
- Have a .RMD file in RStudio with a piece with the engine = "python"
- Import sympy and do some symbolic calculations
- Execute a piece of python and immediately see the output in the RStudio console (for example, with regular R fragments) without pasting the entire document
- Ideally, you can also access python results so that I can convert them to formula R, 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 calculations in R + RStudio, I also look forward to your answers!
Thanks to everyone who is ready to help me :) It has been bothering me for quite some time ...
source share