Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to run an R script on a layer loaded in QGIS (to rotate a set of points created there using the Vector:Research Tools:Regular Points tool). I thought ManageR might work but cannot get it working on OSX ...

Of course, I could do it manually (create layer -> run script from within R -> find output and reload into QGIS) but surely there is a more elegant solution?

share|improve this question
On OsX you will need the python rpy2 package (to run ManageR). The QGIS OsX packager said yesterday that it will add it to his downloads page. Check the QGIS/OsX download page in the next days. – Giovanni Manghi Nov 23 '11 at 15:30
Nice - that will save a LOT of trouble! easy_install rpy2 worked for me, and my paths seem correct, but manageR still seems to fail with File "/Library/Python/2.7/site-packages/rpy2-2.2.2dev_20110903-py2.7-macosx-10.7-inte‌​l.egg/rpy2/rinterface/", line 7, in R_HOME = tmp.readlines() IOError: [Errno 4] Interrupted system call – Simbamangu Nov 23 '11 at 15:35

Currently I can't get manageR working on a Linux box - there's a problem importing layers into R from Qgis. I had a chat to Carson Farmer (the one-man magic machine who wrote manageR) and he's aware of the problem and is going to take a look at it sometime.

If that's your manageR problem (you weren't specific - couldn't get it working or couldn't get it installed? A problem getting Rpy2 on Mac?) then you'll just have to wait for that fix, or dive into the python and fix it yourself.

Otherwise, if the layer is saved as a shapefile or other OGR/GDAL source you'll have to get it via rgdal:readOGR or maptools:readShapeSpatial from R. Not too inelegant, but the other option is writing a bunch of python code to dump the layer to something like that yourself - which is essentially what manageR is all about...

share|improve this answer
ManageR fails to load ... at all ... giving errors that don't get fixed by any of the usual path fixes. rpy2 is installed just fine! I was hoping to avoid the 'write a bunch of python code' bit but that is starting to look like the best solution! Need to dive into it I guess (seems a bit less frightening now that I've worked out some R code). – Simbamangu Nov 23 '11 at 13:42
up vote 3 down vote accepted

It is possible to get manageR working on OSX (Lion 10.7.2) at least.

It looks like the problem with manageR / rpy2 was actually problems with the previous R builds (2.13 at least) - symlinks were referring to the wrong location.

  1. Update R to 2.14 (binary from;
  2. Reinstall QGIS (Kyngchaos installer);
  3. Reinstall GDAL_complete (Kyngchaos again);
  4. Reinstall rpy2 (latter via pip), rebooted ...

... and manageR now loads and works. Haven't tried this in Linux yet.

UPDATE: The SEXTANTE plugin can be used to write scripts that call R, with some modifications in OSX to make it work properly.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.