[Soiltexture-commits] r123 - / pkg pkg/soiltexture pkg/soiltexture/R pkg/soiltexture/inst pkg/soiltexture/man pkg/soiltexture/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 14 11:39:24 CEST 2015


Author: jmoeys
Date: 2015-04-14 11:39:24 +0200 (Tue, 14 Apr 2015)
New Revision: 123

Added:
   pkg/soiltexture/R/soiltexture_text_gui.R
   pkg/soiltexture/man/soiltexture_gui.Rd
   pkg/soiltexture/tests/soiltexture_gui.R
Modified:
   pkg/
   pkg/soiltexture/DESCRIPTION
   pkg/soiltexture/NAMESPACE
   pkg/soiltexture/NEWS
   pkg/soiltexture/R/soiltexture.R
   pkg/soiltexture/inst/SVN_VERSION
   pkg/soiltexture/man/TT.DJ.col.Rd
   pkg/soiltexture/man/TT.col2hsv.Rd
   pkg/soiltexture/man/TT.css2xy.Rd
   pkg/soiltexture/man/TT.deg2rad.Rd
   pkg/soiltexture/man/TT.dia2phi.Rd
   pkg/soiltexture/man/TT.phi2dia.Rd
   pkg/soiltexture/man/TT.polygon.area.Rd
   pkg/soiltexture/man/TT.polygon.centroids.Rd
   pkg/soiltexture/man/TT.vertices.plot.Rd
   pkg/soiltexture/man/soiltexture-package.Rd
   soiltexture_2_RCMDcheck_noexamples.bat
   soiltexture_3_RCMDINSTALL_build.BAT
   soiltexture_4_RCMDRd2pdf.BAT
   soiltexture_compile.R
Log:
Added soiltexture_gui(), a text-based graphical user interface for the package


Property changes on: pkg
___________________________________________________________________
Modified: svn:ignore
   - *.Rcheck
*.gz
*.pdf
*.zip
binaryArchives
soiltexture.Rcheck
soiltexture.Rcheck.zip
soiltexture_1.2.3.tar.gz
soiltexture_1.2.3_R_i486-pc-linux-gnu.tar.gz
soiltexture_1.2.4.tar.gz
soiltexture_1.2.4.zip
soiltexture_1.2.5.tar.gz
soiltexture_1.2.5.zip
soiltexture_1.2.6.tar.gz
soiltexture_1.2.6.zip
soiltexture_1.2.6_R_i486-pc-linux-gnu.tar.gz
soiltexture_1.2.8.tar.gz
soiltexture_1.2.8.zip
soiltexture_1.2.9.tar.gz
soiltexture_1.2.9.zip

   + *.Rcheck
*.gz
*.pdf
*.zip
binaryArchives
soiltexture.Rcheck
soiltexture.Rcheck.zip
soiltexture_1.2.3.tar.gz
soiltexture_1.2.3_R_i486-pc-linux-gnu.tar.gz
soiltexture_1.2.4.tar.gz
soiltexture_1.2.4.zip
soiltexture_1.2.5.tar.gz
soiltexture_1.2.5.zip
soiltexture_1.2.6.tar.gz
soiltexture_1.2.6.zip
soiltexture_1.2.6_R_i486-pc-linux-gnu.tar.gz
soiltexture_1.2.8.tar.gz
soiltexture_1.2.8.zip
soiltexture_1.2.9.tar.gz
soiltexture_1.2.9.zip
soiltexturegui


Modified: pkg/soiltexture/DESCRIPTION
===================================================================
--- pkg/soiltexture/DESCRIPTION	2015-03-09 09:36:26 UTC (rev 122)
+++ pkg/soiltexture/DESCRIPTION	2015-04-14 09:39:24 UTC (rev 123)
@@ -1,13 +1,13 @@
 Package: soiltexture
-Version: 1.2.22
-Date: 2015-03-09
+Version: 1.3.0
+Date: 2015-04-14
 Title: Functions for soil texture plot, classification and transformation
 Author: Julien Moeys [aut, cre], Wei Shangguan [ctb], Rainer Petzold [ctb], Budiman Minasny [ctb], Bogdan Rosca [ctb], Nic Jelinski [ctb], Wiktor Zelazny [ctb],  Rodolfo Marcondes Silva Souza [ctb],  Jose Lucas Safanelli [ctb], Alexandre ten Caten [ctb]
 Authors at R: c( person( "Julien", "Moeys", role = c("aut", "cre"), email = "jules_m78-soiltexture at yahoo.fr" ), person( "Wei", "Shangguan", role = "ctb" ), person( "Rainer", "Petzold", role = "ctb" ), person( "Budiman", "Minasny", role = "ctb" ), person( "Bogdan", "Rosca", role = "ctb" ), person( "Nic", "Jelinski", role = "ctb" ), person( "Wiktor", "Zelazny", role = "ctb" ), person( "Rodolfo", "Marcondes Silva Souza", role = "ctb" ), person( "Jose Lucas", "Safanelli", role = "ctb" ), person( "Alexandre", "ten Caten", role = "ctb" ) )
 Maintainer: Julien Moeys <jules_m78-soiltexture at yahoo.fr>
 Depends: R (>= 3.1.1)
 Suggests: xtable
