Python & R in markdown file

Running R inside Rmarkdown

R & Rstudio can be used to run Python code as well, for this you need to have the python interpreter installed in your system. Here is a r markdown file which runs both R & Python.

for(i in 1:3){ # R syntax to implement a for loop
    i = i + 1 # R's syntax for increment by 1
    cat(i,'\n')
}
## 2 
## 3 
## 4

Running Python inside Rmarkdown

for i in range(1,4): # For loop for range 2 to 4
    i += 1 # Python allows shorthand increment syntax
    print(i)
## 2
## 3
## 4
Note : Other than HTML web pages you can also generate PDF documents as well using Rmarkdown files.
Example : Database Management and Warehousing - Notes