Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to load R packages and easily execute custom R scripts without Python code #20435

Closed
qgib opened this issue Feb 24, 2015 · 8 comments
Closed
Labels
Feature Request Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@qgib
Copy link
Contributor

qgib commented Feb 24, 2015

Author Name: Irucka Embry (@iembry)
Original Redmine Issue: 12250

Redmine category:processing/core
Assignee: Victor Olaya


In an answer to a question posted (http://gis.stackexchange.com/questions/75320/is-it-possible-to-create-and-run-custom-r-scripts-in-qgis-2-0?s=5|1.4552) at the GIS Stack Exchange, Guillermo Olmedo posted a link to his Python scripts with R code (saved as .rsx files).

Instead of .rxs files, I would like the ability to load custom R scripts as .R files without any Python code. I would like the ability to load any installed R package (or download R packages if not already installed and then load) into QGIS when executing a custom R script as well.

Thank you.


@qgib
Copy link
Contributor Author

qgib commented May 8, 2015

Author Name: Irucka Embry (@iembry)


Hi, would it be possible to use rpy2 (http://rpy.sourceforge.net/) to have the interface to R?

I know that SageMath (http://www.sagemath.org/) includes a working environment for R and it's also Python-based.

Thank you.

@qgib
Copy link
Contributor Author

qgib commented May 8, 2015

Author Name: Giovanni Manghi (@gioman)


Irucka Embry wrote:

Hi, would it be possible to use rpy2 (http://rpy.sourceforge.net/) to have the interface to R?

I know that SageMath (http://www.sagemath.org/) includes a working environment for R and it's also Python-based.

Thank you.

We had plugins in the past that worked on top of rpy(2) and they were all a bit painful to use and maintain, and if fact they stopped to be maintained. R is now integrated in QGIS via the Processing toolbox, there you can run any R script.

@qgib
Copy link
Contributor Author

qgib commented May 8, 2015

Author Name: Irucka Embry (@iembry)


Thank you for your note about the ability to run any R scripts from QGIS. I originally posted this feature request because I still have yet to be able to use any of my own R scripts in the SEXTANTE Processing Toolbox. I am using QGIS 2.8.1 on Trisquel 7.0, which is based off of Ubuntu Trusty. I have also tried in previous versions of QGIS with no success. I have attached the simple R script and the log output from the SEXTANTE Processing Toolbox. I attempted to run the script in the custom script window of the Toolbox.

Since rpy(2) was a horrible experience maybe using pyRServe could serve as a better interface to R and to the existing libraries installed on the computer. I performed some more research today on connecting Python/QGIS and R and the following 3 links are possibilities for making the R accessibility better:

  1. https://pythonhosted.org/pyRserve/index.html
    pyRServe is a library for connecting Python to an R process running under Rserve. Through such a connection variables can be get and set in R from Python, and also R-functions can be called remotely.

  2. http://www.rforge.net/Rserve/
    Rserve

  3. http://stackoverflow.com/questions/11716923/python-interface-for-r-programming-language
    Python interface for R Programming Language - Stack Overflow

Thank you.


  • 8691 was configured as simple.rsx
  • 8690 was configured as simple_R_script_fail.txt

@qgib
Copy link
Contributor Author

qgib commented Jan 13, 2016

Author Name: Alexander Bruy (@alexbruy)


If I'm not wrong, Processing allow you to add scripts in pure R. Reopen if necessary


  • resolution was changed from to fixed/implemented
  • tag was changed from R, statistics, scripts, packages to
  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Jan 13, 2016

Author Name: Irucka Embry (@iembry)


Processing does not allow scripts to be created in pure R. Here is an example from the scatterplot regressione script (only the last 2 lines are R commands):

##My scripts=group
##showplots
##Layer=vector
##X=Field Layer
##Y=Field Layer
##Title=string
plot(Layer[[X]], Layer[[Y]], xlab=X, ylab=Y, main=Title)+
abline(lm(Layer[[Y]]~Layer[[X]]))

Thank you.

Irucka Embry

@qgib
Copy link
Contributor Author

qgib commented May 1, 2017

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was configured as 0

@qgib
Copy link
Contributor Author

qgib commented May 1, 2017

Author Name: Giovanni Manghi (@gioman)


Some providers are being removed from QGIS/Processing (will be available as plugin) and so are their categories in the bug tracker. To not leave them orphaned of a category they are being reassigned to processing/core.

@qgib
Copy link
Contributor Author

qgib commented May 1, 2017

Author Name: Giovanni Manghi (@gioman)


  • category_id was changed from 124 to Processing/Core

@qgib qgib added Feature Request Processing Relating to QGIS Processing framework or individual Processing algorithms labels May 25, 2019
@qgib qgib added this to the Future Release - Nice to have milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

1 participant