-Description: "The Soil Texture Wizard" is a set of R functions designed to produce texture triangles (also called texture plots, texture diagrams, texture ternary plots), classify and transform soil textures data. These functions virtually allows to plot any soil texture triangle / classification into any triangle geometry (isosceles, right-angled triangles, etc.). This set of function is expected to be useful to people using soil textures data from different soil texture classification or different particle size systems. Several texture triangles are predefined: USDA; FAO (which is also the triangle for the soil map of Europe); Aisne (France); GEPPA (France); German triangles "Bodenkundliche Kartieranleitung 1994", "SEA 1974" and "TGL 1985"; Soil Survey of England and Wales; Australian triangle; Belgian triangle; Canadian triangle; ISSS triangle; Romanian triangle; Polish triangle.
+Description: "The Soil Texture Wizard" is a set of R functions designed to produce texture triangles (also called texture plots, texture diagrams, texture ternary plots), classify and transform soil textures data. These functions virtually allows to plot any soil texture triangle / classification into any triangle geometry (isosceles, right-angled triangles, etc.). This set of function is expected to be useful to people using soil textures data from different soil texture classification or different particle size systems. Many (> 15) texture triangles from all around the world are predefined in the package.
 License: AGPL (>=3)
 URL: http://soiltexture.r-forge.r-project.org/
-Imports: sp, MASS, tools, utils
+Imports: sp, MASS, tools, utils, tcltk

Modified: pkg/soiltexture/NAMESPACE
===================================================================
--- pkg/soiltexture/NAMESPACE	2015-03-09 09:36:26 UTC (rev 122)
+++ pkg/soiltexture/NAMESPACE	2015-04-14 09:39:24 UTC (rev 123)
@@ -4,4 +4,7 @@
 importFrom(MASS,kde2d)
 importFrom(MASS,mvrnorm)
 importFrom(utils,installed.packages)
+importFrom(utils,select.list)
+importFrom(utils,choose.files)
+importFrom(tcltk,tk_choose.files)
 importFrom(tools,package_dependencies)

Modified: pkg/soiltexture/NEWS
===================================================================
--- pkg/soiltexture/NEWS	2015-03-09 09:36:26 UTC (rev 122)
+++ pkg/soiltexture/NEWS	2015-04-14 09:39:24 UTC (rev 123)
@@ -1,13 +1,25 @@
 
     package: 'soiltexture'
 
+CHANGES IN VERSION 1.3.0
+    
+    2015/04/11  Implements a new text-based graphical user 
+        interface: soiltexture_gui(). The user is guided 
+        through a series of simple question to import, 
+        plot and classify soil texture data.
+    
+    2015/04/12  Many functions have now been classified 
+        as "internal" (keywords = internal) in order 
+        to simplify the long list of functions in the 
+        package help pages
+    
 CHANGES IN VERSION 1.2.22
-
-    2014/03/09  Fix package imports from tools and utils.
     
+    2015/03/09  Fix package imports from tools and utils.
+    
 CHANGES IN VERSION 1.2.21
 
-    2014/03/06  Added a new Brazilian texture triangle:
+    2015/03/06  Added a new Brazilian texture triangle:
         from Humberto Gonçalves dos Santos [et al.], 2013. 
         Sistema Brasileiro de Classificação de Solos, 3 ed. rev. 
         ampl. Brasília, DF: Embrapa, 2013.

