Hi, R doesn’t work on my laptop running capitan [1] My Rutils.py is in the machine /Applications/QGIS.app/Contents/Resources/python/plugins/processing/algs/r/Rutils.py
R_Home is in .bash_proflle export PYTHONPATH="/Applications/QGIS.app/Contents/Resources/python" #R para Qgis export R_HOME=/Library/Frameworks/R.framework/Versions/Current/Resources/ /Library/Frameworks/R.framework/Versions/Current/Resources/ #exists R works typing R in a terminal To get rid of the message claiming that (This happens when trying to activate R ?) /Applications/QGIS.app/Contents/msys is not there I cheated creating it Now I’m able to activate R and download the scripts but an error pop up Missing dependency. This algorithm cannot be run :-( This algorithm requires R to be run. Unfortunately it seems that R is not installed in your system or it is not correctly configured to be used from QGIS Click here to know more about how to install and configure R to be used with QGIS No problems in other machines running earlier versions of MacOS Best A. [1] System Version: OS X 10.11.3 (15D21) Kernel Version: Darwin 15.3.0 El 6Mar, 2016, a las 9:55 AM, gene <[email protected]> escribió: > Processing has nothing to do with rpy2. it uses subprocess > <https://docs.python.org/2/library/subprocess.html> to execute the > original R script > > The explication is in the > /Applications/QGIS.app/Contents/Resources/python/plugins/processing/algs/r/RUtils.py > script > > 1) RUtils first create a temporary file named > /Users/.../.qgis2/processing/processing_script.r with the desired R commands > (def createRScriptFromRCommands(commands):, line 73) > > Example of the content of a processing_script.r file > > options("repos"="http://cran.at.r-project.org/") > tryCatch(find.package("rgdal"), error=function(e) > install.packages("rgdal", dependencies=TRUE)) > tryCatch(find.package("raster"), error=function(e) > install.packages("raster", dependencies=TRUE)) > library("raster") > library("rgdal") > Layer = > readOGR("/Users/Shared/telechargement/04_01_16/valuerelation_testproject",layer="testo2") > Field="num" > Summary_statistics<-data.frame(rbind(sum(Layer[[Field]]), > length(Layer[[Field]]), > length(unique(Layer[[Field]])), > min(Layer[[Field]]), > max(Layer[[Field]]), > max(Layer[[Field]])-min(Layer[[Field]]), > mean(Layer[[Field]]), > > median(Layer[[Field]]),sd(Layer[[Field]])),row.names=c("Sum:","Count:","Unique > values:","Minimum value:","Maximum value:","Range:","Mean value:","Median > value:","Standard deviation:")) > colnames(Summary_statistics)<-c(Field) > Summary_statistics > > 2) it execute the script with subprocess (def executeRAlgorithm:, line 88). > > command = ["R", "CMD","BATCH", "--vanilla", > RUtils.getRScriptFilename(),RUtils.getConsoleOutputFilename()] > proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, > stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=True) > > 3) If you want, you can also use R directly to execute the script > > source("processing_script.r") > > Conclusions > > a) you need access to R in command line (Terminal.app) > > export R_HOME=/Library/Frameworks/R.framework/Versions/Current/Resources/ > in the .bash_profile file > > b) you need to install all the R packages independently of QGIS > install.packages('rgdal') > install.package('raster') > ..... > > > > > -- > View this message in context: > http://osgeo-org.1560.x6.nabble.com/R-in-QGIS-on-OSX-using-Kyngchaos-build-tp5254567p5254644.html > Sent from the Quantum GIS - User mailing list archive at Nabble.com. > _______________________________________________ > Qgis-user mailing list > [email protected] > List info: http://lists.osgeo.org/mailman/listinfo/qgis-user > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user _______________________________________________ Qgis-user mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
