### Alternative Method to Start soiltexture GUI Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md An alternative way to initiate the soiltexture GUI by first loading the library and then calling the function. This requires the soiltexture package to be installed. ```r library( "soiltexture" ) soiltexture_gui() ``` -------------------------------- ### Start Text-Based GUI for soiltexture Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md Launch the text-based graphical user interface for the soiltexture package after installation. This GUI assists in importing, visualizing, and classifying soil texture data. ```r soiltexture::soiltexture_gui() ``` -------------------------------- ### Install soiltexture from GitHub Source: https://github.com/julienmoeys/soiltexture/blob/master/README.md Install the latest development version of the soiltexture package directly from GitHub using the devtools package. Ensure Rtools is installed on Windows. ```r devtools::install_github("julienmoeys/soiltexture/pkg/soiltexture") ``` -------------------------------- ### Load soiltexture Package Sources Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index_old.html If standard installation methods fail, you can attempt to load the package sources directly. Note that this method does not install the help pages. ```r source( "https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/soiltexture/R/soiltexture.R?root=soiltexture" ) ``` -------------------------------- ### Install soiltexture Package Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.html Use devtools to install the soiltexture package from GitHub. This is the primary method for obtaining the package. ```R devtools::install_github("rforge/soiltexture/pkg/soiltexture") ``` -------------------------------- ### Install soiltexture R Package Source: https://context7.com/julienmoeys/soiltexture/llms.txt Installs the stable release from CRAN or the development version from GitHub. Requires the devtools package for GitHub installation. ```r install.packages("soiltexture") ``` ```r install.packages("devtools") devtools::install_github("julienmoeys/soiltexture/pkg/soiltexture") ``` ```r library("soiltexture") help(pack = "soiltexture") ``` -------------------------------- ### Load and Launch Text-Based GUI Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.html An alternative method to launch the text-based GUI by first loading the soiltexture library. This is useful if the package is already installed and loaded. ```R library( "soiltexture" ) ssoiltexture_gui() ``` -------------------------------- ### Install soiltexture using devtools Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md Use devtools to install the soiltexture package and its transformation counterpart from GitHub. Ensure R is open before running these commands. ```r devtools::install_github("rforge/soiltexture/pkg/soiltexture") ``` ```r devtools::install_github("rforge/soiltexture/pkg/soiltexturetransformation") ``` -------------------------------- ### Get Help for soiltexture_gui (Shorthand) Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.html A shorthand method to access the help documentation for the soiltexture_gui function using the question mark operator. ```R ?soiltexture_gui ``` -------------------------------- ### Install soiltexture from CRAN Source: https://github.com/julienmoeys/soiltexture/blob/master/README.md Use this command to install the latest official release of the soiltexture package from CRAN. After installation, load the package and access its help documentation. ```r install.packages("soiltexture") library("soiltexture") help(pack='soiltexture') ``` -------------------------------- ### Install devtools package Source: https://github.com/julienmoeys/soiltexture/blob/master/README.md Before installing the development version of soiltexture from GitHub, you need to install the 'devtools' package. This command installs 'devtools' from CRAN. ```r install.packages("devtools") ``` -------------------------------- ### Install soiltexturetransformation Package Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.html Install the companion soiltexturetransformation package from GitHub. Note that this package may have compilation issues due to external dependencies. ```R devtools::install_github("rforge/soiltexture/pkg/soiltexturetransformation") ``` -------------------------------- ### Install soiltexture (Stable Release) Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md Use this command to install the latest stable version of the soiltexture package from CRAN. Ensure you have R installed. ```r install.packages( "soiltexture" ) ``` -------------------------------- ### Install soiltexture Package from R-Forge Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index_old.html If the CRAN installation fails or if you are using an older R version, try installing from the R-Forge repository. ```r install.packages("soiltexture", repos = "http://R-Forge.R-project.org") ``` -------------------------------- ### Get Help for soiltexture_gui Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.html Access the help documentation for the soiltexture_gui function. This provides detailed information on its usage and parameters. ```R help( "soiltexture_gui" ) ``` -------------------------------- ### Get Help for soiltexture_gui Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md Access the help documentation for the soiltexture_gui function to understand its usage and parameters. This can be done using either the help() function or the shorthand '?' operator. ```r help( "soiltexture_gui" ) ``` ```r ?soiltexture_gui ``` -------------------------------- ### Install soiltexture Package from R-Forge (Source) Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index_old.html As an alternative for R-Forge installation, specify the type as 'source'. This may be necessary on certain systems. ```r install.packages("soiltexture", repos = "http://R-Forge.R-project.org", type = "source") ``` -------------------------------- ### Install soiltexture Package from CRAN Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index_old.html Use this command to install the soiltexture package from the Comprehensive R Archive Network (CRAN). ```r install.packages("soiltexture") ``` -------------------------------- ### Install soiltexture (Development Version from R-Forge) Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md Install the development version of soiltexture from R-Forge. This requires the latest stable version of R and may need checking the build status on the R-Forge page. ```r install.packages("soiltexture", repos="http://R-Forge.R-project.org") ``` -------------------------------- ### Load soiltexture Package in R Source: https://github.com/julienmoeys/soiltexture/blob/master/www/FAQ.md Loads the soiltexture package. Ensure the package is installed before loading. ```r library( "soiltexture" ) ``` -------------------------------- ### soiltexture_gui Source: https://context7.com/julienmoeys/soiltexture/llms.txt Launches an interactive text-menu that guides the user step-by-step through loading a CSV/TXT texture file, selecting a classification system, normalizing data, generating and exporting a PNG figure, and optionally writing texture class assignments back to a CSV file. No R coding experience required. ```APIDOC ## soiltexture_gui — Interactive text-based GUI Launches an interactive text-menu that guides the user step-by-step through loading a CSV/TXT texture file, selecting a classification system, normalizing data, generating and exporting a PNG figure, and optionally writing texture class assignments back to a CSV file. No R coding experience required. ```r library("soiltexture") # Launch the wizard — follow the on-screen prompts soiltexture_gui() # The wizard will ask: # 1. Do you want to plot a texture triangle? [yes/no] # 2. Do you want to import texture data? [yes/no] # -> if yes: path to your .csv / .txt file, # field separator (comma / semicolon / tab / space), # decimal mark (. or ,), # file encoding (native / UTF-8) # 3. Which texture classification system? [list of codes] # 4. Normalize data if sum ≠ 100? [yes/no] # 5. Export PNG figure? [yes/no, then width 512-2048px] # 6. Export texture classification as CSV? [yes/no] # Minimal CSV input format required by the GUI: # CLAY,SILT,SAND # 20,40,40 # 35,30,35 # 10,60,30 # You can also pass a main title upfront: soiltexture_gui(main = "My field samples — USDA classification") ``` ``` -------------------------------- ### Launch interactive GUI with soiltexture_gui Source: https://context7.com/julienmoeys/soiltexture/llms.txt Launches an interactive text-based menu for soil texture analysis, guiding users through data import, classification, figure export, and data export without requiring R coding. Can accept a main title argument. ```r library("soiltexture") # Launch the wizard — follow the on-screen prompts soiltexture_gui() # The wizard will ask: # 1. Do you want to plot a texture triangle? [yes/no] # 2. Do you want to import texture data? [yes/no] # -> if yes: path to your .csv / .txt file, # field separator (comma / semicolon / tab / space), # decimal mark (. or ,), # file encoding (native / UTF-8) # 3. Which texture classification system? [list of codes] # 4. Normalize data if sum ≠ 100? [yes/no] # 5. Export PNG figure? [yes/no, then width 512-2048px] # 6. Export texture classification as CSV? [yes/no] # Minimal CSV input format required by the GUI: # CLAY,SILT,SAND # 20,40,40 # 35,30,35 # 10,60,30 # You can also pass a main title upfront: soiltexture_gui(main = "My field samples — USDA classification") ``` -------------------------------- ### View soiltexture Package Vignette Source: https://github.com/julienmoeys/soiltexture/blob/master/www/index.md After installing the soiltexture package, use this command within R to access the comprehensive vignette, which serves as a tutorial. ```r vignette( "soiltexture_vignette" ) ``` -------------------------------- ### Initialize SoilTexture Plot Source: https://github.com/julienmoeys/soiltexture/blob/master/www/FAQ.md Calls the TT.plot function to initialize a soil texture plot. This is a basic usage example. ```r TT.plot() ``` -------------------------------- ### Inspect and Set Defaults with TT.get and TT.set Source: https://context7.com/julienmoeys/soiltexture/llms.txt Use TT.get to inspect current session-wide defaults for texture triangle plotting. TT.set can change these defaults for the current session or reset them to factory settings. ```r TT.get("class.sys") # "HYPRES.TT" (factory default) TT.get("lang") # "en" TT.get("cex") # 1.5 TT.get("cex.axis") # 1.5 ``` ```r TT.set( "class.sys" = "USDA.TT", # Change default triangle "lang" = "fr", # Default to French labels "cex" = 1, # Smaller symbol size "cex.axis" = 1, "cex.lab" = 1, "cex.main" = 1 ) ``` ```r # All subsequent TT.plot() calls now use USDA.TT with French labels by default TT.plot() # renders USDA.TT with French axis labels TT.plot(class.sys = "DE.BK94.TT") # overrides class.sys for this call only ``` ```r # Reset all parameters to factory defaults TT.set(reset = TRUE) TT.get("class.sys") # back to "HYPRES.TT" TT.get("lang") # back to "en" ``` -------------------------------- ### TT.set / TT.get Source: https://context7.com/julienmoeys/soiltexture/llms.txt Manages default package parameters for the soiltexture R package. `TT.set()` changes default arguments persistently for the R session, while `TT.get()` retrieves current defaults. `TT.set(reset = TRUE)` restores factory defaults. ```APIDOC ## TT.set / TT.get — Manage default package parameters `TT.set()` persistently changes default argument values for the entire R session (e.g., default classification system, font sizes, colors). `TT.get()` retrieves current defaults. `TT.set(reset = TRUE)` restores factory defaults. All `TT.plot()` arguments that are `NULL` by default are resolved from the internal `TT.par` list via these functions. ### Parameters for TT.set() - `reset` (logical) - If TRUE, restores factory defaults. Defaults to FALSE. - `...` - Named arguments to set as new defaults (e.g., `class.sys = "USDA.TT"`). ### Parameters for TT.get() - None. ### Request Example ```r library("soiltexture") # Get current defaults current.defaults <- TT.get() # Set a new default classification system TT.set(class.sys = "USDA.TT") # Reset all parameters to factory defaults TT.set(reset = TRUE) ``` ### Response - `TT.get()` returns a list of current default parameters. - `TT.set()` modifies the package's default parameters and returns `invisible(NULL)`. ``` -------------------------------- ### Kernel Density Estimation on Texture Triangle with TT.kde2d Source: https://context7.com/julienmoeys/soiltexture/llms.txt Compute 2D kernel density on the texture triangle's x-y coordinate space using TT.kde2d, which wraps MASS::kde2d. The result is suitable for TT.image() or TT.contour(). ```r library("soiltexture") rand.text <- TT.dataset(n = 200, seed.val = 42) # Step 1: create the base triangle and capture its geometry geo <- TT.plot( class.sys = "USDA.TT", tri.data = rand.text, main = "Kernel density of soil texture samples" ) ``` ```r # Step 2: compute 2D kernel density on the triangle's x-y grid kd <- TT.kde2d( geo = geo, tri.data = rand.text, n = 25 ) # Returns list: $x (grid x), $y (grid y), $z (density matrix 25x25) ``` ```r # Step 3: overlay as a filled image TT.image( geo = geo, x = kd, add = TRUE, col = rev(heat.colors(12)) ) ``` ```r # Or overlay as contour lines TT.contour( geo = geo, x = kd, add = TRUE, nlevels = 8, col = "blue" ) ``` -------------------------------- ### Add and Plot Custom Texture Triangle Source: https://github.com/julienmoeys/soiltexture/blob/master/FAQ.md Add a custom texture triangle definition to the package and then plot it. The added triangle is only available for the current R session. ```R soiltexture::TT.add( "HYPRES2.TT" = hypres ) soltexture::TT.plot( class.sys = "HYPRES2.TT" ) ``` -------------------------------- ### Highlight.js Syntax Highlighting Styles Source: https://github.com/julienmoeys/soiltexture/blob/master/www/FAQ.html These CSS rules define the visual appearance for different elements during syntax highlighting, such as operators, comments, and strings. ```css pre .operator, pre .paren { color: rgb(104, 118, 135) } pre .literal { color: #990073 } pre .number { color: #099; } pre .comment { color: #998; font-style: italic } pre .keyword { color: #900; font-weight: bold } pre .identifier { color: rgb(0, 0, 0); } pre .string { color: #d14; } ``` -------------------------------- ### Create and Plot Soil Texture with OC Bubble Plot Source: https://github.com/julienmoeys/soiltexture/blob/master/FAQ.md Generates a soil texture triangle with an overlaid bubble plot representing Organic Carbon (OC) content. Includes data preparation and legend customization. ```R my.text <- data.frame( "CLAY" = c(05,60,15,05,25,05,25,45,65,75,13,47), "SILT" = c(05,08,15,25,55,85,65,45,15,15,17,43), "SAND" = c(90,32,70,70,20,10,10,10,20,10,70,10), "OC" = c(20,14,15,05,12,15,07,21,25,30,05,28) ) TT.plot( class.sys = "none", tri.data = my.text, z.name = "OC", main = "Soil texture triangle and OC bubble plot" ) # Recompute some internal values: z.cex.range <- TT.get("z.cex.range") def.pch <- par("pch") def.col <- par("col") def.cex <- TT.get("cex") oc.str <- TT.str( my.text[,"OC"], z.cex.range[1], z.cex.range[2] ) # The legend: legend( x = "topright", # y = 100, title = expression( bold('OC [g.kg'^-1 ~ ']') ), legend = formatC( c( min( my.text[,"OC"] ), quantile(my.text[,"OC"] ,probs=c(25,50,75)/100), max( my.text[,"OC"] ) ), format = "f", digits = 1, width = 4, flag = "0" ), pt.lwd = 4, col = def.col, pt.cex = c( min( oc.str ), quantile(oc.str ,probs=c(25,50,75)/100), max( oc.str ) ), pch = def.pch, bty = "o", bg = NA, box.col = NA, text.col = "black", cex = def.cex, y.intersp = 1.5, x.intersp = 1.5 ) # Reset all parameters TT.set(reset=TRUE) ``` -------------------------------- ### Manage Default Package Parameters with TT.set and TT.get Source: https://context7.com/julienmoeys/soiltexture/llms.txt TT.set() persistently changes default argument values for the R session, such as classification system or colors. TT.get() retrieves current defaults. TT.set(reset = TRUE) restores factory defaults. These functions resolve NULL arguments in TT.plot() from the internal TT.par list. ```r library("soiltexture") ``` -------------------------------- ### Overwrite or Reset Texture Triangle Definitions Source: https://github.com/julienmoeys/soiltexture/blob/master/FAQ.md Demonstrates how to overwrite an existing custom texture triangle definition using TT.set() or reset all package parameters using TT.set(reset=TRUE). ```R soiltexture::TT.set( "HYPRES2.TT" = hypres ) soiltexture::TT.set(reset=TRUE) ``` -------------------------------- ### Generate Synthetic Correlated Texture Data with TT.dataset Source: https://context7.com/julienmoeys/soiltexture/llms.txt Generate a random dataset of soil texture samples with an embedded cross-correlated 4th variable 'Z'. Use 'seed.val' for reproducible results. This is useful for testing and demonstrations. ```r library("soiltexture") # Generate 100 random texture samples with a correlated 4th variable rand.text <- TT.dataset(n = 100, seed.val = 1980042401) head(rand.text) # CLAY SILT SAND Z # 1 23.45678 34.12345 42.42977 15.23456 # ... ``` ```r # Use for a bubble plot TT.plot( class.sys = "USDA.TT", tri.data = rand.text, z.name = "Z", main = "Bubble plot: Z variable on USDA triangle" ) ``` ```r # Vary size; no seed for different result each time rand.large <- TT.dataset(n = 500) TT.plot( class.sys = "none", tri.data = rand.large, z.name = "Z", main = "500 random samples" ) ``` -------------------------------- ### Classify Soil Texture Samples with TT.points.in.classes Source: https://context7.com/julienmoeys/soiltexture/llms.txt Classifies soil texture samples into specified classes using different systems like HYPRES.TT or USDA.TT. Can return numeric membership, logical values, or text class names. Handles samples on class boundaries by reporting all relevant classes. ```r library("soiltexture") my.text <- data.frame( "CLAY" = c(05, 60, 15, 05, 25), "SILT" = c(05, 08, 15, 25, 55), "SAND" = c(90, 32, 70, 70, 20) ) # --- Numeric membership matrix (0 = not in class, 1 = inside, 2 = edge) --- TT.points.in.classes( tri.data = my.text, class.sys = "HYPRES.TT" ) # Returns a data.frame with one column per HYPRES class (VF, F, M, MF, C) # --- Classify with USDA system --- TT.points.in.classes( tri.data = my.text, class.sys = "USDA.TT" ) # --- Logical membership (TRUE/FALSE) --- TT.points.in.classes( tri.data = my.text, class.sys = "HYPRES.TT", PiC.type = "l" ) # --- Return class name as text string per sample --- TT.points.in.classes( tri.data = my.text, class.sys = "HYPRES.TT", PiC.type = "t" ) # [1] "C" "VF" "C" "C" "M" # --- Custom separator for samples on class edges --- TT.points.in.classes( tri.data = my.text, class.sys = "HYPRES.TT", PiC.type = "t", collapse = ";" ) # Samples on an edge return e.g. "VF;F" # --- Cross-system classification (transform particle size limits first) --- TT.points.in.classes( tri.data = my.text, class.sys = "USDA.TT", css.transf = TRUE, dat.css.ps.lim = c(0, 2, 63, 2000), # source: ISO system (clay<2, silt 2-63 µm) base.css.ps.lim = c(0, 2, 50, 2000) # target: USDA system (clay<2, silt 2-50 µm) ) ``` -------------------------------- ### Highlighting C++ Code Source: https://github.com/julienmoeys/soiltexture/blob/master/www/FAQ.html Defines the language rules for C++ highlighting, including keywords, built-in types, and common STL containers. This is used by the highlighting engine to parse and color C++ code. ```javascript hljs.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1,restrict:1,_Bool:1,complex:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}};return{dM:{k:a,i:"",k:a,r:10,c:["self"]}]}}(); ``` -------------------------------- ### Highlight.js Core Functionality Source: https://github.com/julienmoeys/soiltexture/blob/master/www/FAQ.html This JavaScript code is part of the Highlight.js library, responsible for parsing and highlighting code blocks. It includes functions for escaping HTML, compiling language definitions, and rendering highlighted code. ```javascript var hljs=new function(){function m(p){return p.replace(/&/gm,"&").replace(/"}while(y.length||w.length){var v=u().splice(0,1)[0];z+=m(x.substr(q,v.offset-q));q=v.offset;if(v.event=="start"){z+=t(v.node);s.push(v.node)}else{if(v.event=="stop"){var p,r=s.length;do{r--;p=s[r];z+=("")}while(p!=v.node);s.splice(r,1);while(r'+M[0]+""}else{r+=M[0]}O=P.lR.lastIndex;M=P.lR.exec(L)}return r+L.substr(O,L.length-O)}function J(L,M){if(M.sL&&e[M.sL]){var r=d(M.sL,L);x+=r.keyword_count;return r.value}else{return F(L,M)}}function I(M,r){var L=M.cN?'':"";if(M.rB){y+=L;M.buffer=""}else{if(M.eB){y+=m(r)+L;M.buffer=""}else{y+=L;M.buffer=r}}D.push(M);A+=M.r}function G(N,M,Q){var R=D[D.length-1];if(Q){y+=J(R.buffer+N,R);return false}var P=q(M,R);if(P){y+=J(R.buffer+N,R);I(P,M);return P.rB}var L=v(D.length-1,M);if(L){var O=R.cN?"":"";if(R.rE){y+=J(R.buffer+N,R)+O}else{if(R.eE){y+=J(R.buffer+N,R)+O+m(M)}else{y+=J(R.buffer+N+M,R)+O}}while(L>1){O=D[D.le ``` -------------------------------- ### Register Custom Texture Triangles with TT.add Source: https://context7.com/julienmoeys/soiltexture/llms.txt Register a new texture triangle definition using TT.add, making it available for TT.plot and TT.points.in.classes. TT.set can overwrite existing definitions, and TT.set(reset = TRUE) removes custom triangles. ```r library("soiltexture") # Fetch an existing triangle to use as a template hypres <- soiltexture::TT.get("HYPRES.TT") # Inspect the structure str(hypres, max.level = 2) # List of 9: $main, $tt.points, $tt.polygons, $blr.clock, $tlr.an, # $blr.tx, $base.css.ps.lim, $tri.css.ps.lim, ... ``` ```r # Rename class labels from "VF","F","M","MF","C" to lowercase new.labels <- c("VF" = "vf", "F" = "f", "M" = "m", "MF" = "mf", "C" = "c") names(hypres[["tt.polygons"]]) <- new.labels[names(hypres[["tt.polygons"]])] hypres[["main"]] <- "Modified HYPRES triangle" ``` ```r # Register under a new name (available for the rest of the R session) TT.add("HYPRES2.TT" = hypres) # Use it TT.plot(class.sys = "HYPRES2.TT") TT.points.in.classes( tri.data = data.frame(CLAY = 20, SILT = 40, SAND = 40), class.sys = "HYPRES2.TT", PiC.type = "t" ) # [1] "m" ``` ```r # Overwrite an existing definition TT.set("HYPRES2.TT" = hypres) # Reset all (removes custom triangles added with TT.add) TT.set(reset = TRUE) ```