Hello Python and R Markdown

outcastgeek

The reticulate package includes a Python engine for R Markdown that enables easy interoperabilty between Python and R chunks.

R Markdown Python Engine

If you are using knitr version 1.18 or higher, then the reticulate Python engine will be enabled by default whenever reticulate is installed and no further setup is required:

import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
#plt.plot(t, s)
#plt.xlabel("time (s)")
#plt.ylabel("voltage (mV)")
#plt.grid(True)
#plt.savefig("pyrmd_time-voltage.png")
#plt.show()