[GRASS-SVN] r67088 - grass-addons/grass7/vector/v.class.mlR

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 12 06:19:15 PST 2015


Author: mlennert
Date: 2015-12-12 06:19:15 -0800 (Sat, 12 Dec 2015)
New Revision: 67088

Modified:
   grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py
Log:
chose first mirror available for R-package installation and create index for faster join


Modified: grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py
===================================================================
--- grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py	2015-12-12 14:03:22 UTC (rev 67087)
+++ grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py	2015-12-12 14:19:15 UTC (rev 67088)
@@ -153,6 +153,7 @@
     install += "if(!file.exists(Sys.getenv('R_LIBS_USER'))){\n"
     install += "dir.create(Sys.getenv('R_LIBS_USER'), recursive=TRUE)\n"
     install += ".libPaths(Sys.getenv('R_LIBS_USER'))}\n"
+    install += "chooseCRANmirror(ind=1)\n"
     install += "install.packages('e1071', "
     install += "repos='https://mirror.ibcp.fr/pub/CRAN/')}" 
     r_file.write(install)
@@ -271,6 +272,9 @@
     	grass.message("Loading results into attribute table")
 	grass.run_command('db.in.ogr', input_=model_output, output=temptable,
 			   overwrite=True, quiet=True)
+        index_creation = "CREATE INDEX idx_%s_cat" % temptable
+        index_creation += " ON %s (cat_)" % temptable
+        grass.run_command('db.execute', sql=index_creation)
 	grass.run_command('v.db.join', map_=allfeatures, column='cat',
 			   otable=temptable, ocolumn='cat_', 
 			   subset_columns=output_classcol, quiet=True)



More information about the grass-commit mailing list