Modified: pkg/soiltexture/R/soiltexture.R
===================================================================
--- pkg/soiltexture/R/soiltexture.R	2015-03-09 09:36:26 UTC (rev 122)
+++ pkg/soiltexture/R/soiltexture.R	2015-04-14 09:39:24 UTC (rev 123)
@@ -1,158 +1,4 @@
-# source( "C:/_R_PACKAGES/soiltexture/pkg/soiltexture/R/soiltexture.R" ) 
-# source( "http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/soiltexture/R/soiltexture.R?revision=19&root=soiltexture" ) 
-# +-------------------------------------------------------------------------+
-# |                                                                         |
-# | Julien MOEYS                                                            |
-# |                                                                         |
-# | The Soil Texture Wizard -- A set of R functions to plot soil texture    |
-# | triangles, classify and transform soil texture data                     |
-# |                                                                         |
-# | These functions are _originally_ based on the soil.texture function,    |
-# | in the PLOTRIX package from Jim LEMON and Ben BOLKER. But the code has  |
-# | been gradually modified, and is now (ALMOST?) ENTIRELY DIFFERENT from   |
-# | the original code. Not compatibilty has been maintained with PLOTRIX    |
-# | see <http://cran.r-project.org/web/packages/plotrix/index.html>         |
-# |                                                                         |
-# | Author:             -   Moeys Julien (2006-2010)                        |
-# | Contact:                http://julienmoeys.free.fr                      |
-# |                                                                         |
-# | Original sources:   -   plotrix package, by Lemon J. and Bolker B.      |
-# |                                                                         |
-# | Institution:            < 2008: EGC                                     |
-# |                                 UMG Environnement et Grandes Cultures   |
-# |                                 Equipe Sol, INRA/AgroParisTech          |
-# |                                 av. Lucien Bretignre, BP01              |
-# |                                 F-78850, Thiverval-Grignon, FRANCE      |
-# |                         > 2008: SLU Swedish University of               |
-# |                                 Agricultural Sciences                   |
-# |                                 Soil Science dept.,                     |
-# |                                 Environmental Physics div.              |
-# |                                 Ulls vg 17, Ultuna - PO Box 7014        |
-# |                                 SE-75651 Uppsala, SWEDEN                |
-# |                                                                         |
-# | None of the institution above, and neither the author, endorse any      |
-# | responsibility for problems that could arise from inaccuracies or errors|
-# | in the code presented here. (1) It is much based on free personal work  |
-# | and (2) it is provided for free, so users have the responsibility to    |
-# | check themselves that the program works as expected...                  |
-# |                                                                         |
-# | Research program:       An awful lots of _personal_ work +              |
-# | Research program:       < 2008: ESHEL research program,                 |
-# | Research program:       < 2009: FOOTPRINT, EU-FP6-funded project        |
-# |                                                                         |
-# | Context:                PhD thesis (France)                             |
-# |                         Post-doctoral position (Sweden)                 |
-# |                                                                         |
-# | Copyleft:               Julien Moeys                                    |
-# | Licence:                General Public Licence, GPL (>=3)               |
-# |                                                                         |
-# | Programing language:    R language for statistical computing            |
-# |                         http://wwww:r-project.org                       |
-# | OS:                     Tested on Windows XP                            |
-# |                         this scripts may/should work on Linux and MacOS |
-# |                                                                         |
-# +-------------------------------------------------------------------------+
-# |                                                                         |
-# | FEATURES list:                                                          |
-# | -   Create ternary/triangle plot of point variables defined by a        |
-# |     triplet of variable (which sum to a constant).                      |
-# |     -   Default settings for Soil Texture Triangle Plots                |
-# |     -   Capable of displaying 4 FAMILIES/TYPES of ternary plots         |
-# |         (1) Equilateral with clockwise axis                             |
-# |         (2) Equilateral with counter-clockwise axis                     |
-# |         (3) Right-triangle, with right-side 90deg angle, base side      |
-# |             counter-clockwise and right side clockwise                  |
-# |         (4) Right-triangle, with left-side 90deg angle, base side       |
-# |             clockwise and right left counter-clockwise                  |
-# |     -   For all families, triangle internal angles fully customizable,  |
-# |         a fancy feature for creating free form ternary plot             |
-# |     -   Free variable sum (1, 100 or X) for the ternary plot;           |
-# | -   Display variable-classes polygons/area on the ternary plot;         |
-# |     -   7 pre-parameterized national Soil Texture Triangles/Classes     |
-# |         systems, including classes polygons, classes and axis names,    |
-# |         and geometric settings of the triangle.                         |
-# |         (EU, USDA, French-Aisne, French-GEPPA, German, UK and          |
-# |         Australian triangles)                                           |
-# |     -   Capable of projecting any Soil Texture Triangles/Classes systems|
-# |         in another family of ternary plot (custom angles and clock),    |
-# |         thus enabling otherwise difficult comparisons of systems        |
-# | -   Retrieve the class(es) of point data in a given (Soil Texture)-     |
-# |     class system (pre-defined)                                          |
-# | -   Several features for exploratory/visual analysis                    |
-# |     -   Create a background 2d map of a 4th variable (heat-map),        |
-# |         through inverse weighted distance grid-interpolation            |
-# | -   Global (and triangle-specific) parameters management system, with   |
-# |     functions for easily retrieving and changing these options          |
-# | -   Simple pre-defined Bubble & color-gradient plot for a 4th variable  |
-# | -   Linguistic components ('local' variable names)                      |
-# | -   A generic function for checking "sum of variable triplets"          |
-# | -   'geo' global and triangle specific option, that is outputted either |
-# |     from TT.plot() or TT.frame() and is used by lower level plotting    |
-# |     functions: frame, grid, arrows, points...                           |
-# |     (Parameters: tlr.an, blr.clock, blr.tx, text.sum, etc)              |
-# |                                                                         |
-# +-------------------------------------------------------------------------+
 
