I am working on a computer cluster and testing out how to use a Jupyter notebook on it. I encountered this problem while trying to use ggplot2. I've tried installing the package in the notebook, with R in the command line, and with conda install, and r-ggplot2 (version 2.2.1) shows up in conda packages. Any ideas?
Judged by your screenshot, you are running a python-based notebook. It looks as if you are trying to use ggplot as part of the python package rpy2.
Based on this source, ggplot is present in rpy2.robjects.lib.ggplot2, so you might want to try something like
from rpy2.robjects.lib.ggplot2 import ggplot
...
ggplot(data=df)
Related
I have an R notebook that I am trying to make into a Jupyter notebook using IRkernel, which I downloaded via Anaconda.
Everything works fine except when I try to use dygraphs, which just won't display the graph.
The only thing close to an answer I could find online is: https://doc.dataiku.com/dss/latest/R/dygraphs.html but I am not able to download the dataiku library for some reason.
I tried using conda install -c r r-dygraphs but it has made no difference.
On the dygraphs website they don't mention anything about using it in a Jupyter notebook so I'm not sure what to do. If it isn't supported on Jupyter, can someone point me to a close alternative to dygraphs that will work on Jupyter? The time series visualisation is really great on it which is why I want to implement it in my Jupyter notebook.
Thanks in advance!
If your error is something like:
ERROR while rich displaying an object: Error in file(file, "rb"): invalid 'description' argument
Then I think it's referring to not being able to plot the dygraphs in Jupyter. I would suggest checking out the "using" section on the documentation for R dygraphs. Although it doesn't strictly mention using dygraphs in Jupyter notebooks, it gives pointers for using them in R Console, R Markdown, and R Shiny. Lately I've been using them in an R shiny application and they've worked flawlessly, just as long as you set them up correctly. Also, just use:
install.packages('dygraphs')
in Jupyter notebooks to ensure successful installation and use. I've noticed that there are inconsistencies when running conda install commands (i.e. whether or not the package will end up working in Jupyter notebooks, RStudio, or both).
I think the problem is not in the install dygraphs, but it depends on jupyter notebook, this one can't appear dynamic graphic such as in RMarkdown.
I just downloaded anaconda and downloaded their basic R package.
I also got some packages from anaconda, using the anaconda terminal commands that they provide on their website.
My question is -- when I am starting a new R session in r studio, do I still need to install.packages()? Can I just load the package?
When I press libary(rJava) for example -- the R command line doesn't say anything back on whether it was successful, that's why I'm not sure. Thanks.
if you have installed the R packages via the R command line then you can just directly load them. I would recommend that you use the command line rather than R studio.
I am trying to draw graph by R on linux,
when I run this code: plot(1,1)
a graph with messy code is drawn
I am using OS linux, R 3.4.1 , jupyter notebook
Cairo is used as device for drawing.
I have tried these methods:
trying another method in R
trying another font
trying utf-8 encode
but these are not work.
It should not be problem of jupyter notebook because I run R console and draw the graph, the same problem happened. It should be problems in R, or Cairo, or something between them.
I have solved it by reinstalling R.
I had this same problem on a Linux machine where I used a conda installed R system running in Jupyter Notebooks. The issue for me turned out to be missing fonts. I solved it by using conda to install fonts:
conda install -c anaconda fonts-anaconda
I am trying to take advantage of the Juypter notebook with the R kernel. R-essentials via conda does not include the forecast package.
However someone has seemed to create one:
https://anaconda.org/r/r-forecast
I have installed the package with conda install -c r r-forecast=7.3 per the directions. Seems to install without issue.
When I launch the R kernel in Jupyter and attach the forecast library, it starts off fine and then errors. However I can't understand what the error means to even begin a fix.
Thoughts?
I have python 3 env
installed rpy2 with
conda install -c r rpy2=2.8.5
load the cell magic in jupyter notebook with
%load_ext rmagic
when I try to use R block in notebook, it gives me the error
ERROR:root:Cell magic `%%R` not found.
In a terminal:
pip install rpy2
In a notebook:
%load_ext rpy2.ipython
Then you can use %%R:
%%R
var <- c(1, 2, 3)
This is a link to the best answer I have found to the problem given on this thread:
R Notebook.
This link states that the error means that R is not configured in your DSS instance.
You need to install R manually.
The commands given on the forum post are:
Install the R packages RJSONIO and HTTR in any R console.
Install the Python package rpy2:
pip install rpy2
Afterward, they give the following link:
configure R.
I hope this is helpful and well worded.