问题
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