R Under development (unstable) (2024-02-15 r85925 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require( "soiltexture" ) Loading required package: soiltexture > > # Create a dummy data frame of soil textures: > 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) + ) # > > # Display the table: > my.text CLAY SILT SAND OC 1 5 5 90 20 2 60 8 32 14 3 15 15 70 15 4 5 25 70 5 5 25 55 20 12 6 5 85 10 15 7 25 65 10 7 8 45 45 10 21 9 65 15 20 25 10 75 15 10 30 11 13 17 70 5 12 47 43 10 28 > > # Classify according to the HYPRES / European Soil Map classification > TT.points.in.classes( + tri.data = my.text[1:5,], + class.sys = "HYPRES.TT" + ) # VF F M MF C [1,] 0 0 0 0 1 [2,] 2 2 0 0 0 [3,] 0 0 0 0 1 [4,] 0 0 0 0 1 [5,] 0 0 1 0 0 > > # Classify according to the USDA classification > TT.points.in.classes( + tri.data = my.text[1:5,], + class.sys = "USDA.TT" + ) # Cl SiCl SaCl ClLo SiClLo SaClLo Lo SiLo SaLo Si LoSa Sa [1,] 0 0 0 0 0 0 0 0 0 0 0 1 [2,] 1 0 0 0 0 0 0 0 0 0 0 0 [3,] 0 0 0 0 0 0 0 0 1 0 0 0 [4,] 0 0 0 0 0 0 0 0 1 0 0 0 [5,] 0 0 0 0 0 0 0 1 0 0 0 0 > > # Classify according to the HYPRES / European Soil Map classification, > # returns logical values > TT.points.in.classes( + tri.data = my.text[1:5,], + class.sys = "HYPRES.TT", + PiC.type = "l" + ) # VF F M MF C [1,] FALSE FALSE FALSE FALSE TRUE [2,] TRUE TRUE FALSE FALSE FALSE [3,] FALSE FALSE FALSE FALSE TRUE [4,] FALSE FALSE FALSE FALSE TRUE [5,] FALSE FALSE TRUE FALSE FALSE > > # Classify according to the HYPRES / European Soil Map classification, > # returns text > TT.points.in.classes( + tri.data = my.text[1:5,], + class.sys = "HYPRES.TT", + PiC.type = "t" + ) # [1] "C" "VF, F" "C" "C" "M" > > # Classify according to the HYPRES / European Soil Map classification, > # returns text, > # custom class separator in case of points belonging to > # several classes. > TT.points.in.classes( + tri.data = my.text[1:5,], + class.sys = "HYPRES.TT", + PiC.type = "t", + collapse = ";" + ) # [1] "C" "VF;F" "C" "C" "M" > > proc.time() user system elapsed 0.50 0.17 0.65