Skip to content

Instantly share code, notes, and snippets.

@bbolker
Last active January 4, 2016 18:56
Show Gist options
  • Save bbolker/065af65d7010917a994d to your computer and use it in GitHub Desktop.
Save bbolker/065af65d7010917a994d to your computer and use it in GitHub Desktop.
runr test with persistent python3
---
title: "runr test"
date: "`r format(Sys.time(), '%H:%M %d %B %Y ')`"
author: Ben Bolker
---
```{r opts,message=FALSE,echo=FALSE,warning=FALSE}
library("knitr")
library("runr")
py <- proc_python()
py$start()
knit_engines$set(python = function(options) {
knitr:::wrap(py$exec(options$code), options)
})
opts_chunk$set(tidy=FALSE,engine='python',engine.path='python3')
```
```{r chunk1}
a = 1
```
```{r chunk2}
print(a)
```
```{r chunk3,engine="R"}
runif(1)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment