0

我在 python 搁置文件中提供了一些数据,我想将其传递给 R 进行绘图。我提取它的代码如下所示:

尝试通过单击块中的“运行”按钮或将光标放在其中并按Ctrl+Shift+Enter来执行此块。

```{python}
import numpy as np
from numpy import ma, array
import shelve

MODEL = "May2016"
d = shelve.open('fits_shelve_' + MODEL)
hilldata = d['hilldata']
allchi  = d['allchi']
aa      = d['aa'] 
rr      = d['rr'] 
names   = d['names']
weight  = d['weight']
weightc = d['weightc']
dl      = d['dl']
vi      = d['activatorM']
activatorM = d['activatorM']
activatorR = d['activatorR']
d.close()

```

我现在想将这些对象传递给 R。有没有办法在 Rnotebook 中做到这一点?我知道 SQL 块可能会发生类似的事情。

4

1 回答 1

1

我认为对于 python/R 交互,您必须将数据以一个块的形式保存到文件系统中,然后在另一个块中读回。

http://rmarkdown.rstudio.com/authoring_knitr_engines.html#python

于 2017-10-02T21:02:51.200 回答