[GRASS-SVN] r66852 - grass-addons/grass7/vector/v.class.mlR
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 16 08:52:06 PST 2015
Author: mlennert
Date: 2015-11-16 08:52:06 -0800 (Mon, 16 Nov 2015)
New Revision: 66852
Modified:
grass-addons/grass7/vector/v.class.mlR/v.class.mlR.html
grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py
Log:
check if R directory exists in $HOME, if not create one and use it for install of package
Modified: grass-addons/grass7/vector/v.class.mlR/v.class.mlR.html
===================================================================
--- grass-addons/grass7/vector/v.class.mlR/v.class.mlR.html 2015-11-16 14:46:56 UTC (rev 66851)
+++ grass-addons/grass7/vector/v.class.mlR/v.class.mlR.html 2015-11-16 16:52:06 UTC (rev 66852)
@@ -49,7 +49,9 @@
latter solution is quite useful in a computer lab where rpy2 is not installed).
<p>
-Other classifiers should be included.
+Other classifiers should be included. One option would be to use the 'caret'
+R package but this would mean handling the different dependency packages for
+the different methods.
<h2>EXAMPLE</h2>
Modified: grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py
===================================================================
--- grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py 2015-11-16 14:46:56 UTC (rev 66851)
+++ grass-addons/grass7/vector/v.class.mlR/v.class.mlR.py 2015-11-16 16:52:06 UTC (rev 66852)
@@ -148,10 +148,18 @@
r_file = open(r_commands, 'w')
+ create_dir = 'homeR = paste(Sys.getenv("HOME"), "/R/personal", sep="")\n'
+ create_dir += "if(!file.exists(homeR)) {dir.create(homeR, recursive=TRUE)}\n"
+ create_dir += ".libPaths(homeR)"
+ r_file.write(create_dir)
+ r_file.write("\n")
install = "if(!is.element('e1071', installed.packages()[,1])) "
- install += "{cat('\n\nInstalling e1071 package from CRAN\n\n')\n"
+ install += "{cat('\n\nInstalling e1071 package from CRAN into\n')\n"
+ install += "cat(homeR)\n"
+ install += "cat('\n')\n"
install += "install.packages('e1071', "
- install += "repos='https://mirror.ibcp.fr/pub/CRAN/')}"
+ install += "repos='https://mirror.ibcp.fr/pub/CRAN/', "
+ install += "lib = homeR)}"
r_file.write(install)
r_file.write("\n")
r_file.write('library(e1071)')
@@ -236,8 +244,14 @@
r_file.write(model_string)
r_file.write("\n")
- r_file.write("cat('\nTuning (or model) summary: ')")
+ r_file.write("cat('\nTuning (or model) summary: \n\n')")
r_file.write("\n")
+ r_file.write("cat('Kernel used: ')")
+ r_file.write("\n")
+ r_file.write("cat('%s\n')" % kernel)
+ r_file.write("\n")
+ install += "cat('\n')"
+ r_file.write("\n")
r_file.write("summary(model)")
r_file.write("\n")
if tune:
More information about the grass-commit
mailing list