我想为先知,在Jupyter笔记本中使用R魔法运行一个教程。下面的代码:安装一个R库,在一个anaconda Jupyter笔记本上使用R魔法
%%R
library(prophet)
df <- read.csv('../examples/example_wp_peyton_manning.csv')
df$y <- log(df$y)
m <- prophet(df)
future <- make_future_dataframe(m, periods=366)
返回此:
Error in library(prophet) : there is no package called ‘prophet’
然后,在我的IPython的笔记本我运行此:
from rpy2.robjects.packages import importr
utils = importr('utils')
utils.install_packages('prophet')
它返回这样的:
--- Please select a CRAN mirror for use in this session ---
Secure CRAN mirrors
1: 0-Cloud [https] 2: Australia (Canberra) [https]
3: Australia (Melbourne) [https] 4: Australia (Perth) [https]
5: Austria [https] 6: Belgium (Ghent) [https]
7: Brazil (RJ) [https] 8: Brazil (SP 1) [https]
9: Bulgaria [https] 10: Chile 1 [https]
11: China (Lanzhou) [https] 12: Colombia (Cali) [https]
13: Czech Republic [https] 14: Denmark [https]
15: France (Lyon 1) [https] 16: France (Lyon 2) [https]
17: France (Marseille) [https] 18: France (Montpellier) [https]
19: France (Paris 2) [https] 20: Germany (Münster) [https]
21: Iceland [https] 22: Indonesia (Jakarta) [https]
23: Ireland [https] 24: Italy (Padua) [https]
25: Japan (Tokyo) [https] 26: Malaysia [https]
27: Mexico (Mexico City) [https] 28: Norway [https]
29: Philippines [https] 30: Russia (Moscow) [https]
31: Spain (A Coruña) [https] 32: Spain (Madrid) [https]
33: Sweden [https] 34: Switzerland [https]
35: UK (Bristol) [https] 36: UK (Cambridge) [https]
37: UK (London 1) [https] 38: USA (CA 1) [https]
39: USA (KS) [https] 40: USA (MI 1) [https]
41: USA (TN) [https] 42: USA (TX 1) [https]
43: USA (TX 2) [https] 44: (other mirrors)
的输入框显示和我做的任何选择导致此:
rpy2.rinterface.NULL
我有RStudio,并且先知在R Studio中运行无w/o问题。这告诉我,我有另一个R内核在某处运行,链接到Anaconda的环境或其他一些配置错误。
有没有办法解决这个问题,所以我可以用R Studio中的内核运行R或强制当前的R内核安装prophet?
如何知道R魔术师在这款Jupyter笔记本中使用的R内核的位置? (我的Jupyter笔记本显示了6个内核,当我真的有3个时,我重复了我的两次)。
谢谢
除非您正在处理[Prophet](http://www.prophet-web.com/)软件,否则请不要使用[prophet]标记。 – YowE3K