Skip to content
Permalink
Browse files
changed the R command behavior .libPaths() in RAlgorithm.py to add a …
….lib.loc and not substitute one

modifies the Advanced_Raster_histogramm.rsx in order to fully benefit from raster package RAM savety
  • Loading branch information
MatMatt committed Feb 25, 2013
1 parent f85d3ae commit aa4b291dba875576fb752d5da1b276493b894197
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
@@ -264,12 +264,14 @@ def getExportCommands(self):
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)

0 comments on commit aa4b291

Please sign in to comment.