Skip to content

Tag: r

How to plot (inline) with rpy2 in Jupyter notebook?

I’m learning to use rpy2 in Jupyter notebook. I’m having troubles with the plotting. When I use this example from the rpy2 docs for interactive work: Jupyter opens a new window with the plot. The window “title” reads: R Graphics: Device 2 (ACTIVE) (Not Responding). My Jupyter kernel is active. When I try to close […]

plyr or dplyr in Python

This is more of a conceptual question, I do not have a specific problem. I am learning python for data analysis, but I am very familiar with R – one of the great things about R is plyr (and of course ggplot2) and even better dplyr. Pandas of course has split-apply as well however in R I can do things

auto.arima() equivalent for python

I am trying to predict weekly sales using ARMA ARIMA models. I could not find a function for tuning the order(p,d,q) in statsmodels. Currently R has a function forecast::auto.arima() which will tune the (p,d,q) parameters. How do I go about choosing the right order for my model? Are there any libraries available in python for this purpose? Answer You can

Circular shift of vector (equivalent to numpy.roll)

I have a vector: And I’d like to do something like: Is there a function like that in R? I’ve been googling around, but “R Roll” mostly gives me pages about Spanish pronunciation. Answer How about using head and tail… One cool thing about using head and tail… you get a reverse roll with negative n, e.g.