R inline plots in Jupyter

亡梦爱人 提交于 2019-12-25 09:30:19

问题


I am trying to run R in Jupyter through the Binder project interface, though the question may be more general. For instance it question may be related the long-dormant one about Jupyter on Mac OS. I have the r-essentials, r-rzmq and r-repr added through conda. IRKernel and IRDisplay are part of r-essentials. However, when I try to plot anything, there is no output. Indeed, it looks like there are no graphics output options. What am I missing here? There is no problem in python notebooks, but no luck with R.

capabilities()
jpeg FALSE
png FALSE
tiff FALSE
tcltk TRUE
X11 FALSE
aqua FALSE
http/ftp TRUE
sockets TRUE
libxml TRUE
fifo TRUE
cledit FALSE
iconv TRUE
NLS TRUE
profmem TRUE
cairo FALSE
ICU TRUE
long.double TRUE
libcurl TRUE

回答1:


OK, so as @hrbrmstr points out 'Ugh. Anaconda'. I could get inline plotting to work by using a Dockerfile, and installing R using apt-get IRKernel via CRAN, as per official instructions:

# Set default CRAN repo
RUN echo 'options("repos"="http://cran.rstudio.com")' > .Rprofile

# Install IRkernel
RUN Rscript -e "install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))" -e "devtools::install_github('IRkernel/IRkernel')" -e "IRkernel::installspec(user = FALSE)"


来源:https://stackoverflow.com/questions/39805798/r-inline-plots-in-jupyter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!