mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Merge pull request #440 from MatMatt/master
[sextante] changed R command .libPaths to add and not substitute paths
This commit is contained in:
commit
f3fa14ce87
@ -264,12 +264,14 @@ class RAlgorithm(GeoAlgorithm):
|
||||
def getImportCommands(self):
|
||||
commands = []
|
||||
# if rgdal is not available, try to install it
|
||||
# just use US mirror
|
||||
commands.append('options("repos"="http://cran.us.r-project.org")')
|
||||
# just use main mirror
|
||||
commands.append('options("repos"="http://cran.at.r-project.org/")')
|
||||
rLibDir = "%s/rlibs" % SextanteUtils.userFolder().replace("\\","/")
|
||||
if not os.path.isdir(rLibDir):
|
||||
os.mkdir(rLibDir)
|
||||
commands.append('.libPaths("%s")' % rLibDir )
|
||||
# .libPaths("%s") substitutes the personal libPath with "%s"! With '.libPaths(c("%s",deflibloc))' it is added without replacing and we can use all installed R packages!
|
||||
commands.append('deflibloc <- .libPaths()[1]')
|
||||
commands.append('.libPaths(c("%s",deflibloc))' % rLibDir )
|
||||
commands.append(
|
||||
'tryCatch(find.package("rgdal"), error=function(e) install.packages("rgdal", lib="%s"))' % rLibDir)
|
||||
commands.append("library(\"rgdal\")");
|
||||
|
@ -2,7 +2,8 @@
|
||||
##[Example scripts]=group
|
||||
##Layer = raster
|
||||
##no_data_value = number 0
|
||||
##breaks = number 100
|
||||
##color = string red
|
||||
##showplots
|
||||
Layer <- raster(Layer, 1)
|
||||
NAvalue(Layer) = no_data_value
|
||||
hist(as.matrix(Layer), breaks=100, xlab = basename(filename(Layer)))
|
||||
hist(Layer, breaks=breaks,col=color)
|
||||
|
Loading…
x
Reference in New Issue
Block a user