-
-
-# +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
-# | LOAD REQUIRED PACKAGES: sp, drc, lattice, magic, nlme, plotrix           |
-# +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
-
-
-
-# sp package is required for his pointinpolygon() function 
-#   it is used here to determine is a data-point belong to a class-polygon (Soil Texture Class) 
-
-# drc package is required for his drm() function 
-#   it is used here fitting the Particle-size Distribution modes. 
-
-# lattice, magic, nlme and plotrix package is required by drc 
-
-# if( !"sp" %in% as.character( installed.packages()[,1] ) )
-# {   #
-#     install.packages("sp")
-# }   #
-
-# if( !"drc" %in% as.character( installed.packages()[,1] ) )
-# {   #
-#     install.packages("drc")
-# }   #
-
- 
-# if( !"lattice" %in% as.character( installed.packages()[,1] ) )
-# {   #
-#     install.packages("lattice")
-# }   #
-#    
-# if( !"lattice" %in% as.character( installed.packages()[,1] ) )
-# {   #
-#     install.packages("magic")
-# }   #
-#    
-# if( !"lattice" %in% as.character( installed.packages()[,1] ) )
-# {   #
-#     install.packages("nlme")
-# }   #
-#    
-# if( !"lattice" %in% as.character( installed.packages()[,1] ) )
-# {   #
-#     install.packages("plotrix")
-# }   #
-
-# require( "sp" )
-# require( "drc" )
-# require( "drc" )
-# require( "lattice" )
-# require( "magic" )
-# require( "nlme" )
-# require( "plotrix" )
-
-
-
-
-
-
 # Environment for storing, hiding and protecting internal variables and functions.
 TT.env <- new.env() 
 
