Does it taste good?

「そんなことも知らないの?」って言わないでほしい。

Jupyter notebookでRを使うための環境構築2018年1月

最近専らPythonを使う時はJupyter notebookを使っています。 コードと結果が両方残って、かつgithubに上げたときもそのセットが共有できる、ということが魅力と感じています。 RだとRstudioという素晴らしいIDEがあるわけで、あとはRmarkdownとかもあるわけで…けど、Jupyter notebookでRを使えたら、きっと便利だろうと思ったので、話には聞いたことはあったけどやったことがなかった環境構築をやってみました。

参考文献

環境

$python --version
Python 3.5.1 :: Anaconda custom (x86_64)

$jupyter --version
4.1.0

$R --version
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
http://www.gnu.org/licenses/.

やってみる

結論から言うと、公式の通りにやって、一瞬で終わります。

install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')

IRkernel::installspec()

f:id:kyyonko:20180129123213p:plain

f:id:kyyonko:20180129123224p:plain

テンションが上がった。

これからはJupyterでもRを楽しめそうです!