I am using Rstudio for my day to day R stuff. Sometimes, I'd like to use some python/bash for the parts that R isn't super good at. Curiously enough I've noticed if I start an new RMarkdown document, that the following code works:
```{r engine='python'}
print "Hello" + "World"
import random
print random.random()
```
Rstudio can run me some python. This is very useful, but preferably I would be able to run this not just via the markdown feature but through a console as well. In the release notes it is suggested that there is support for syntax highlighting.
I wonder, is there any method to connect a new console to Rstudio such that we could also do some python/bash from the IDE? It certainly seems like Rstudio has a notion of how to connect to python. The end goal would be to create .Rmd
documents and be able to edit/interact with them that have the following structure:
# Use Case
Connect to an api that is supported in python
```{r engine='python', highlight=TRUE}
data = foobar_api.get(1000)
file_loc = open("~/data/filename.csv", "w")
file_loc(data)
file_loc.close()
```
Then analyse with R again.
```{r}
df <- read.csv("~/data/filename.csv")
summary(df)
```