@@ -1810,6 +1656,7 @@
 
 TT.str <- function(# Internal. Stretch or reshape the range of value of some data set. 
 ### Function to 'stretch' or reshape the range of value of some data set. Usefull for cex parameter in plot. 
+##keywords<< internal
 
     x, 
     str.min = 0, 
@@ -1866,6 +1713,7 @@
 
 TT.gen.op.set  <- function(# Internal. Retrieve and set default values from options. 
 ### Retrieve and set default values from options (that do _not_ superseed par()). 
+##keywords<< internal
 
     param, 
     assign.op   = TRUE, 
@@ -1935,6 +1783,7 @@
 
 TT.par.op.set  <- function(# Internal. Retrieve and set default values from options with default in "par()". 
 ### Retrieve and set default values from options with default in "par()"
+##keywords<< internal
 
     param, 
     assign.op   = TRUE, 
@@ -1999,6 +1848,7 @@
 
 TT.auto.set    <- function(# Internal. Retrieve and set default values for parameters (par() or not), when NULL.
 ### Retrieve and set default values for parameters (par() or not), when NULL.
+##keywords<< internal
 
     fun         = sys.function(which=-1), 
     assign.op   = TRUE, 
@@ -2091,8 +1941,9 @@
 
 
 
-TT.DJ.col <- function(# A function to obtaine a weight average 'mix' of different colors!
+TT.DJ.col <- function(# Internal. A function to obtaine a weight average 'mix' of different colors!
 ### A function to obtaine a weight average 'mix' of different colors!
+##keywords<< internal
 
     cl,             # vector of colors, html stype "#808080"
     w,              # vector of weight corresponding to the colors
@@ -2122,8 +1973,9 @@
 
 
 
-TT.col2hsv  <- function(# Convert any colors to hsv. 
+TT.col2hsv  <- function(# Internal. Convert any colors to hsv. 
 ### Convert any colors to hsv. Wrapper around rgb2hsv() and col2rgb(). 
+##keywords<< internal
 
     col 
 ){  #
@@ -2147,6 +1999,7 @@
 TT.blr.tx.check <- function(# Internal. Check the consistency between blr.tx and css.names. 
 ### Check the consistency between blr.tx and css.names. All values 
 ### in blr.tx should be found in css.names and vice-versa.
+##keywords<< internal
 
     blr.tx, 
     css.names  
@@ -2184,6 +2037,7 @@
 
 TT.blr.ps.lim <- function(# Internal. Create a tabular version of clay silt sand particle size limits. 
 ### Create a tabular version of clay silt sand particle size limits. 
+##keywords<< internal
 
     blr.tx, 
     css.ps.lim  
@@ -2218,6 +2072,7 @@
 
 TT.geo.set  <- function(# Internal. Takes "geo" values and assign them individually in the parent function. 
 ### Takes "geo" values and assign them individually in the parent function. 
+##keywords<< internal
 
     geo, 
     p.env   = parent.frame()  
@@ -2319,6 +2174,7 @@
 
 TT.geo.get  <- function(# Internal. Retrieve and return the geometrical parameters from a list of parameter values (NULL or not).
 ### Retrieve and return the geometrical parameters from a list of parameter values (NULL or not).
+##keywords<< internal
 
     class.sys       = NULL,  
     blr.clock       = NULL,  
@@ -2571,9 +2427,10 @@
 
 
 
-TT.dia2phi <- function(# Convert a soil particle diameter dia [micro-meters] into phi = -log2(dia/1000)
+TT.dia2phi <- function(# Internal. Convert a soil particle diameter dia [micro-meters] into phi = -log2(dia/1000)
 ### Convert a soil particle diameter dia [micro-meters] into 
 ### phi = -log2(dia). See also TT.phi2dia().
+##keywords<< internal
 
  dia
 ### Particle size diameter in micro-meters (will be converted in milli-meters)
@@ -2587,9 +2444,10 @@
 
 
 
-TT.phi2dia <- function(# Convert a soil particle phi value into diameter dia [micro-meters]. 
+TT.phi2dia <- function(# Internal. Convert a soil particle phi value into diameter dia [micro-meters]. 
 ### Convert a soil particle phi value into diameter dia [micro-meters]. 
 ### See also TT.dia2phi(). dia = (2^-phi)*1000. Not used by the package. 
+##keywords<< internal
 
 phi
 
@@ -2605,10 +2463,11 @@
 TT.check.ps.lim <- function(# Internal. Check the consistency between 'base.ps.lim' and 'dat.ps.lim'. 
 ### Check the consistency between 'base.ps.lim' and 'dat.ps.lim'. 
 ### 5 tests performed.
+##keywords<< internal
 
     base.ps.lim,  
     dat.ps.lim,  
- ps.lim.length=c(4,4)
+    ps.lim.length=c(4,4)
 ### vector of 2 integers. Number of particle size classes + 1. c(base,dat)
 
 ){  #
@@ -2974,8 +2833,9 @@
 
 
 
-TT.deg2rad <- function(# Function to convert angle in degree to angle in radian.
+TT.deg2rad <- function(# Internal. Function to convert angle in degree to angle in radian.
 ### Function to convert angle in degree to angle in radian.
+##keywords<< internal
 
  A
 ### Angle in Degrees
@@ -2991,6 +2851,7 @@
 
 TT.ifelse <- function(# Internal. Flexible version of ifelse. 
 ### Flexible version of ifelse. 
+##keywords<< internal
 
  test,
  yes,
@@ -3008,6 +2869,7 @@
 
 TT.switch <- function(# Internal. Used in the plot axis drawings.
 ### Used in the plot axis drawings.
+##keywords<< internal
 
     blr.clock   = TT.get("blr.clock"), 
     c1          = NA, 
@@ -3036,9 +2898,10 @@
 
 
 
-TT.css2xy <- function(# Converts texture data (3 classes) into x-y coordinates. 
+TT.css2xy <- function(# Internal. Converts texture data (3 classes) into x-y coordinates. 
 ### Converts texture data (3 classes) into x-y coordinates. This 
 ### function is the 'heart' of most soiltexture plot functions.
+##keywords<< internal
 
     tri.data, 
     geo, 
@@ -3452,6 +3315,7 @@
 ### Create an empty plot where a texture triangle can be drawn with 
 ### other secondary functions (frame, axis, ...). Also return the 
 ### 'geo' parameters needed by these secondary functions.
+##keywords<< internal
 
     geo             = NULL, 
     class.sys       = "none",  
@@ -3641,6 +3505,7 @@
 ### Plot the edges (bare axis) of a soil texture triangle. This 
 ### is not a primary plot function, TT.baseplot() must have been 
 ### called before (usually inside TT.plot()).
+##keywords<< internal
 
     geo, 
     #
@@ -3964,6 +3829,7 @@
 
 TT.ticks <- function(# Internal. Plot the axis' ticks of a texture triangle plot. 
 ### Plot the axis' ticks of a texture triangle plot. 
+##keywords<< internal
 
     geo, 
     at          = NULL, 
@@ -4044,6 +3910,7 @@
 
 TT.ticks.lab <- function(# Internal. Plot the axis ticks' labels of a texture triangle plot. 
 ### Plot the axis ticks' labels of a texture triangle plot. 
+##keywords<< internal
 
     geo, 
     at          = NULL, 
@@ -4135,6 +4002,7 @@
 
 TT.axis.arrows <- function(# Internal. Plot the axis' arrows of a texture triangle plot. 
 ### Plot the axis' arrows of a texture triangle plot. 
+##keywords<< internal
 
     geo, 
     #css.names       = NULL, 
@@ -4663,11 +4531,12 @@
 
 
 
-TT.vertices.plot <- function(# Plot the vertices of a texture classification system. 
+TT.vertices.plot <- function(# Internal. Plot the vertices of a texture classification system. 
 ### Plot the vertices of a texture classification system, on top 
 ### of an already drawn texture triangle plot. Also plot the 
 ### vertices numbers. See TT.vertices.tbl() and TT.classes.tbl() 
 ### for a non graphic, tabular equivalent of the plot.
+##keywords<< internal
 
     geo, 
     class.sys   = "HYPRES.TT", 
@@ -4725,7 +4594,7 @@
 
 
 
-TT.polygon.area <- function(# Determines the area of 1 polygon (in x-y coordinates). 
+TT.polygon.area <- function(# Internal. Determines the area of 1 polygon (in x-y coordinates). 
 ### Determines the area of 1 non-intersecting polygon (in x-y 
 ### coordinates). Used by TT.polygon.centroids(). pol.x[1]:pol.y[1] 
 ### is supposed different from pol.x[n]:pol.y[n] (i.e. the polygon 
@@ -4733,6 +4602,7 @@
 ### After "http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/
 ### Calculating The Area And Centroid Of A Polygon. Written by 
 ### Paul Bourke, July 1988".
+##keywords<< internal
 
  pol.x,
 ### Vector of numericals. X coordinates of each vertices of the 
@@ -4761,7 +4631,7 @@
 
 
 
-TT.polygon.centroids <- function(# Determines the centroid of 1 polygon (in x-y coordinates). 
+TT.polygon.centroids <- function(# Internal. Determines the centroid of 1 polygon (in x-y coordinates). 
 ### Determines the centroid of 1 non-intersecting polygon (in x-y 
 ### coordinates). Used to determine the centroid of each texture 
 ### class in the texture triangle onces its clay silt sand 
@@ -4771,6 +4641,7 @@
 ### After "http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/ 
 ### Calculating The Area And Centroid Of A Polygon. Written by 
 ### Paul Bourke, July 1988".
+##keywords<< internal
 
  pol.x,
 ### Vector of numericals. X coordinates of each vertices of the 
@@ -6648,6 +6519,8 @@
 ### Create a grid in the x-y coordinate system. Most of the function 
 ### is a reshaped extract from kde2d() from the MASS package, by 
 ### Venables & Ripley (+ modifications)
+##keywords<< internal
+
     x,  
     y,  
     n   = 25  

Added: pkg/soiltexture/R/soiltexture_text_gui.R
===================================================================
--- pkg/soiltexture/R/soiltexture_text_gui.R	                        (rev 0)
+++ pkg/soiltexture/R/soiltexture_text_gui.R	2015-04-14 09:39:24 UTC (rev 123)
@@ -0,0 +1,690 @@
+
+# .select.list2 
+# ==========================================================
+
+.select.list2 <- function( # Wrapper around 'menu' with error handling
+### Wrapper around 'menu' with error handling
+
+##seealso<< \code{\link[utils]{select.list}}, on which 
+##  \code{.select.list2} is based.
+
+##keywords<< internal 
+
+    title = NULL, 
+###  See \code{\link[utils]{select.list}}.
+
+    choices, 
+###  See \code{\link[utils]{select.list}}.
+
+    graphics = FALSE, 
+###  See \code{\link[utils]{select.list}}.
+
+    preselect = NULL, 
+###  See \code{\link[utils]{select.list}}.
+
+    error = "You haven't chosen anything", 
+###  Single character string. Error message to be displayed if 
+###  the user does not chose any item (code 0).
+
+    multi = FALSE
+###  Single logical. If \code{TRUE}, then multiple choices are 
+###  allowed.
+){  
+    #   Index of choices
+    choicesNum <- 1:length(choices) 
+    
+    #   Label choice index
+    names( choicesNum ) <- choices 
+    
+    # library( "utils" )
+    
+    mRes <- select.list( 
+        title       = title,
+        choices     = choices, 
+        preselect   = preselect, 
+        multiple    = multi, 
+        graphics    = graphics 
+    )   
+    
+    ## Error handling:
+    if( length(mRes) == 0 ){ 
+        stop( error ) 
+    }   
+    
+    mRes <- choicesNum[ mRes ] 
+    names( mRes ) <- NULL 
+    
+    if( any( is.na( mRes ) ) ){ 
+        stop( "Wrong value(s) chosen" )
+    }   
+    
+    return( mRes ) 
+###  The \bold{index} of the user's choice (index from 
+###  \code{choices}).
+}   
+
+    # .select.list2(
+        # title     = "Please chose", 
+        # choices   = c( "A", "B" ) 
+    # )   
+
+
+
+# .chooseTextFiles
+# ==========================================================
+
+.chooseTextFiles <- function( # Pop-up a menu to choose one or several text file(s) from the file system.
+### Pop-up a menu to choose one or several text file(s) from the file system.
+
+##keywords<< internal 
+
+    caption = "Select a text file", 
+###   See \code{\link[utils]{choose.files}} or 
+###   \code{\link[tcltk]{tk_choose.files}}.
+
+    multi   = FALSE 
+###   See \code{\link[utils]{choose.files}} or 
+###   \code{\link[tcltk]{tk_choose.files}}.
+
+){  
+    if( !interactive() ){ 
+        stop( "'.chooseTextFiles' can only be used in interactive mode" )
+    }   
+    
+    
+    ## Create a template of file extension to be read:
+    filterz <- matrix( 
+        data  = c( 
+            "Text file (*.txt)", "*.txt", 
+            "CSV file (*.csv)", "*.csv" ), 
+        nrow  = 2, 
+        ncol  = 2, 
+        byrow = TRUE  
+    )   
+    rownames( filterz ) <- c( "txt", "csv" ) 
+    
+    ## Pop-up a menu to choose the bin file to be 
+    ## imported
+    if( exists( "choose.files", where = "package:utils" ) ){ 
+        # fun <- get( "choose.files" ) 
+        
+        .file <- utils::choose.files(
+            # default = "", # , "*.bin"
+            caption = caption, 
+            multi   = multi, 
+            filters = filterz 
+        )   
+        
+    }else{ 
+        .file <-tcltk::tk_choose.files(
+            # default = "", # , "*.bin"
+            caption = caption, 
+            multi   = multi, 
+            filters = filterz 
+        )   
+    }   
+    
+    if( length( .file ) == 0 ){ 
+        stop( "No file was chosen" ) 
+    }   
+    
+    return( .file ) 
+### Returns the full path to the selected file.
+}   
+
+
+
+# .read.table.menu
+# ==========================================================
+
+.read.table.menu <- function( # Text-based menu for importing a text table (typically a CSV file)
+### Text-based menu for importing a text table (typically a 
+###  CSV file).
+
+##keywords<< internal 
+
+    graphics = FALSE, 
+###  See \code{\link[utils]{select.list}}.
+
+    stringsAsFactors = FALSE,
+###  See \code{\link{read.table}}.
+    
+    ... 
+###  Additional parameters passed to 
+### \code{\link[utils]{read.table}}.
+
+){  
+    message( "==== Select the file to import ====" ) 
+    # ==============================================
+    
+    message( "* Provide a text file (.txt or csv) containing soil texture data" ) 
+    message( "* This must be a text file containing tabular data" ) 
+    message( "* The file *must* contain the following headers: CLAY, SILT, SAND" ) 
+    message( "* The column order does not matter, and other variables can be present" ) 
+    
+    f <- .chooseTextFiles(
+        caption  = "* Select a text file with soil texture data", 
+        multi    = FALSE  
+    )   
+    
+    
+    
+    message( "==== File format ====" ) 
+    # ================================
+    
+    #   Field separator character
+    sep <- c( 
+        "Comma (,)"           = ",", 
+        "Semi-colon (;)"      = ";", 
+        "Tabulation (\t)"     = "\t", 
+        "Single space ( )"    = " ", 
+        "Multiple space (  )" = "" 
+    )   
+    
+    sep <- sep[ .select.list2(
+        title     = "* Choose the field/column separator character", 
+        choices   = names( sep ), 
+        graphics  = graphics, 
+        preselect = names( sep )[ 1L ], 
+        error     = "You haven't chosen anything", 
+        multi     = FALSE
+    ) ] 
+    
+    
+    #   'decimal points' character
+    dec <- c( 
+        "Dot (.)"    = ".", 
+        "Comma  (,)" = ","  
+    )   
+    
+    dec <- dec[ .select.list2(
+        title     = "* Choose the 'decimal points' character", 
+        choices   = names( dec ), 
+        graphics  = graphics, 
+        preselect = names( dec )[ 1L ], 
+        error     = "You haven't chosen anything", 
+        multi     = FALSE
+    ) ] 
+    
+    
+    #   'decimal points' character
+    fileEncoding <- c( 
+        "Internal (current locale)" = "native.enc", 
+        "UTF-8"                     = "UTF-8"  
+    )   
+    
+    fileEncoding <- fileEncoding[ .select.list2(
+        title     = "* Choose the encoding of the file", 
+        choices   = names( fileEncoding ), 
+        graphics  = graphics, 
+        preselect = names( fileEncoding )[ 1L ], 
+        error     = "You haven't chosen anything", 
+        multi     = FALSE
+    ) ] 
+    
+    
+    message( "==== Importing the file ====" ) 
+    # =======================================
+    
+    message( sprintf( "* File: %s", f ) ) 
+    
+    dat <- read.table( file = f, sep = sep, dec = dec, 
+        stringsAsFactors = stringsAsFactors, 
+        fileEncoding = fileEncoding, header = TRUE )
+    
+    message( sprintf( "* Dimensions: %s columns, %s rows", 
+        ncol(dat), nrow(dat) ) )  
+    
+    message( sprintf( "* Columns: %s", 
+        paste( colnames( dat ), collapse = "," ) ) )  
+    
+    
+    #   Save attributes
+    attr( x = dat, which = "sep" ) <- sep 
+    attr( x = dat, which = "dec" ) <- dec 
+    attr( x = dat, which = "fileEncoding" ) <- fileEncoding 
+    
+    return( dat ) 
+###  A \code{\link{data.frame}} with the imported soil texture 
+###  data (column names \code{CLAY}, \code{SILT} and \code{SAND}, 
+###  along with any additional column present in the file 
+###  imported).
+}   
+
+# library( "soiltexture" )
+# .read.table.menu()
+
+
+
+# soiltexture_gui
+# ==========================================================
+
+soiltexture_gui <- function( # Text-based menu for plotting and classifying soil texture data
+### Text-based menu for plotting and classifying soil texture 
+### data. 
+### 
+### If you simply want to obtain a figure with an 
+### empty soil texture triangle, just call 
+### \code{soiltexture_gui}() and follow the instructions.
+### 
+### If you want to a figure with your own soil texture data 
+### on top of a texture triangle, you must first prepare 
+### a tabular text file containing your texture data, as 
+### \code{.txt} or \code{.csv}. Such a file can be prepared 
+### with \code{MS Excel} or \code{Libre Office}, and exported 
+### as CSV ("CSV (comma delimited) (*.csv)" or "CSV (MS-DOS) 
+### (*.csv)" for example). The table \bold{must} contain 
+### headers (column names) and it \bold{must} the following 
+### columns and headers: \code{CLAY}, \code{SILT} and 
+### \code{SAND}. Other columns are allowed and will be ignored. 
+### In the texture data file, each row represent a record 
+### (a sample) and each column a variable.
+### 
+### You will be asked about the format of this text file, in 
+### particular about the field / column separator (it can be 
+### commas, semi-colons, tabulations or (multiple) spaces) 
+### and the decimal mark (comma or dot). The file encoding 
+### can be either the native encoding of the computer, or 
+### UTF-8 (without BOM).
+### 
+### The sum of the texture of each row must be either 1 (if 
+### expressed as a fraction) or 100 (if expressed as a 
+### percentage). You will be asked about the unit. Only small 
+### divergences from 1 or 100 are allowed, but you will be 
+### asked if you want to normalise your data beforehand, so 
+### larger divergences are possible.
+###
+### You will also be asked which texture classification system 
+### you want to use (FAO, USDA, etc.). It is possible to 
+### plot a texture triangle without texture classification.
+### 
+### Finally, if you have chosen a texture classification system, 
+### \code{soiltexture_gui} can classify each record according 
+### to this classification system and \bold{return you the 
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/soiltexture -r 123


More information about the Soiltexture-commits mailing list