From noreply at r-forge.r-project.org Fri Mar 28 15:58:55 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 15:58:55 +0100 (CET) Subject: [Soiltexture-commits] r100 - in pkg/ternaryplot: . R inst/examples man tests Message-ID: <20140328145855.ABB1A1873F7@r-forge.r-project.org> Author: jmoeys Date: 2014-03-28 15:58:55 +0100 (Fri, 28 Mar 2014) New Revision: 100 Added: pkg/ternaryplot/R/aa00-ternaryplot-package.R pkg/ternaryplot/R/aa01-ternaryplot-options.R pkg/ternaryplot/R/aa02-ternaryplot-classes.R pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R pkg/ternaryplot/R/aa04-ternarysystems.R pkg/ternaryplot/R/aa05-ternarydata.R pkg/ternaryplot/R/aa06-ternary2xy.R pkg/ternaryplot/R/aa07-plotUtilities.R pkg/ternaryplot/R/functionsList.txt pkg/ternaryplot/R/ternarygrid.R pkg/ternaryplot/inst/examples/createTernaryGeometry-example.R pkg/ternaryplot/inst/examples/createTernarySystem-example.R pkg/ternaryplot/inst/examples/createTernaryVariables-example.R pkg/ternaryplot/inst/examples/ternaryPlot-example.R pkg/ternaryplot/man/blrLabels-methods.Rd pkg/ternaryplot/man/createTernaryGeometry.Rd pkg/ternaryplot/man/createTernaryGrid-methods.Rd pkg/ternaryplot/man/createTernaryVariables.Rd pkg/ternaryplot/man/getTernarySystem.Rd pkg/ternaryplot/man/listTernarySystem.Rd pkg/ternaryplot/man/ternary2SpatialPolygonsDataFrame-methods.Rd pkg/ternaryplot/man/ternary2xy-methods.Rd pkg/ternaryplot/man/ternaryCheck-methods.Rd pkg/ternaryplot/man/ternaryClockSwitch.Rd pkg/ternaryplot/man/ternaryData-methods.Rd pkg/ternaryplot/man/ternaryGeometry-methods.Rd pkg/ternaryplot/man/ternaryVariables-methods.Rd Removed: pkg/ternaryplot/R/aaa-ternaryplot-classes.R pkg/ternaryplot/R/ternarySystems.R pkg/ternaryplot/R/ternaryplot-options.R pkg/ternaryplot/R/ternaryplot-package.R pkg/ternaryplot/inst/examples/ternaryGeometry.R pkg/ternaryplot/inst/examples/ternarySystem.R pkg/ternaryplot/inst/examples/ternaryVariables.R pkg/ternaryplot/man/blr2xy-methods.Rd pkg/ternaryplot/man/ternaryDataTest-methods.Rd pkg/ternaryplot/man/ternaryGeometry-class.Rd pkg/ternaryplot/man/ternarySystemGet.Rd pkg/ternaryplot/man/ternarySystemList.Rd pkg/ternaryplot/man/ternaryVariables-class.Rd Modified: pkg/ternaryplot/DESCRIPTION pkg/ternaryplot/NAMESPACE pkg/ternaryplot/NEWS pkg/ternaryplot/R/onattach.R pkg/ternaryplot/R/ternaryplot.R pkg/ternaryplot/man/blrClock-methods.Rd pkg/ternaryplot/man/blrNames-methods.Rd pkg/ternaryplot/man/fracSum-methods.Rd pkg/ternaryplot/man/ternaryArrows-methods.Rd pkg/ternaryplot/man/ternaryAxisArrows-methods.Rd pkg/ternaryplot/man/ternaryAxisArrowsBase-methods.Rd pkg/ternaryplot/man/ternaryBox-methods.Rd pkg/ternaryplot/man/ternaryGrid-methods.Rd pkg/ternaryplot/man/ternaryGridBase-methods.Rd pkg/ternaryplot/man/ternaryLims-methods.Rd pkg/ternaryplot/man/ternaryPlot-methods.Rd pkg/ternaryplot/man/ternaryPoints-methods.Rd pkg/ternaryplot/man/ternarySegments-methods.Rd pkg/ternaryplot/man/ternarySystem-class.Rd pkg/ternaryplot/man/ternaryText-methods.Rd pkg/ternaryplot/man/ternaryTicks-methods.Rd pkg/ternaryplot/man/ternaryWindow-methods.Rd pkg/ternaryplot/man/ternaryplot-package.Rd pkg/ternaryplot/man/tlrAngles-methods.Rd pkg/ternaryplot/man/tpPar.Rd pkg/ternaryplot/tests/baseTests.R Log: Modified: pkg/ternaryplot/DESCRIPTION =================================================================== --- pkg/ternaryplot/DESCRIPTION 2014-01-15 13:04:01 UTC (rev 99) +++ pkg/ternaryplot/DESCRIPTION 2014-03-28 14:58:55 UTC (rev 100) @@ -1,11 +1,11 @@ Package: ternaryplot -Version: 0.1.2 -Date: 2014-01-15 +Version: 0.3.0 +Date: 2014-03-28 Title: Ternary plots and ternary classifications. Author: Julien MOEYS Maintainer: Julien MOEYS Description: Ternary plots and ternary classifications. License: AGPL-3 URL: http://www.slu.se/ckb -Depends: R (>= 3.0.2), methods -Suggests: +Depends: R (>= 3.0.2), sp +Imports: MASS Modified: pkg/ternaryplot/NAMESPACE =================================================================== --- pkg/ternaryplot/NAMESPACE 2014-01-15 13:04:01 UTC (rev 99) +++ pkg/ternaryplot/NAMESPACE 2014-03-28 14:58:55 UTC (rev 100) @@ -1,53 +1,102 @@ export("blrClock<-") +export("blrLabels<-") export("blrNames<-") export("fracSum<-") +export("ternaryGeometry<-") +export("ternaryVariables<-") export("tlrAngles<-") export(.ternaryAxisArrows) export(.ternaryAxisArrowsBase) +export(.ternaryClockSwitch) export(.ternaryGridBase) +export(.ternaryLims) export(.ternaryTicks) -export(blr2xy) export(blrClock) +export(blrLabels) export(blrNames) +export(createTernaryGeometry) +export(createTernaryGrid) +export(createTernaryVariables) +export(deg2rad) export(fracSum) +export(getTernarySystem) export(getTpPar) +export(listTernarySystem) +export(ternary2SpatialPolygonsDataFrame) +export(ternary2xy) export(ternaryArrows) export(ternaryBox) -export(ternaryDataTest) +export(ternaryCheck) +export(ternaryData) +export(ternaryGeometry) export(ternaryGrid) -export(ternaryLims) export(ternaryPlot) export(ternaryPoints) export(ternarySegments) -export(ternarySystemGet) -export(ternarySystemList) export(ternaryText) +export(ternaryVariables) export(ternaryWindow) export(tlrAngles) export(tpPar) -exportClasses(ternaryGeometry) exportClasses(ternarySystem) -exportClasses(ternaryVariables) -exportMethods("blrClock<-") -exportMethods("blrNames<-") -exportMethods("fracSum<-") -exportMethods("tlrAngles<-") -exportMethods(.ternaryAxisArrows) -exportMethods(.ternaryAxisArrowsBase) -exportMethods(.ternaryGridBase) -exportMethods(.ternaryTicks) -exportMethods(blr2xy) -exportMethods(blrClock) -exportMethods(blrNames) -exportMethods(fracSum) -exportMethods(ternaryArrows) -exportMethods(ternaryBox) -exportMethods(ternaryDataTest) -exportMethods(ternaryGrid) -exportMethods(ternaryLims) -exportMethods(ternaryPlot) -exportMethods(ternaryPoints) -exportMethods(ternarySegments) -exportMethods(ternaryText) -exportMethods(ternaryWindow) -exportMethods(tlrAngles) +importFrom(MASS,"data,") +importFrom(MASS,"for") +importFrom(MASS,and) +importFrom(MASS,classes) +importFrom(MASS,classification.) +importFrom(MASS,classifications.) +importFrom(MASS,kde2d) +importFrom(MASS,plots) +importFrom(MASS,S4) +importFrom(MASS,ternary) +importFrom(MASS,Ternary) +S3method("blrClock<-",ternaryGeometry) +S3method("blrClock<-",ternarySystem) +S3method("blrLabels<-",ternarySystem) +S3method("blrLabels<-",ternaryVariables) +S3method("blrNames<-",ternarySystem) +S3method("blrNames<-",ternaryVariables) +S3method("fracSum<-",ternaryGeometry) +S3method("fracSum<-",ternarySystem) +S3method("ternaryGeometry<-",ternarySystem) +S3method("ternaryVariables<-",ternarySystem) +S3method("tlrAngles<-",ternaryGeometry) +S3method("tlrAngles<-",ternarySystem) +S3method(.ternaryAxisArrows,ternarySystem) +S3method(.ternaryAxisArrowsBase,ternarySystem) +S3method(.ternaryGridBase,ternarySystem) +S3method(.ternaryLims,character) +S3method(.ternaryLims,ternarySystem) +S3method(.ternaryTicks,ternarySystem) +S3method(blrClock,ternaryGeometry) +S3method(blrClock,ternarySystem) +S3method(blrLabels,ternarySystem) +S3method(blrLabels,ternaryVariables) +S3method(blrNames,ternarySystem) +S3method(blrNames,ternaryVariables) +S3method(createTernaryGrid,character) +S3method(createTernaryGrid,ternarySystem) +S3method(fracSum,ternaryGeometry) +S3method(fracSum,ternarySystem) +S3method(ternary2SpatialPolygonsDataFrame,ternaryPolygons) +S3method(ternary2xy,character) +S3method(ternary2xy,ternaryData) +S3method(ternary2xy,ternarySystem) +S3method(ternaryArrows,ternarySystem) +S3method(ternaryBox,ternarySystem) +S3method(ternaryCheck,ternaryGeometry) +S3method(ternaryCheck,ternarySystem) +S3method(ternaryCheck,ternaryVariables) +S3method(ternaryData,character) +S3method(ternaryData,ternarySystem) +S3method(ternaryGeometry,ternarySystem) +S3method(ternaryGrid,ternarySystem) +S3method(ternaryPlot,character) +S3method(ternaryPlot,ternarySystem) +S3method(ternaryPoints,ternarySystem) +S3method(ternarySegments,ternarySystem) +S3method(ternaryText,ternarySystem) +S3method(ternaryVariables,ternarySystem) +S3method(ternaryWindow,character) +S3method(tlrAngles,ternaryGeometry) +S3method(tlrAngles,ternarySystem) Modified: pkg/ternaryplot/NEWS =================================================================== --- pkg/ternaryplot/NEWS 2014-01-15 13:04:01 UTC (rev 99) +++ pkg/ternaryplot/NEWS 2014-03-28 14:58:55 UTC (rev 100) @@ -1,3 +1,10 @@ - o version 0.1.0 + + package: ternaryplot +CHANGES IN VERSION 0.3.0 + + 2014/03/28 Package converted from S4-classes to S3-classes + +CHANGES IN VERSION 0.1.0 + 2013/01/24 Package created Added: pkg/ternaryplot/R/aa00-ternaryplot-package.R =================================================================== --- pkg/ternaryplot/R/aa00-ternaryplot-package.R (rev 0) +++ pkg/ternaryplot/R/aa00-ternaryplot-package.R 2014-03-28 14:58:55 UTC (rev 100) @@ -0,0 +1,35 @@ + +# +-------------------------------------------------------------+ +# | Language: R + roxygen2 inline documentation +# | Package: ternaryplot +# | Author(s): Julien Moeys +# | License: AGPL3, Affero General Public License version 3 +# +-------------------------------------------------------------+ + + + +#'@importFrom MASS kde2d + + + +#' Ternary plots and ternary classifications. +#' +#' Ternary plots and ternary classifications. S4 classes for ternary +#' data, ternary plots and ternary classification. +#' +#' @author Julien Moeys \email{Julien.Moeys@@slu.se} +#' +#' Maintainer: Julien Moeys \email{Julien.Moeys@@slu.se} +#' +#' @docType package +#' +#' @title Ternary plots and ternary classifications +#' +#' @keywords package +#' +#' @examples +#' # Examples coming later +#' +#' @name ternaryplot-package +#' +NULL Added: pkg/ternaryplot/R/aa01-ternaryplot-options.R =================================================================== --- pkg/ternaryplot/R/aa01-ternaryplot-options.R (rev 0) +++ pkg/ternaryplot/R/aa01-ternaryplot-options.R 2014-03-28 14:58:55 UTC (rev 100) @@ -0,0 +1,422 @@ + +# +-------------------------------------------------------------+ +# | Package: ternaryplot | +# | Language: R + roxygen2 inline documentation | +# | Author(s): Julien Moeys | +# | License: AGPL3, Affero General Public License version 3 | +# +-------------------------------------------------------------+ + + + +# =============================================================== +# Create two environment that will contain the package parameters + +# - Backup / reference +.tpParList <- new.env() + +# - User visible container +tpParList <- new.env() + + + +# Set some default parameters: + +# NON-GRAPHICAL PARAMETERS +# ======================== + +.tpParList[[ "testSum" ]] <- TRUE + +.tpParList[[ "testRange" ]] <- TRUE + +.tpParList[[ "fracSumTol" ]] <- 1/1000 + +.tpParList[[ "vertices" ]] <- data.frame( + "id" = integer(0), + "bo" = numeric(0), + "le" = numeric(0), + "ri" = numeric(0) +) + +.tpParList[[ "classes" ]] <- data.frame( + "abbrev" = character(0), + "name" = character(0), + "verticesId" = I( vector( length = 0, mode = "list" ) ), + stringsAsFactors = FALSE +) + +.tpParList[[ "scale" ]] <- data.frame( + "bo" = c( 000, 100 ), + "le" = c( 000, 100 ), + "ri" = c( 000, 100 ), + row.names = c( "min", "max" ) +) + +.tpParList[[ "okClock" ]] <- list( + # # Bottom Left Right + "TTT" = c( TRUE, TRUE, TRUE ), + "FFF" = c( FALSE, FALSE, FALSE ), + "TXF" = c( TRUE, NA, FALSE ), + "FTX" = c( FALSE, TRUE, NA ) + #"XFT" = c( NA, FALSE, TRUE ) # Un-tested +) + +.tpParList[[ "sp" ]] <- TRUE + +# GRAPHICAL PARAMETERS +# ==================== + +# Plot region (frame) +# ------------------- + +.tpParList[[ "plot.bg" ]] <- NA + +# Axis +# ---- + +.tpParList[[ "ticksAt" ]] <- seq( from = 0, to = 1, by = .1 ) + +.tpParList[[ "ticksShift" ]] <- 0.025 + +.tpParList[[ "arrowsShift" ]] <- c( 0.075, 0.125 ) + +.tpParList[[ "arrowsCoords" ]] <- c( .15, .45, .45, .55 ) + +.tpParList[[ "arrowsBreak" ]] <- TRUE + +.tpParList[[ "axis.line.lwd" ]] <- NULL + +# Grid +# ---- + +.tpParList[[ "grid.line.col" ]] <- "lightgray" + + + + +# tpPar ========================================================= + +#'Get or set default parameters for the package. +#' +#'Get or set default parameters for the package. Notice changes +#' done to the parameter values are reset everytime the R session +#' is closed and the package is reloaded. +#' +#' +#'@details +#' The function has 3 possible, non-exclusive behaviours: \itemize{ \item If +#' \code{reset=TRUE}, resetting the parameters to their initial values, as +#' defined in this function. \item (Silently) returning the actual value of the +#' package parameters. If \code{par=NULL}, all the values are returned. If +#' \code{par} is a vector of parameter names, their value will be returned. +#' \item Setting-up the value of some parameters, passing a list of parameter +#' value to \code{par} OR setting some of the parameters listed above. } +#' +#' Notice that when \code{reset=TRUE} and some new parameter values are +#' provided, the parameters are first reset, and then the new parameter values +#' are set. If \code{par} is a list, parameters are set first according to +#' values in \code{par}, and then according to values in the parameters listed +#' below. This combination is not recommended, but nonetheless possible. +#' +#' The actual value of the parameters is stored in (and can be retrieved from) +#' the environment \code{rspPars}. The default value of the parameters are +#' stored in the environment \code{rspPars}. Do not use them directly. +#' +#' +#'@param par +#' Three possible cases: \itemize{ \item If \code{par} is \code{NULL} +#' (default): All the actual value of the parameters will be silently returned. +#' \item If \code{par} is a vector of character strings representing parameter +#' names. The value of the parameters named here will be (silently) returned. +#' \item If \code{par} is a list following the format \code{tag = value}, where +#' \code{tag} is the name of the parameter to be changed, and \code{value} is +#' its new value. Such a list is returned by \code{tpPar()}. Notice that +#' parameters can also be set indivudually, using the options listed below. } +#' +#'@param reset +#' Single logical. If TRUE, all the parameters will be set to their +#' default value. Values are reset before any change to the parameter values, as +#' listed below. +#' +#'@param testRange +#' Single logical. Test if the range of fraction is between 0 and +#' the expected sum of fractions (1 or 100). +#' +#'@param testSum +#' Single logical. Test if the sum of the 3 fractions is equal to +#' the expected sum of fractions (1 or 100). +#' +#'@param fracSumTol +#' Single numeric. Tolerance on the sum of the 3 ternary fractions. Overall +#' tolerance is \code{fracSum * fracSumTol}, where \code{fracSum} is the +#' expected sum of the 3 ternary fractions, as given by a +#' \code{\link[ternaryplot]{ternaryGeometry}} or a \code{\link[ternaryplot]{ternarySystem}}. +#' +#'@param ticksAt +#' Vector of numeric. Pre-defined position of the tick-marks for the 3 axis. +#' Between 0 and 'fracSum' (the sum of the 3 fractions). +#' +#'@param ticksShift +#' Single numeric. Tick-marks 'size', expressed so that +#' \code{ticksShift * fracSum} is the length of the tick-marks. +#' +#'@param arrowsShift +#' Vector of tow numeric values. Axis' arrows' shift from their +#' axis, expressed so that \code{arrowsShift * fracSum} is the +#' start and end point. +#' +#'@param vertices +#' Vertices of a ternary classification (default): a +#' \code{\link[base]{data.frame}} with 4 columns \code{id}, +#' \code{bo}, \code{le} and \code{ri}, as the identifier and +#' the the 3 fractions (bottom, left, right) of the vertices. +#' Each row is a vertex. +#' +#'@param classes +#' Polygons (classes outline) of a ternary classification (default): +#' a \code{\link[base]{data.frame}} with 3 columns \code{abbrev}, +#' \code{name} and \code{verticesId}, as the abbreviation, +#' name and identifier of the vertices of each class. Notice +#' that \code{verticesId} must be a \code{\link[base]{list}} of +#' vectors, each containing the vertices that define the polygon. +#' You can use \code{\link[base]{list}}\code{()} to preserve +#' the list format when defining the \code{\link[base]{data.frame}}. +#' For example +#' \code{ data.frame( "abbrev" = "A", "name" = "Aa", "verticesId" = I( list( 1:3 ) ) ) } +#' +#'@param scale +#' Scale-extent of a ternary classification (default): a +#' \code{\link[base]{data.frame}} with 3 columns \code{bo}, +#' \code{le} and \code{ri}, and 2 rows (\code{min} and \code{max}), +#' as the min and max of the 3 fractions to be displayed (bottom, +#' left, right). +#' +#'@param okClock +#' A list of vectors of 3 logical values, with the valid +#' \code{blrClock} geometries. +#' +#'@param sp +#' Single logical value. If \code{TRUE}, the low-level graphic +#' functions output a \code{Spatial*} object of the graphical +#' element that can be reused in later calculations with +#' \code{\link[sp]{sp}}. If \code{FALSE}, simply returns a +#' \code{\link[base]{data.frame}} with the x-y coordinates of the +#' graphical element. +#' +#'@param grid.line.col +#' Single character value representing a color. Color of the +#' grid-lines added to a ternary plot. +#' +#'@param arrowsCoords +#' Parameters used internally to define axis-arrows location +#' +#'@param arrowsBreak +#' Single logical value. If \code{TRUE}, axis-arrows are 'browken' +#' (i.e. with the arrow starting parallel to the axis and finishing +#' toward the axis). +#' +#'@param axis.line.lwd +#' Single numerical value. Line thickness for the axis-lines +#' (including ticks and arrows) +#' +#'@param plot.bg +#' Single character value representing a color. Fill-color of the +#' plot region (frame). Set to \code{NA} or \code{"transparemt"} +#' to suppress color. +#' +#' +#'@return +#' Returns a partial or complete list of (actual) parameter values, as a +#' named list. +#' +#'@seealso \code{\link{getTpPar}}. +#' +#'@export tpPar +#' +tpPar <- function( + par = NULL, + reset = FALSE, + testRange, + testSum, + fracSumTol, + vertices, + classes, + scale, + okClock, + sp, + + ticksAt, + ticksShift, + arrowsShift, + arrowsCoords, + arrowsBreak, + grid.line.col, + axis.line.lwd, + plot.bg + +){ + parList <- names( formals(tpPar) ) + parList <- parList[ !(parList %in% c( "par", "reset" )) ] + + + ## (1) Reset the parameter values: + if( reset ){ + v <- as.list( .tpParList ) + nv <- names( v ) + + lapply( + X = 1:length(v), + FUN = function(X){ + assign( x = nv[ X ], value = v[[ X ]], envir = tpParList ) + } + ) + + rm( nv, v ) + } + + + ## (2) Change the parameter values: + + # Get actual parameter values: + tpParValues <- as.list( get( x = "tpParList" ) ) + + # Case: par is a list of parameters to be set + if( is.list( par ) ){ + parNames <- names( par ) + + if( is.null( parNames ) ){ + stop( "If 'par' is a list, its item must be named." ) + } + + # Check that all parameters in par exists: + testpar1 <- !(parNames %in% names(tpParValues)) + + if( any( testpar1 ) ){ + stop( sprintf( + "Some of the parameter names listed in 'par' could not be found: %s.", + paste( parNames[ testpar1 ], collapse=", " ) + ) ) + } + + # Set the values + for( i in parNames ){ + tpParValues[[ i ]] <- par[[ i ]] + } + } + + # Set all the individual parameters provided as a function's + # argument(s) + for( parLabel in parList ){ + testExpr <- substitute( + expr = !missing(theLabel), + env = list( theLabel = as.symbol(parLabel) ) + ) + + if( eval( testExpr ) ){ + tpParValues[[ parLabel ]] <- get( x = parLabel ) + } + } + + # Set the parameter values at once + nv <- names( tpParValues ) + lapply( + X = 1:length(tpParValues), + FUN = function(X){ + assign( x = nv[ X ], value = tpParValues[[ X ]], envir = tpParList ) + } + ) + + + ## (3) Return the parameter values: + + # Case: return the value of some parameters: + if( is.character(par) & (length(par) != 0) ){ + # Test that all demanded parameters exists: + testpar <- !(par %in% names(tpParValues)) + + if( any( testpar ) ){ + stop( sprintf( + "Some of the parameter names listed in 'par' could not be found: %s.", + paste( par[ testpar ], collapse=", " ) + ) ) + } + + ret <- tpParValues[ par ] + + # Case: return the value of all parameters: + }else{ + ret <- tpParValues + } + + return( invisible( ret ) ) +### Returns a partial or complete list of (actual) parameter values, +### as a named list. +} + + + +# getTpPar ====================================================== + +#'Get a single default parameters for the package. +#' +#'Get a single default parameters for the package. Wrapper around +#' \code{\link{tpPar}}. +#' +#' +#'@param par +#' See the \code{par} argument in \code{\link{tpPar}}. Notice that if +#' more than one parameter name is provided, only the first one will be +#' returned. +#' +#' +#'@return +#' Return the value of the parameter \code{par}, without the list +#' container of \code{\link{tpPar}}. +#' +#'@export getTpPar +#' +getTpPar <- function( + par +){ + return( tpPar( par = par )[[ 1L ]] ) +} + + + +# =============================================================== +# Test that all parameters in '.tpParList' have been included in +# the function rspParameters() + +# List of parameter names: +parNames <- names( as.list( .tpParList ) ) + +# List of argument names +tpParF <- names(formals(tpPar)) +tpParF <- tpParF[ !(tpParF %in% c("par","reset")) ] + +# List of parameters handled by tpPar(): do they match with +# the default parameters? +testpar <- !(parNames %in% tpParF) + +if( any(testpar) ){ + stop( sprintf( + "Some parameters in '.tpParList' are not in names(formals(tpPar)): %s", + paste( parNames[ testpar ], collapse = ", " ) + ) ) +} + +# Other way round +testpar2 <- !(tpParF %in% parNames) + +if( any(testpar2) ){ + stop( sprintf( + "Some parameters in names(formals(tpPar)) are not in '.tpParList': %s", + paste( tpParF[ testpar2 ], collapse = ", " ) + ) ) +} + +rm( testpar, parNames, testpar2, tpParF ) + + + +# Set the current list of parameters +tpParList <- list2env( as.list( .tpParList ) ) Added: pkg/ternaryplot/R/aa02-ternaryplot-classes.R =================================================================== --- pkg/ternaryplot/R/aa02-ternaryplot-classes.R (rev 0) +++ pkg/ternaryplot/R/aa02-ternaryplot-classes.R 2014-03-28 14:58:55 UTC (rev 100) @@ -0,0 +1,592 @@ + +# +-------------------------------------------------------------+ +# | Package: ternaryplot | +# | Language: R + roxygen2 inline documentation | +# | Author(s): Julien Moeys | +# | License: AGPL3, Affero General Public License version 3 | +# +-------------------------------------------------------------+ + + + +# ternaryCheck ========================================================= + +#'Check the validity of ternary*-class objects +#' +#'Check the validity of ternary*-class objects +#' +#' +#'@param x +#' A ternary*-class object. +#' +#'@param onFailure +#' A function like \code{\link[base]{stop}} or +#' \code{\link[base]{warning}} or \code{\link[base]{message}} to +#' be called if a non-conformity is found. +#' +#'@param \dots +#' Additional parameters passed to specific methods. +#' +#' +#'@rdname ternaryCheck-methods +#' +#'@export +#' +ternaryCheck <- function( + x, + ... +){ + UseMethod( "ternaryCheck" ) +} + + + +#'@rdname ternaryCheck-methods +#' +#'@method ternaryCheck ternaryGeometry +#'@S3method ternaryCheck ternaryGeometry +ternaryCheck.ternaryGeometry <- function( + x, + onFailure=stop, + ... +){ + valid <- TRUE + + # Check names: + nm <- c( "tlrAngles", "blrClock", "fracSum" ) + testNames <- nm %in% names( x ) + + if( any( !testNames ) ){ + onFailure( sprintf( + "Some items (or item-labels) are missing: %s", + paste( nm, collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testNames ) + + + # Check tlrAngles + testTlrAngles <- + ( length( x[[ "tlrAngles" ]] ) == 3 ) & + is.numeric( x[[ "tlrAngles" ]] ) & + ( sum( x[[ "tlrAngles" ]] ) == 180 ) + + + if( !testTlrAngles ){ + onFailure( sprintf( + "'tlrAngles' must be 3 numerical values summing to 180 degrees (now %s)", + paste( x[[ "tlrAngles" ]], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testTlrAngles ) + + + # Check blrClock: + testBlrClock <- + ( length( x[[ "blrClock" ]] ) == 3 ) & + is.logical( x[[ "blrClock" ]] ) + + if( !testBlrClock ){ + onFailure( sprintf( + "'blrClock' must be 3 logical values (now %s)", + paste( x[[ "blrClock" ]], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testBlrClock ) + + + okClock <- getTpPar( "okClock" ) + + okClock <- unlist( lapply( + X = okClock, + FUN = function( X ){ + identical( x[[ "blrClock" ]], X ) + } + ) ) + + if( !any(okClock) ){ + onFailure( "Invalid 'blrClock'. See getTpPar( 'okClock' ) for accepted values." ) + + valid <- FALSE + }; rm( okClock ) + + + + # Check fracSum + testFracSum <- + ( length( x[[ "fracSum" ]] ) == 1 ) & + is.numeric( x[[ "fracSum" ]] ) & + all( x[[ "fracSum" ]] %in% c( 1, 100 ) ) + + if( !testFracSum ){ + onFailure( sprintf( + "'fracSum' must be 1 numerical values, either 1 or 100 (now %s)", + paste( x[[ "fracSum" ]], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testFracSum ) + + + return( valid ) +} + + + +#'@rdname ternaryCheck-methods +#' +#'@method ternaryCheck ternaryVariables +#'@S3method ternaryCheck ternaryVariables +ternaryCheck.ternaryVariables <- function( + x, + onFailure=stop, + ... +){ + valid <- TRUE + + # Check names: + nm <- c( "blrNames", "blrLabels" ) + testNames <- nm %in% names( x ) + + if( any( !testNames ) ){ + onFailure( sprintf( + "Some items (or item-labels) are missing: %s", + paste( nm, collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testNames ) + + + # Check blrNames + testBlrNames <- + ( length( x[[ "blrNames" ]] ) == 3 ) & + is.character( x[[ "blrNames" ]] ) + + + if( !testBlrNames ){ + onFailure( sprintf( + "'blrNames' must be 3 character strings (now %s)", + paste( x[[ "blrNames" ]], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testBlrNames ) + + + # Check blrLabels + testBlrLabels <- + ( length( x[[ "blrLabels" ]] ) == 3 ) & + ( class( x[[ "blrLabels" ]] ) %in% c( "character", "expression", "name", "call" ) ) + + + if( !testBlrLabels ){ + onFailure( sprintf( + "'blrLabels' must be an object of class character, expression, name or call and length 3 (now %s)", + paste( x[[ "blrLabels" ]], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testBlrLabels ) + + + return( valid ) +} + + + +#'@rdname ternaryCheck-methods +#' +#'@method ternaryCheck ternarySystem +#'@S3method ternaryCheck ternarySystem +ternaryCheck.ternarySystem <- function( + x, + onFailure=stop, + ... +){ + valid <- TRUE + + # Check names: + nm <- c( "ternaryGeometry", "ternaryVariables", "main", + "vertices", "classes", "scale" ) + testNames <- nm %in% names( x ) + + if( any( !testNames ) ){ + onFailure( sprintf( + "Some items (or item-labels) are missing: %s", + paste( nm[ !testNames ], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testNames ) + + + valid <- ternaryCheck( x[[ "ternaryGeometry" ]], onFailure = onFailure, ... ) + valid <- ternaryCheck( x[[ "ternaryVariables" ]], onFailure = onFailure, ... ) + + + # Check main + testMain <- + ( length( x[[ "main" ]] ) %in% c(1,0) ) & + ( class( x[[ "main" ]] ) %in% c( "character", "expression", "name", "call" ) ) + + if( !testMain ){ + onFailure( sprintf( + "'main' must be an object of class character, expression, name or call and length 1 (now %s)", + paste( x[[ "main" ]], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testMain ) + + + # Check vertices + verticesDefault <- getTpPar( "vertices" ) + + cn <- c( colnames(verticesDefault)[1], + x[[ "ternaryVariables" ]][[ "blrNames" ]] ) + + testCol <- cn %in% colnames( x[[ "vertices" ]] ) + + if( !all( testCol ) ){ + onFailure( sprintf( + "Some columns are missing in 'vertices': %s", + paste( cn[ !testCol ], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testCol ) + + + # Test classes: + cn2 <- colnames( getTpPar( "classes" ) ) + + testCol <- cn2 %in% colnames( x[[ "classes" ]] ) + + if( !all( testCol ) ){ + onFailure( sprintf( + "Some columns are missing in 'classes': %s", + paste( cn2[ !testCol ], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testCol ) + + + # Test class x vertices + verticesId <- unlist( x[[ "classes" ]][, "verticesId" ] ) + id <- x[[ "vertices" ]][, "id" ] + testClaVer <- verticesId %in% id + + if( any( !testClaVer ) ){ + onFailure( sprintf( + "Some classes[, 'verticesId' ] are missing in vertices[, 'id']: %s", + paste( verticesId[ !testClaVer ], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testClaVer ) + + + testClaVer2 <- id %in% verticesId + + + if( any( !testClaVer2 ) ){ + onFailure( sprintf( + "Some vertices[, 'id'] are missing in classes[, 'verticesId' ]: %s", + paste( id[ !testClaVer2 ], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testClaVer2 ) + + + # Test scale: + testCol <- cn[ -1 ] %in% colnames( x[[ "scale" ]] ) + + if( !all( testCol ) ){ + onFailure( sprintf( + "Some columns are missing in 'scale': %s", + paste( cn[ -1 ][ !testCol ], collapse = "; " ) + ) ) + + valid <- FALSE + }; rm( testCol ) + + testRow <- + ( nrow( x[[ "scale" ]] ) == 2L ) & + all( c( "min", "max" ) %in% rownames( x[[ "scale" ]] ) ) + + if( !testRow ){ + onFailure( "scale must have two rows, labelled 'min' and 'max'" ) + + valid <- FALSE + }; rm( testRow ) + + + testDiff <- as.numeric( x[[ "scale" ]][ 2, ] - x[[ "scale" ]][ 1, ] ) + testDiff <- all( testDiff == testDiff[1] ) + + if( any( !testDiff ) ){ + onFailure( "In 'scale', the difference between min and max must be identica" ) + + valid <- FALSE + } + + + return( valid ) +} + + + +# createTernaryGeometry ============================================ + +#'Creates a ternaryGeometry object: ternary plot geometry definition. +#' +#'Creates a ternaryGeometry object: ternary plot geometry definition. +#' +#' In this package, ternary plots geometries are defined by the +#' 3 triangle's angles (top, left, right), and by the sum of the +#' 3 fractions it represents (1 if a fraction, and 100 if a +#' percentage). +#' +#' +#'@param tlrAngles +#' Vector of numeric. Top, left and right angle (in degrees) +#' of the ternary diagram. Must sum to 180 degrees. +#' +#'@param blrClock +#' Vector of logical. Bottom, left and right axis directions. +#' Set to \code{TRUE} if the axis is clockwise, and to +#' \code{FALSE} if the axis is counter-clockwise. +#' +#'@param fracSum +#' Single numeric. Sum of the three fractions. Must be 1 (if +#' a fraction) or 100 (if a percentage). +#' +#'@param \dots +#' Additional parameters passed to \code{\link[ternaryplot]{ternaryCheck}} +#' +#' +#'@example inst/examples/createTernaryGeometry-example.R +#' +#' +#'@name createTernaryGeometry +#' +#'@export createTernaryGeometry +#' +createTernaryGeometry <- function( + tlrAngles = c( 60, 60, 60 ), + blrClock = rep( TRUE, 3 ), + fracSum = 100, + ... +){ + # Create a ternary geometry object: + tg <- list( + "tlrAngles" = tlrAngles, + "blrClock" = blrClock, + "fracSum" = fracSum + ) + + # Set the class + class( tg ) <- "ternaryGeometry" + + + # Check: + ternaryCheck( tg, ... ) + + + return( tg ) +} + + + +# createTernaryVariables =========================================== + +#'Creates a ternaryVariables object: ternary plot variables definitions. +#' +#'Creates a ternaryVariables object: ternary plot variables definitions. +#' +#' In this package, ternary plots variables are defined by the 3 +#' variables name (bottom, left, right), as they will be found in +#' \code{\link[base]{data.frame}} containing ternary datasets, +#' and by the label of these variables on the axis of a ternary +#' plot. +#' +#' +#'@param blrNames +#' Vector of characters. Bottom, left and right variable names +#' as they will be found in \code{data.frame} containing ternary +#' data. +#' +#'@param blrLabels +#' Vector of characters or vector of expressions. Bottom, left +#' and right variable labels as they will be displayed on ternary +#' plots. +#' +#'@param \dots +#' Additional parameters passed to \code{\link[ternaryplot]{ternaryCheck}} +#' +#' +#'@example inst/examples/createTernaryVariables-example.R +#' +#' +#'@name createTernaryVariables +#' +#'@export createTernaryVariables +#' +createTernaryVariables <- function( + blrNames = paste0( "F", 1:3 ), + blrLabels = sprintf( "Fraction %s [%s]", 1:3, "%" ), + ... +){ + tv <- list( + "blrNames" = blrNames, + "blrLabels" = blrLabels + ) + + # Set the class + class( tv ) <- "ternaryVariables" + + + # Check: + ternaryCheck( tv, ... ) + + + return( tv ) +} + + + +# createTernarySystem =========================================== + +#'Creates a ternarySystem object: ternary plot system definition. +#' +#'Creates a ternarySystem object: ternary plot system +#' definition. +#' +#' Ternary systems are a combination of (a) a ternary +#' geometry (as defined by +#' \code{\link[ternaryplot]{createTernaryGeometry}}), (b) a set of +#' ternary variables (as defined by +#' \code{\link[ternaryplot]{createTernaryVariables}} and an optional +#' classification system, that is polygons drawn on top of ternary +#' plots, that define different zones in the fractions. +#' +#' The classification is defined by a collection of polygons (in +#' \code{classes}) with different \code{vertices}. +#' +#' +#'@param ternaryGeometry +#' A ternary geometry (as defined by +#' \code{\link[ternaryplot]{createTernaryGeometry}}). If \code{NULL}, +#' use the default output of \code{\link[ternaryplot]{createTernaryGeometry}}. +#' +#'@param ternaryVariables [TRUNCATED] To get the complete diff run: svnlook diff /svnroot/soiltexture -r 100 From noreply at r-forge.r-project.org Fri Mar 28 16:15:38 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 16:15:38 +0100 (CET) Subject: [Soiltexture-commits] r101 - in pkg/ternaryplot: . R man Message-ID: <20140328151539.0BFDA18614C@r-forge.r-project.org> Author: jmoeys Date: 2014-03-28 16:15:38 +0100 (Fri, 28 Mar 2014) New Revision: 101 Added: pkg/ternaryplot/REVISION pkg/ternaryplot/man/createTernarySystem.Rd Modified: pkg/ternaryplot/DESCRIPTION pkg/ternaryplot/NAMESPACE pkg/ternaryplot/R/aa00-ternaryplot-package.R pkg/ternaryplot/R/aa01-ternaryplot-options.R pkg/ternaryplot/R/aa02-ternaryplot-classes.R pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R pkg/ternaryplot/R/aa04-ternarysystems.R pkg/ternaryplot/R/aa05-ternarydata.R pkg/ternaryplot/R/aa06-ternary2xy.R pkg/ternaryplot/R/ternaryplot.R pkg/ternaryplot/man/blrLabels-methods.Rd pkg/ternaryplot/man/blrNames-methods.Rd pkg/ternaryplot/man/createTernaryGeometry.Rd pkg/ternaryplot/man/createTernaryVariables.Rd pkg/ternaryplot/man/getTernarySystem.Rd pkg/ternaryplot/man/ternary2xy-methods.Rd pkg/ternaryplot/man/ternaryData-methods.Rd pkg/ternaryplot/man/ternaryLims-methods.Rd pkg/ternaryplot/man/ternaryWindow-methods.Rd pkg/ternaryplot/man/ternaryplot-package.Rd pkg/ternaryplot/man/tpPar.Rd Log: bug fixes Modified: pkg/ternaryplot/DESCRIPTION =================================================================== --- pkg/ternaryplot/DESCRIPTION 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/DESCRIPTION 2014-03-28 15:15:38 UTC (rev 101) @@ -7,5 +7,4 @@ Description: Ternary plots and ternary classifications. License: AGPL-3 URL: http://www.slu.se/ckb -Depends: R (>= 3.0.2), sp -Imports: MASS +Depends: R (>= 3.0.2), sp, MASS Modified: pkg/ternaryplot/NAMESPACE =================================================================== --- pkg/ternaryplot/NAMESPACE 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/NAMESPACE 2014-03-28 15:15:38 UTC (rev 101) @@ -16,6 +16,7 @@ export(blrNames) export(createTernaryGeometry) export(createTernaryGrid) +export(createTernarySystem) export(createTernaryVariables) export(deg2rad) export(fracSum) @@ -38,18 +39,6 @@ export(ternaryWindow) export(tlrAngles) export(tpPar) -exportClasses(ternarySystem) -importFrom(MASS,"data,") -importFrom(MASS,"for") -importFrom(MASS,and) -importFrom(MASS,classes) -importFrom(MASS,classification.) -importFrom(MASS,classifications.) -importFrom(MASS,kde2d) -importFrom(MASS,plots) -importFrom(MASS,S4) -importFrom(MASS,ternary) -importFrom(MASS,Ternary) S3method("blrClock<-",ternaryGeometry) S3method("blrClock<-",ternarySystem) S3method("blrLabels<-",ternarySystem) Modified: pkg/ternaryplot/R/aa00-ternaryplot-package.R =================================================================== --- pkg/ternaryplot/R/aa00-ternaryplot-package.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa00-ternaryplot-package.R 2014-03-28 15:15:38 UTC (rev 101) @@ -8,10 +8,6 @@ -#'@importFrom MASS kde2d - - - #' Ternary plots and ternary classifications. #' #' Ternary plots and ternary classifications. S4 classes for ternary Modified: pkg/ternaryplot/R/aa01-ternaryplot-options.R =================================================================== --- pkg/ternaryplot/R/aa01-ternaryplot-options.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa01-ternaryplot-options.R 2014-03-28 15:15:38 UTC (rev 101) @@ -148,8 +148,9 @@ #'@param fracSumTol #' Single numeric. Tolerance on the sum of the 3 ternary fractions. Overall #' tolerance is \code{fracSum * fracSumTol}, where \code{fracSum} is the -#' expected sum of the 3 ternary fractions, as given by a -#' \code{\link[ternaryplot]{ternaryGeometry}} or a \code{\link[ternaryplot]{ternarySystem}}. +#' expected sum of the 3 ternary fractions. See +#' \code{\link[ternaryplot]{createTernaryGeometry}} or +#' \code{\link[ternaryplot]{createTernarySystem}}. #' #'@param ticksAt #' Vector of numeric. Pre-defined position of the tick-marks for the 3 axis. @@ -230,7 +231,7 @@ #' #'@seealso \code{\link{getTpPar}}. #' -#'@export tpPar +#'@export #' tpPar <- function( par = NULL, @@ -372,7 +373,7 @@ #' Return the value of the parameter \code{par}, without the list #' container of \code{\link{tpPar}}. #' -#'@export getTpPar +#'@export #' getTpPar <- function( par Modified: pkg/ternaryplot/R/aa02-ternaryplot-classes.R =================================================================== --- pkg/ternaryplot/R/aa02-ternaryplot-classes.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa02-ternaryplot-classes.R 2014-03-28 15:15:38 UTC (rev 101) @@ -373,9 +373,10 @@ #'@example inst/examples/createTernaryGeometry-example.R #' #' -#'@name createTernaryGeometry +#'@rdname createTernaryGeometry +#'@aliases ternaryGeometry #' -#'@export createTernaryGeometry +#'@export #' createTernaryGeometry <- function( tlrAngles = c( 60, 60, 60 ), @@ -433,9 +434,10 @@ #'@example inst/examples/createTernaryVariables-example.R #' #' -#'@name createTernaryVariables +#'@rdname createTernaryVariables +#'@aliases ternaryVariables #' -#'@export createTernaryVariables +#'@export #' createTernaryVariables <- function( blrNames = paste0( "F", 1:3 ), @@ -518,10 +520,10 @@ #'@example inst/examples/createTernarySystem-example.R #' #' -#'@name ternarySystem-class +#'@rdname createTernarySystem +#'@aliases ternarySystem +#'@export #' -#'@exportClass ternarySystem -#' createTernarySystem <- function( ternaryGeometry = NULL, ternaryVariables = NULL, Modified: pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R =================================================================== --- pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R 2014-03-28 15:15:38 UTC (rev 101) @@ -21,7 +21,7 @@ #' A \code{ternarySystem} object, as created with #' \code{\link[ternaryplot]{createTernarySystem}}, or a #' \code{ternaryVariables} object, as created with -#' \code{\link[ternaryplot]{ternaryVariables}}. +#' \code{\link[ternaryplot]{createTernaryVariables}}. #' #'@param \dots #' Additional parameters passed to \code{\link[ternaryplot]{ternaryCheck}}. @@ -136,7 +136,7 @@ #' A \code{ternarySystem} object, as created with #' \code{\link[ternaryplot]{createTernarySystem}}, or a #' \code{ternaryVariables} object, as created with -#' \code{\link[ternaryplot]{ternaryVariables}}. +#' \code{\link[ternaryplot]{createTernaryVariables}}. #' #'@param \dots #' Additional parameters passed to \code{\link[ternaryplot]{ternaryCheck}}. Modified: pkg/ternaryplot/R/aa04-ternarysystems.R =================================================================== --- pkg/ternaryplot/R/aa04-ternarysystems.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa04-ternarysystems.R 2014-03-28 15:15:38 UTC (rev 101) @@ -145,7 +145,7 @@ #' #' #'@return -#' A \code{\link[ternaryplot]{ternarySystem}} object. +#' A \code{ternarySystem} object. #' #' #'@export Modified: pkg/ternaryplot/R/aa05-ternarydata.R =================================================================== --- pkg/ternaryplot/R/aa05-ternarydata.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa05-ternarydata.R 2014-03-28 15:15:38 UTC (rev 101) @@ -34,7 +34,7 @@ #' #'@param s #' A \code{ternarySystem} object, as created with -#' \code{\link[ternaryplot]{ternarySystem}}, or a single +#' \code{\link[ternaryplot]{createTernarySystem}}, or a single #' \code{character} string. Can be missing. #' #'@param x Modified: pkg/ternaryplot/R/aa06-ternary2xy.R =================================================================== --- pkg/ternaryplot/R/aa06-ternary2xy.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/aa06-ternary2xy.R 2014-03-28 15:15:38 UTC (rev 101) @@ -30,7 +30,7 @@ #' #'Converts ternary point-data (bottom, left, right axis) into #' x-y coordinates, according to the specification of a -#' \code{\link[ternaryplot]{ternarySystem}} +#' \code{ternarySystem} #' #' #'@param s Modified: pkg/ternaryplot/R/ternaryplot.R =================================================================== --- pkg/ternaryplot/R/ternaryplot.R 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/R/ternaryplot.R 2014-03-28 15:15:38 UTC (rev 101) @@ -21,7 +21,7 @@ #' #'@param s #' A \code{ternarySystem} object, as created with -#' \code{\link[ternaryplot]{ternarySystem}}, or a single +#' \code{\link[ternaryplot]{createTernarySystem}}, or a single #' \code{character} string. Can be missing. #' #'@param x @@ -1424,7 +1424,7 @@ #'@param s #' Either a character string naming the ternary classification #' system to be used (if pre-defined) or a -#' \code{\link[ternaryplot]{ternarySystem}} x. +#' \code{\link[ternaryplot]{ternarySystem}}, instead of \code{x}. #' #'@param x #' A \code{\link[base]{data.frame}} or a \code{\link[base]{matrix}} Added: pkg/ternaryplot/REVISION =================================================================== --- pkg/ternaryplot/REVISION (rev 0) +++ pkg/ternaryplot/REVISION 2014-03-28 15:15:38 UTC (rev 101) @@ -0,0 +1 @@ +95:100M Modified: pkg/ternaryplot/man/blrLabels-methods.Rd =================================================================== --- pkg/ternaryplot/man/blrLabels-methods.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/blrLabels-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -26,7 +26,7 @@ \item{s}{A \code{ternarySystem} object, as created with \code{\link[ternaryplot]{createTernarySystem}}, or a \code{ternaryVariables} object, as created with - \code{\link[ternaryplot]{ternaryVariables}}.} + \code{\link[ternaryplot]{createTernaryVariables}}.} \item{\dots}{Additional parameters passed to \code{\link[ternaryplot]{ternaryCheck}}.} Modified: pkg/ternaryplot/man/blrNames-methods.Rd =================================================================== --- pkg/ternaryplot/man/blrNames-methods.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/blrNames-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -25,7 +25,7 @@ \item{s}{A \code{ternarySystem} object, as created with \code{\link[ternaryplot]{createTernarySystem}}, or a \code{ternaryVariables} object, as created with - \code{\link[ternaryplot]{ternaryVariables}}.} + \code{\link[ternaryplot]{createTernaryVariables}}.} \item{\dots}{Additional parameters passed to \code{\link[ternaryplot]{ternaryCheck}}.} Modified: pkg/ternaryplot/man/createTernaryGeometry.Rd =================================================================== --- pkg/ternaryplot/man/createTernaryGeometry.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/createTernaryGeometry.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -1,5 +1,6 @@ \name{createTernaryGeometry} \alias{createTernaryGeometry} +\alias{ternaryGeometry} \title{Creates a ternaryGeometry object: ternary plot geometry definition.} \usage{ createTernaryGeometry(tlrAngles = c(60, 60, 60), Added: pkg/ternaryplot/man/createTernarySystem.Rd =================================================================== --- pkg/ternaryplot/man/createTernarySystem.Rd (rev 0) +++ pkg/ternaryplot/man/createTernarySystem.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -0,0 +1,87 @@ +\name{createTernarySystem} +\alias{createTernarySystem} +\alias{ternarySystem} +\title{Creates a ternarySystem object: ternary plot system definition.} +\usage{ + createTernarySystem(ternaryGeometry = NULL, + ternaryVariables = NULL, main = character(0), + vertices = NULL, classes = NULL, scale = NULL, ...) +} +\arguments{ + \item{ternaryGeometry}{A ternary geometry (as defined by + \code{\link[ternaryplot]{createTernaryGeometry}}). If + \code{NULL}, use the default output of + \code{\link[ternaryplot]{createTernaryGeometry}}.} + + \item{ternaryVariables}{A set of ternary variables (as + defined by + \code{\link[ternaryplot]{createTernaryVariables}}. If + \code{NULL}, use the default output of + \code{\link[ternaryplot]{createTernaryVariables}}.} + + \item{main}{Single character string. Title of the + triangle plot.} + + \item{vertices}{See \code{\link[ternaryplot]{tpPar}}. If + non-null, \code{\link[base]{data.frame}} with 4 columns: + \code{id}, and 3 other columns corresponding to + \code{blrNames} in \code{ternaryVariables}. If + \code{NULL}, default values will be used + \code{getTpPar("vertices")}, and the columns names + changed to those of \code{ternaryVariables}.} + + \item{classes}{See \code{\link[ternaryplot]{tpPar}}.} + + \item{scale}{See \code{\link[ternaryplot]{tpPar}}. If + non-null, \code{\link[base]{data.frame}} with 3 columns, + corresponding to \code{blrNames} in + \code{ternaryVariables}. If \code{NULL}, default values + will be used \code{getTpPar("scale")}, and the columns + names changed to those of \code{ternaryVariables}. NOT + USED YET.} + + \item{\dots}{Additional parameters passed to + \code{\link[ternaryplot]{ternaryCheck}}} +} +\description{ + Creates a ternarySystem object: ternary plot system + definition. +} +\details{ + Ternary systems are a combination of (a) a ternary + geometry (as defined by + \code{\link[ternaryplot]{createTernaryGeometry}}), (b) a + set of ternary variables (as defined by + \code{\link[ternaryplot]{createTernaryVariables}} and an + optional classification system, that is polygons drawn on + top of ternary plots, that define different zones in the + fractions. + + The classification is defined by a collection of polygons + (in \code{classes}) with different \code{vertices}. +} +\examples{ +library( "ternaryplot" ) + + +## Default variables +tsy <- createTernarySystem() +tsy + +## Custom variables +tsy2 <- createTernarySystem( + "ternaryVariables" = createTernaryVariables( + "blrNames" = c( "CLAY", "SILT", "SAND" ), + "blrLabels" = c( "Clay [\%]", "Silt [\%]", "Sand [\%]" ) + ), + "ternaryGeometry" = createTernaryGeometry( + "ternaryGeometry", + "fracSum" = 100, + "tlrAngles" = c( 45, 45, 90 ) # top, left, right angles + ), + "main" = "My ternary plot" ) + +tsy2 + +} + Modified: pkg/ternaryplot/man/createTernaryVariables.Rd =================================================================== --- pkg/ternaryplot/man/createTernaryVariables.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/createTernaryVariables.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -1,5 +1,6 @@ \name{createTernaryVariables} \alias{createTernaryVariables} +\alias{ternaryVariables} \title{Creates a ternaryVariables object: ternary plot variables definitions.} \usage{ createTernaryVariables(blrNames = paste0("F", 1:3), Modified: pkg/ternaryplot/man/getTernarySystem.Rd =================================================================== --- pkg/ternaryplot/man/getTernarySystem.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/getTernarySystem.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -9,7 +9,7 @@ classification to be fetched.} } \value{ - A \code{\link[ternaryplot]{ternarySystem}} object. + A \code{ternarySystem} object. } \description{ Fetch a pre-defined ternary classification system Modified: pkg/ternaryplot/man/ternary2xy-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternary2xy-methods.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/ternary2xy-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -36,6 +36,6 @@ \description{ Converts ternary point-data (bottom, left, right axis) into x-y coordinates, according to the specification of a - \code{\link[ternaryplot]{ternarySystem}} + \code{ternarySystem} } Modified: pkg/ternaryplot/man/ternaryData-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryData-methods.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/ternaryData-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -14,8 +14,8 @@ } \arguments{ \item{s}{A \code{ternarySystem} object, as created with - \code{\link[ternaryplot]{ternarySystem}}, or a single - \code{character} string. Can be missing.} + \code{\link[ternaryplot]{createTernarySystem}}, or a + single \code{character} string. Can be missing.} \item{x}{A \code{\link[base]{data.frame}} or a \code{\link[base]{matrix}} containing point ternary data Modified: pkg/ternaryplot/man/ternaryLims-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryLims-methods.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/ternaryLims-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -13,7 +13,8 @@ \arguments{ \item{s}{Either a character string naming the ternary classification system to be used (if pre-defined) or a - \code{\link[ternaryplot]{ternarySystem}} x.} + \code{\link[ternaryplot]{ternarySystem}}, instead of + \code{x}.} \item{x}{A \code{\link[base]{data.frame}} or a \code{\link[base]{matrix}} containing point ternary data Modified: pkg/ternaryplot/man/ternaryWindow-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryWindow-methods.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/ternaryWindow-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -14,8 +14,8 @@ } \arguments{ \item{s}{A \code{ternarySystem} object, as created with - \code{\link[ternaryplot]{ternarySystem}}, or a single - \code{character} string. Can be missing.} + \code{\link[ternaryplot]{createTernarySystem}}, or a + single \code{character} string. Can be missing.} \item{x}{A \code{\link[base]{data.frame}} or a \code{\link[base]{matrix}} containing point ternary data Modified: pkg/ternaryplot/man/ternaryplot-package.Rd =================================================================== --- pkg/ternaryplot/man/ternaryplot-package.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/ternaryplot-package.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -3,8 +3,12 @@ \alias{ternaryplot-package} \title{Ternary plots and ternary classifications} \description{ - Ternary plots and ternary classifications + Ternary plots and ternary classifications. } +\details{ + Ternary plots and ternary classifications. S4 classes for + ternary data, ternary plots and ternary classification. +} \examples{ # Examples coming later } Modified: pkg/ternaryplot/man/tpPar.Rd =================================================================== --- pkg/ternaryplot/man/tpPar.Rd 2014-03-28 14:58:55 UTC (rev 100) +++ pkg/ternaryplot/man/tpPar.Rd 2014-03-28 15:15:38 UTC (rev 101) @@ -37,9 +37,9 @@ \item{fracSumTol}{Single numeric. Tolerance on the sum of the 3 ternary fractions. Overall tolerance is \code{fracSum * fracSumTol}, where \code{fracSum} is the - expected sum of the 3 ternary fractions, as given by a - \code{\link[ternaryplot]{ternaryGeometry}} or a - \code{\link[ternaryplot]{ternarySystem}}.} + expected sum of the 3 ternary fractions. See + \code{\link[ternaryplot]{createTernaryGeometry}} or + \code{\link[ternaryplot]{createTernarySystem}}.} \item{ticksAt}{Vector of numeric. Pre-defined position of the tick-marks for the 3 axis. Between 0 and 'fracSum' From noreply at r-forge.r-project.org Fri Mar 28 17:47:09 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 17:47:09 +0100 (CET) Subject: [Soiltexture-commits] r102 - in pkg/ternaryplot: . R inst/examples man Message-ID: <20140328164709.7C267187389@r-forge.r-project.org> Author: jmoeys Date: 2014-03-28 17:47:09 +0100 (Fri, 28 Mar 2014) New Revision: 102 Removed: pkg/ternaryplot/R/functionsList.txt pkg/ternaryplot/man/ternarySystem-class.Rd Modified: pkg/ternaryplot/NAMESPACE pkg/ternaryplot/R/aa02-ternaryplot-classes.R pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R pkg/ternaryplot/R/aa05-ternarydata.R pkg/ternaryplot/R/ternarygrid.R pkg/ternaryplot/R/ternaryplot.R pkg/ternaryplot/REVISION pkg/ternaryplot/inst/examples/createTernarySystem-example.R pkg/ternaryplot/inst/examples/ternaryPlot-example.R pkg/ternaryplot/man/blrClock-methods.Rd pkg/ternaryplot/man/blrLabels-methods.Rd pkg/ternaryplot/man/blrNames-methods.Rd pkg/ternaryplot/man/createTernaryGeometry.Rd pkg/ternaryplot/man/createTernaryGrid-methods.Rd pkg/ternaryplot/man/createTernarySystem.Rd pkg/ternaryplot/man/createTernaryVariables.Rd pkg/ternaryplot/man/fracSum-methods.Rd pkg/ternaryplot/man/ternary2SpatialPolygonsDataFrame-methods.Rd pkg/ternaryplot/man/ternaryData-methods.Rd pkg/ternaryplot/man/ternaryGeometry-methods.Rd pkg/ternaryplot/man/ternaryPlot-methods.Rd pkg/ternaryplot/man/ternaryVariables-methods.Rd pkg/ternaryplot/man/ternaryWindow-methods.Rd pkg/ternaryplot/man/tlrAngles-methods.Rd Log: Modified: pkg/ternaryplot/NAMESPACE =================================================================== --- pkg/ternaryplot/NAMESPACE 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/NAMESPACE 2014-03-28 16:47:09 UTC (rev 102) @@ -87,5 +87,6 @@ S3method(ternaryText,ternarySystem) S3method(ternaryVariables,ternarySystem) S3method(ternaryWindow,character) +S3method(ternaryWindow,ternarySystem) S3method(tlrAngles,ternaryGeometry) S3method(tlrAngles,ternarySystem) Modified: pkg/ternaryplot/R/aa02-ternaryplot-classes.R =================================================================== --- pkg/ternaryplot/R/aa02-ternaryplot-classes.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/R/aa02-ternaryplot-classes.R 2014-03-28 16:47:09 UTC (rev 102) @@ -374,7 +374,6 @@ #' #' #'@rdname createTernaryGeometry -#'@aliases ternaryGeometry #' #'@export #' @@ -435,7 +434,6 @@ #' #' #'@rdname createTernaryVariables -#'@aliases ternaryVariables #' #'@export #' @@ -521,7 +519,9 @@ #' #' #'@rdname createTernarySystem +#' #'@aliases ternarySystem +#' #'@export #' createTernarySystem <- function( Modified: pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R =================================================================== --- pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/R/aa03-ternaryplot-classes-utility.R 2014-03-28 16:47:09 UTC (rev 102) @@ -65,6 +65,8 @@ #'@rdname blrNames-methods #' +#'@usage blrNames( s, ... ) <- value +#' #'@export #' `blrNames<-` <- function( @@ -81,6 +83,9 @@ #' #'@method blrNames<- ternarySystem #'@S3method blrNames<- ternarySystem +#' +#'@usage \method{blrNames}{ternarySystem}(s, ...) <- value +#' `blrNames<-.ternarySystem` <- function( s, ..., @@ -109,6 +114,9 @@ #' #'@method blrNames<- ternaryVariables #'@S3method blrNames<- ternaryVariables +#' +#'@usage \method{blrNames}{ternaryVariables}(s, ...) <- value +#' `blrNames<-.ternaryVariables` <- function( s, ..., @@ -180,6 +188,8 @@ #'@rdname blrLabels-methods #' +#'@usage blrLabels( s, ... ) <- value +#' #'@export #' `blrLabels<-` <- function( @@ -196,6 +206,9 @@ #' #'@method blrLabels<- ternarySystem #'@S3method blrLabels<- ternarySystem +#' +#'@usage \method{blrLabels}{ternarySystem}(s, ...) <- value +#' `blrLabels<-.ternarySystem` <- function( s, ..., @@ -214,6 +227,9 @@ #' #'@method blrLabels<- ternaryVariables #'@S3method blrLabels<- ternaryVariables +#' +#'@usage \method{blrLabels}{ternaryVariables}(s, ...) <- value +#' `blrLabels<-.ternaryVariables` <- function( s, ..., @@ -294,11 +310,13 @@ #'@rdname blrClock-methods #' +#'@usage blrClock( s, ... ) <- value +#' #'@export #' `blrClock<-` <- function( s, - ..., + ..., value ){ UseMethod( "blrClock<-" ) @@ -310,9 +328,12 @@ #' #'@method blrClock<- ternarySystem #'@S3method blrClock<- ternarySystem +#' +#'@usage \method{blrClock}{ternarySystem}(s, ...) <- value +#' `blrClock<-.ternarySystem` <- function( s, - ..., + ..., value ){ s[[ 'ternaryGeometry' ]][[ 'blrClock' ]] <- value @@ -328,9 +349,12 @@ #' #'@method blrClock<- ternaryGeometry #'@S3method blrClock<- ternaryGeometry +#' +#'@usage \method{blrClock}{ternaryGeometry}(s, ...) <- value +#' `blrClock<-.ternaryGeometry` <- function( s, - ..., + ..., value ){ s[[ 'blrClock' ]] <- value @@ -408,6 +432,8 @@ #'@rdname fracSum-methods #' +#'@usage fracSum( s, ... ) <- value +#' #'@export #' `fracSum<-` <- function( @@ -424,6 +450,9 @@ #' #'@method fracSum<- ternarySystem #'@S3method fracSum<- ternarySystem +#' +#'@usage \method{fracSum}{ternarySystem}(s, ...) <- value +#' `fracSum<-.ternarySystem` <- function( s, ..., @@ -442,6 +471,9 @@ #' #'@method fracSum<- ternaryGeometry #'@S3method fracSum<- ternaryGeometry +#' +#'@usage \method{fracSum}{ternaryGeometry}(s, ...) <- value +#' `fracSum<-.ternaryGeometry` <- function( s, ..., @@ -522,6 +554,8 @@ #'@rdname tlrAngles-methods #' +#'@usage tlrAngles( s, ... ) <- value +#' #'@export #' `tlrAngles<-` <- function( @@ -538,6 +572,9 @@ #' #'@method tlrAngles<- ternarySystem #'@S3method tlrAngles<- ternarySystem +#' +#'@usage \method{tlrAngles}{ternarySystem}(s, ...) <- value +#' `tlrAngles<-.ternarySystem` <- function( s, ..., @@ -556,6 +593,9 @@ #' #'@method tlrAngles<- ternaryGeometry #'@S3method tlrAngles<- ternaryGeometry +#' +#'@usage \method{tlrAngles}{ternaryGeometry}(s, ...) <- value +#' `tlrAngles<-.ternaryGeometry` <- function( s, ..., @@ -619,6 +659,8 @@ #'@rdname tlrAngles-methods #' +#'@usage ternaryGeometry( s, ... ) <- value +#' #'@export #' `ternaryGeometry<-` <- function( @@ -635,6 +677,9 @@ #' #'@method ternaryGeometry<- ternarySystem #'@S3method ternaryGeometry<- ternarySystem +#' +#'@usage \method{ternaryGeometry}{ternarySystem}( s, ... ) <- value +#' `ternaryGeometry<-.ternarySystem` <- function( s, ..., @@ -698,6 +743,8 @@ #'@rdname ternaryVariables-methods #' +#'@usage ternaryVariables( s, ... ) <- value +#' #'@export #' `ternaryVariables<-` <- function( @@ -714,6 +761,9 @@ #' #'@method ternaryVariables<- ternarySystem #'@S3method ternaryVariables<- ternarySystem +#' +#'@usage \method{ternaryVariables}{ternarySystem}( s, ... ) <- value +#' `ternaryVariables<-.ternarySystem` <- function( s, ..., Modified: pkg/ternaryplot/R/aa05-ternarydata.R =================================================================== --- pkg/ternaryplot/R/aa05-ternarydata.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/R/aa05-ternarydata.R 2014-03-28 16:47:09 UTC (rev 102) @@ -42,12 +42,11 @@ #' containing point ternary data (x-y-x) to be tested. #' #'@param .blrNames -#' Vector of 3 character strings. Column names of the variables -#' in \code{x} that corresponds to the bottom, left and right -#' variables in \code{s} (\code{blrNames(s)}). If \code{NULL}, -#' Columns and variable names in \code{x} and \code{s} should -#' match. +#' See \code{\link[ternaryplot]{blrNames}} #' +#'@param .fracSum +#' See \code{\link[ternaryplot]{fracSum}} +#' #'@param testRange #' Single logical. Test if the range of fraction is between 0 and #' the expected sum of fractions (1 or 100). Deleted: pkg/ternaryplot/R/functionsList.txt =================================================================== --- pkg/ternaryplot/R/functionsList.txt 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/R/functionsList.txt 2014-03-28 16:47:09 UTC (rev 102) @@ -1,146 +0,0 @@ - -aa01-ternaryplot-options.R - - tpPar - getTpPar - - .tpParList (environment) - tpParList (environment) - -aa02-ternaryplot-classes.R - - ternaryCheck ternaryGeometry ternaryVariables ternarySystem - createTernaryGeometry - createTernaryVariables - createTernarySystem - -aa03-ternaryplot-classes-utility.R - - blrNames ternaryVariables ternarySystem - blrNames<- ternaryVariables ternarySystem - blrLabels ternaryVariables ternarySystem - blrLabels<- ternaryVariables ternarySystem - blrClock ternaryGeometry ternarySystem - blrClock<- ternaryGeometry ternarySystem - fracSum ternaryGeometry ternarySystem - fracSum<- ternaryGeometry ternarySystem - tlrAngles ternaryGeometry ternarySystem - tlrAngles<- ternaryGeometry ternarySystem - ternaryGeometry ternarySystem - ternaryGeometry<- ternarySystem - ternaryVariables ternarySystem - ternaryVariables<- ternarySystem - -aa04-ternarySystems.R - - ternarySystemEnv (environment) - getTernarySystem - listTernarySystem - -onAttach.R - - .onAttach - -ternaryplot.R - - ternaryData ternarySystem character missing (includes tests) - - .setTernarySystem - ternaryWindow ternarySystem character missing - ternaryBox ternarySystem - ternaryPoints data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - ternarySegments data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - ternaryArrows data.frame >> make function of "ternarySystem character" (+ internal 'data' handling) - .ternaryGridBase ternarySystem - .ternaryTicks ternarySystem - ternaryGrid ternarySystem - - ternaryPlot data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - TO DO: type = "p" points, "l" lines, "b" both, "c" counts, - "de" density, "di" distance (contour chosen via "...") - TO DO: facet = {category}, fCol, fPch, zCol, zCex - TO DO: make axes ticks depend on axTicks() - TO DO: make arrows and arrows labels distance from the plot a function of margin size using par("plt") - and *backward* calculating the label position - - (1) regression between plt and usr (plt -> usr) for plotting points into margin, in X-axis margin (Y coordinates!) - (2) convert between axis margin line par( "mgp" )[2] to relative 0-1 coordinates of the margin, using par( "mar" ) - (= number of lines in the margin). Summary mgp -> 0-1 coords -> plt -> XY (usr) - transfMgpTo0_1() transf0_1ToPlt() transfPltToXY() - (3) converting from X-Y to ternary coordinates with ternary2xy() - that gives the Y-distance between the triangle frame and the axis labels - (4) Using that distance to position the other two axis arrows and labels - - ternaryLims data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - deg2rad - ternary2xy data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - ternaryClockSwitch data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - ternaryText data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) - .ternaryAxisArrowsBase ternarySystem - .ternaryAxisArrows ternarySystem - - TO DO: ternaryLines ternarySystem - - TO DO: ternaryPolygon ternarySystem - TO DO: ternaryClasses ternarySystem >> draw ternary classification systems - TO DO: ternaryClassify ternarySystem >> Same as ternaryOver - - TO DO: ternaryDensity ternarySystem - TO DO: ternaryBin ternarySystem - TO DO: ternaryDistance mahalanobis - TO DO: ternaryContour ternaryDensity ternaryBin - - TO DO: ternaryNormalise ternarySystem - - TO DO: as.data.frame ternarySystem >> what = "vertices" or "classes" - - TO DO: ternaryTheme( "default" ) Switch between themes - TO DO: more graphical parameters from par() can be overwritten with tpPar() - - TO DO: ternary2SpatialPointsDataFrame ternarySystem+data.frame or ternaryData or ternarySystem (includes extra columns) - TO DO: ternary2SpatialPolygonsDataFrame ternarySystem or ternaryPolygons (classes) - - TO DO: ternaryOver >> ternary version of sp::over - TO DO: ternaryAggregate >> ternary version of sp::aggregate - - TO DO: use ternaryGrid (ternaryPolygons) + ternaryAggregate to calculate summary statistics - - -Examples: - - Ternary Diagrams of Shepard and Pejrup: - http://rgm3.lab.nig.ac.jp/RGM/R_rdfile?f=rysgran/man/rysgran.ternary.Rd&d=R_CC - http://www.mgs.md.gov/coastal_geology/shepards.html - - QAPF diagram: - http://en.wikipedia.org/wiki/QAPF_diagram - - http://en.wikipedia.org/wiki/De_Finetti_diagram - -Graphical parameters: - - See plotParameters.xls - - Notes: - Number segments in arrows yes tpPar("arrow.seg") - Margins no tpPar("mar") - - type = - "n" nothing - "p" points (ternaryPoints) or text if !is.null(labels) (ternaryText) - "l" lines (ternaryLines) - "b" both points and lines - "d" density (ternaryGrid + ternaryDensity) - "c" counts (ternaryGrid + ternaryCounts) - - facet Factor variable for plot facets (sub-plots) - - extra A list of parameters passed to ternaryPoints or ternaryLines - fPch Factor variable for point symbols - fCol Factor variable for point or line colors - fLty Factor variable for line type - cCol Continuous variable for point or line colors use cut( x, breaks = 5 ) - cCex Continuous variable for point expansion use cut( x, breaks = 5 ) - position Legend position(s) (if several) - - \ No newline at end of file Modified: pkg/ternaryplot/R/ternarygrid.R =================================================================== --- pkg/ternaryplot/R/ternarygrid.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/R/ternarygrid.R 2014-03-28 16:47:09 UTC (rev 102) @@ -19,6 +19,9 @@ #' Either a single character string, or a \code{ternarySystem} #' object, as obtained from \code{\link[ternaryplot]{getTernarySystem}} #' +#'@param n +#' Single integer value. Number of intervals +#' #'@param \dots #' Additional parameters passed to specific methods. #' @@ -140,12 +143,14 @@ +# ternary2SpatialPolygonsDataFrame ============================== + #'Converts ternary*-class objects to SpatialPolygonsDataFrame #' #'Converts ternary*-class objects to \code{\link[sp]{SpatialPolygonsDataFrame}} #' #' -#'@param s +#'@param x #' A ternary*-class object. #' #'@param \dots @@ -173,6 +178,9 @@ #' #'@method ternary2SpatialPolygonsDataFrame ternaryPolygons #'@S3method ternary2SpatialPolygonsDataFrame ternaryPolygons +#' +#'@usage \method{ternary2SpatialPolygonsDataFrame}{ternaryPolygons}( x, ... ) +#' ternary2SpatialPolygonsDataFrame.ternaryPolygons <- function( x, ... Modified: pkg/ternaryplot/R/ternaryplot.R =================================================================== --- pkg/ternaryplot/R/ternaryplot.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/R/ternaryplot.R 2014-03-28 16:47:09 UTC (rev 102) @@ -79,8 +79,8 @@ #'@rdname ternaryWindow-methods #' -#'@method ternaryWindow character -#'@S3method ternaryWindow character +#'@method ternaryWindow ternarySystem +#'@S3method ternaryWindow ternarySystem ternaryWindow.ternarySystem <- function( s, x, Modified: pkg/ternaryplot/REVISION =================================================================== --- pkg/ternaryplot/REVISION 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/REVISION 2014-03-28 16:47:09 UTC (rev 102) @@ -1 +1 @@ -95:100M +95:101M Modified: pkg/ternaryplot/inst/examples/createTernarySystem-example.R =================================================================== --- pkg/ternaryplot/inst/examples/createTernarySystem-example.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/inst/examples/createTernarySystem-example.R 2014-03-28 16:47:09 UTC (rev 102) @@ -1,3 +1,4 @@ + library( "ternaryplot" ) @@ -11,8 +12,7 @@ "blrNames" = c( "CLAY", "SILT", "SAND" ), "blrLabels" = c( "Clay [%]", "Silt [%]", "Sand [%]" ) ), - "ternaryGeometry" = createTernaryGeometry( - "ternaryGeometry", + "ternaryGeometry" = createTernaryGeometry( ## "fracSum" = 100, "tlrAngles" = c( 45, 45, 90 ) # top, left, right angles ), Modified: pkg/ternaryplot/inst/examples/ternaryPlot-example.R =================================================================== --- pkg/ternaryplot/inst/examples/ternaryPlot-example.R 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/inst/examples/ternaryPlot-example.R 2014-03-28 16:47:09 UTC (rev 102) @@ -22,7 +22,7 @@ # ======================================================== # Set new orientation -blrClock( s ) <- rep( F, 3 ) +blrClock( s ) <- rep( FALSE, 3 ) # Plot ternaryPlot(s) @@ -32,7 +32,7 @@ # ======================================== # Set new orientation and angles -blrClock( s ) <- c( F, T, NA ) +blrClock( s ) <- c( FALSE, TRUE, NA ) tlrAngles( s ) <- c( 45, 90, 45 ) # Plot @@ -42,7 +42,7 @@ # Same, other direction # ===================== -blrClock( s ) <- c( T, NA, F ) +blrClock( s ) <- c( TRUE, NA, FALSE ) tlrAngles( s ) <- c(45,45,90) ternaryPlot(s) Modified: pkg/ternaryplot/man/blrClock-methods.Rd =================================================================== --- pkg/ternaryplot/man/blrClock-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/blrClock-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -14,12 +14,11 @@ \method{blrClock}{ternaryGeometry} (s, ...) - blrClock(s, ..., value) <- value + blrClock( s, ... ) <- value - \method{blrClock}{ternarySystem} (s, ..., value) <- value + \method{blrClock}{ternarySystem}(s, ...) <- value - \method{blrClock}{ternaryGeometry} (s, ..., value) <- - value + \method{blrClock}{ternaryGeometry}(s, ...) <- value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/blrLabels-methods.Rd =================================================================== --- pkg/ternaryplot/man/blrLabels-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/blrLabels-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -14,13 +14,11 @@ \method{blrLabels}{ternaryVariables} (s, ...) - blrLabels(s, ..., value) <- value + blrLabels( s, ... ) <- value - \method{blrLabels}{ternarySystem} (s, ..., value) <- - value + \method{blrLabels}{ternarySystem}(s, ...) <- value - \method{blrLabels}{ternaryVariables} (s, ..., value) <- - value + \method{blrLabels}{ternaryVariables}(s, ...) <- value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/blrNames-methods.Rd =================================================================== --- pkg/ternaryplot/man/blrNames-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/blrNames-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -14,12 +14,11 @@ \method{blrNames}{ternaryVariables} (s, ...) - blrNames(s, ..., value) <- value + blrNames( s, ... ) <- value - \method{blrNames}{ternarySystem} (s, ..., value) <- value + \method{blrNames}{ternarySystem}(s, ...) <- value - \method{blrNames}{ternaryVariables} (s, ..., value) <- - value + \method{blrNames}{ternaryVariables}(s, ...) <- value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/createTernaryGeometry.Rd =================================================================== --- pkg/ternaryplot/man/createTernaryGeometry.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/createTernaryGeometry.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -1,6 +1,5 @@ \name{createTernaryGeometry} \alias{createTernaryGeometry} -\alias{ternaryGeometry} \title{Creates a ternaryGeometry object: ternary plot geometry definition.} \usage{ createTernaryGeometry(tlrAngles = c(60, 60, 60), Modified: pkg/ternaryplot/man/createTernaryGrid-methods.Rd =================================================================== --- pkg/ternaryplot/man/createTernaryGrid-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/createTernaryGrid-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -16,6 +16,8 @@ \code{ternarySystem} object, as obtained from \code{\link[ternaryplot]{getTernarySystem}}} + \item{n}{Single integer value. Number of intervals} + \item{\dots}{Additional parameters passed to specific methods.} } Modified: pkg/ternaryplot/man/createTernarySystem.Rd =================================================================== --- pkg/ternaryplot/man/createTernarySystem.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/createTernarySystem.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -61,6 +61,7 @@ (in \code{classes}) with different \code{vertices}. } \examples{ + library( "ternaryplot" ) @@ -74,8 +75,7 @@ "blrNames" = c( "CLAY", "SILT", "SAND" ), "blrLabels" = c( "Clay [\%]", "Silt [\%]", "Sand [\%]" ) ), - "ternaryGeometry" = createTernaryGeometry( - "ternaryGeometry", + "ternaryGeometry" = createTernaryGeometry( ## "fracSum" = 100, "tlrAngles" = c( 45, 45, 90 ) # top, left, right angles ), Modified: pkg/ternaryplot/man/createTernaryVariables.Rd =================================================================== --- pkg/ternaryplot/man/createTernaryVariables.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/createTernaryVariables.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -1,6 +1,5 @@ \name{createTernaryVariables} \alias{createTernaryVariables} -\alias{ternaryVariables} \title{Creates a ternaryVariables object: ternary plot variables definitions.} \usage{ createTernaryVariables(blrNames = paste0("F", 1:3), Modified: pkg/ternaryplot/man/fracSum-methods.Rd =================================================================== --- pkg/ternaryplot/man/fracSum-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/fracSum-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -14,12 +14,11 @@ \method{fracSum}{ternaryGeometry} (s, ...) - fracSum(s, ..., value) <- value + fracSum( s, ... ) <- value - \method{fracSum}{ternarySystem} (s, ..., value) <- value + \method{fracSum}{ternarySystem}(s, ...) <- value - \method{fracSum}{ternaryGeometry} (s, ..., value) <- - value + \method{fracSum}{ternaryGeometry}(s, ...) <- value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/ternary2SpatialPolygonsDataFrame-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternary2SpatialPolygonsDataFrame-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternary2SpatialPolygonsDataFrame-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -5,11 +5,11 @@ \usage{ ternary2SpatialPolygonsDataFrame(x, ...) - \method{ternary2SpatialPolygonsDataFrame}{ternaryPolygons} - (x, ...) + \method{ternary2SpatialPolygonsDataFrame}{ternaryPolygons}( + x, ... ) } \arguments{ - \item{s}{A ternary*-class object.} + \item{x}{A ternary*-class object.} \item{\dots}{Additional parameters passed to specific methods.} Modified: pkg/ternaryplot/man/ternaryData-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryData-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternaryData-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -21,12 +21,10 @@ \code{\link[base]{matrix}} containing point ternary data (x-y-x) to be tested.} - \item{.blrNames}{Vector of 3 character strings. Column - names of the variables in \code{x} that corresponds to - the bottom, left and right variables in \code{s} - (\code{blrNames(s)}). If \code{NULL}, Columns and - variable names in \code{x} and \code{s} should match.} + \item{.blrNames}{See \code{\link[ternaryplot]{blrNames}}} + \item{.fracSum}{See \code{\link[ternaryplot]{fracSum}}} + \item{testRange}{Single logical. Test if the range of fraction is between 0 and the expected sum of fractions (1 or 100).} Modified: pkg/ternaryplot/man/ternaryGeometry-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryGeometry-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternaryGeometry-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -8,8 +8,8 @@ \method{ternaryGeometry}{ternarySystem} (s, ...) - \method{ternaryGeometry}{ternarySystem} (s, ..., value) - <- value + \method{ternaryGeometry}{ternarySystem}( s, ... ) <- + value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/ternaryPlot-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryPlot-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternaryPlot-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -62,7 +62,7 @@ # ======================================================== # Set new orientation -blrClock( s ) <- rep( F, 3 ) +blrClock( s ) <- rep( FALSE, 3 ) # Plot ternaryPlot(s) @@ -72,7 +72,7 @@ # ======================================== # Set new orientation and angles -blrClock( s ) <- c( F, T, NA ) +blrClock( s ) <- c( FALSE, TRUE, NA ) tlrAngles( s ) <- c( 45, 90, 45 ) # Plot @@ -82,7 +82,7 @@ # Same, other direction # ===================== -blrClock( s ) <- c( T, NA, F ) +blrClock( s ) <- c( TRUE, NA, FALSE ) tlrAngles( s ) <- c(45,45,90) ternaryPlot(s) Deleted: pkg/ternaryplot/man/ternarySystem-class.Rd =================================================================== --- pkg/ternaryplot/man/ternarySystem-class.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternarySystem-class.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -1,86 +0,0 @@ -\name{ternarySystem-class} -\alias{ternarySystem-class} -\title{Creates a ternarySystem object: ternary plot system definition.} -\usage{ - createTernarySystem(ternaryGeometry = NULL, - ternaryVariables = NULL, main = character(0), - vertices = NULL, classes = NULL, scale = NULL, ...) -} -\arguments{ - \item{ternaryGeometry}{A ternary geometry (as defined by - \code{\link[ternaryplot]{createTernaryGeometry}}). If - \code{NULL}, use the default output of - \code{\link[ternaryplot]{createTernaryGeometry}}.} - - \item{ternaryVariables}{A set of ternary variables (as - defined by - \code{\link[ternaryplot]{createTernaryVariables}}. If - \code{NULL}, use the default output of - \code{\link[ternaryplot]{createTernaryVariables}}.} - - \item{main}{Single character string. Title of the - triangle plot.} - - \item{vertices}{See \code{\link[ternaryplot]{tpPar}}. If - non-null, \code{\link[base]{data.frame}} with 4 columns: - \code{id}, and 3 other columns corresponding to - \code{blrNames} in \code{ternaryVariables}. If - \code{NULL}, default values will be used - \code{getTpPar("vertices")}, and the columns names - changed to those of \code{ternaryVariables}.} - - \item{classes}{See \code{\link[ternaryplot]{tpPar}}.} - - \item{scale}{See \code{\link[ternaryplot]{tpPar}}. If - non-null, \code{\link[base]{data.frame}} with 3 columns, - corresponding to \code{blrNames} in - \code{ternaryVariables}. If \code{NULL}, default values - will be used \code{getTpPar("scale")}, and the columns - names changed to those of \code{ternaryVariables}. NOT - USED YET.} - - \item{\dots}{Additional parameters passed to - \code{\link[ternaryplot]{ternaryCheck}}} -} -\description{ - Creates a ternarySystem object: ternary plot system - definition. -} -\details{ - Ternary systems are a combination of (a) a ternary - geometry (as defined by - \code{\link[ternaryplot]{createTernaryGeometry}}), (b) a - set of ternary variables (as defined by - \code{\link[ternaryplot]{createTernaryVariables}} and an - optional classification system, that is polygons drawn on - top of ternary plots, that define different zones in the - fractions. - - The classification is defined by a collection of polygons - (in \code{classes}) with different \code{vertices}. -} -\examples{ -library( "ternaryplot" ) - - -## Default variables -tsy <- createTernarySystem() -tsy - -## Custom variables -tsy2 <- createTernarySystem( - "ternaryVariables" = createTernaryVariables( - "blrNames" = c( "CLAY", "SILT", "SAND" ), - "blrLabels" = c( "Clay [\%]", "Silt [\%]", "Sand [\%]" ) - ), - "ternaryGeometry" = createTernaryGeometry( - "ternaryGeometry", - "fracSum" = 100, - "tlrAngles" = c( 45, 45, 90 ) # top, left, right angles - ), - "main" = "My ternary plot" ) - -tsy2 - -} - Modified: pkg/ternaryplot/man/ternaryVariables-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryVariables-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternaryVariables-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -9,10 +9,10 @@ \method{ternaryVariables}{ternarySystem} (s, ...) - ternaryVariables(s, ..., value) <- value + ternaryVariables( s, ... ) <- value - \method{ternaryVariables}{ternarySystem} (s, ..., value) - <- value + \method{ternaryVariables}{ternarySystem}( s, ... ) <- + value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/ternaryWindow-methods.Rd =================================================================== --- pkg/ternaryplot/man/ternaryWindow-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/ternaryWindow-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -9,8 +9,8 @@ \method{ternaryWindow}{character} (s, x, scale = FALSE, ...) - \method{ternaryWindow}{character} (s, x, scale = FALSE, - ...) + \method{ternaryWindow}{ternarySystem} (s, x, + scale = FALSE, ...) } \arguments{ \item{s}{A \code{ternarySystem} object, as created with Modified: pkg/ternaryplot/man/tlrAngles-methods.Rd =================================================================== --- pkg/ternaryplot/man/tlrAngles-methods.Rd 2014-03-28 15:15:38 UTC (rev 101) +++ pkg/ternaryplot/man/tlrAngles-methods.Rd 2014-03-28 16:47:09 UTC (rev 102) @@ -15,15 +15,13 @@ \method{tlrAngles}{ternaryGeometry} (s, ...) - tlrAngles(s, ..., value) <- value + tlrAngles( s, ... ) <- value - \method{tlrAngles}{ternarySystem} (s, ..., value) <- - value + \method{tlrAngles}{ternarySystem}(s, ...) <- value - \method{tlrAngles}{ternaryGeometry} (s, ..., value) <- - value + \method{tlrAngles}{ternaryGeometry}(s, ...) <- value - ternaryGeometry(s, ..., value) <- value + ternaryGeometry( s, ... ) <- value } \arguments{ \item{s}{A \code{ternarySystem} object, as created with From noreply at r-forge.r-project.org Fri Mar 28 17:50:32 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 17:50:32 +0100 (CET) Subject: [Soiltexture-commits] r103 - / pkg/ternaryplot prepare Message-ID: <20140328165032.7B709187397@r-forge.r-project.org> Author: jmoeys Date: 2014-03-28 17:50:31 +0100 (Fri, 28 Mar 2014) New Revision: 103 Added: prepare/plotParameters-plot.xls prepare/plotParameters-ternary.xls soiltexture_1_RCMDBUILD.bat soiltexture_2_RCMDcheck_noexamples.bat soiltexture_2_RCMDcheck_notests_novignette.bat soiltexture_3_RCMDINSTALL_build.BAT Removed: 1_RCMDBUILD.bat 1_RCMDBUILD.sh 2_RCMDcheck_noexamples.bat 2_RCMDcheck_noexamples.sh 2_RCMDcheck_notests_novignette.bat 2_RCMDcheck_notests_novignette.sh 3_RCMDINSTALL_build.BAT 3_RCMDINSTALL_build.sh ternaryplot_1_RCMDbuild_novignette.bat ternaryplot_2_RCMDcheck_notests_noexamples_novignettes.bat ternaryplot_vignette_compile.R Modified: packageUtilities.R pkg/ternaryplot/REVISION ternaryplot_1_RCMDbuild.bat ternaryplot_Document.R ternaryplot_ToDoList.TXT Log: Finlise conversion of ternaryplot from S4 to S3 Deleted: 1_RCMDBUILD.bat =================================================================== --- 1_RCMDBUILD.bat 2014-03-28 16:47:09 UTC (rev 102) +++ 1_RCMDBUILD.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -1,7 +0,0 @@ -set pkgname=soiltexture - -cd /D "%rPackagesDir%\%pkgname%\pkg" - -R CMD build --compact-vignettes="gs+qpdf" --md5 %pkgname% - -pause Deleted: 1_RCMDBUILD.sh =================================================================== --- 1_RCMDBUILD.sh 2014-03-28 16:47:09 UTC (rev 102) +++ 1_RCMDBUILD.sh 2014-03-28 16:50:31 UTC (rev 103) @@ -1,6 +0,0 @@ -# cd "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg/" -cd "/home/jmoeys/Documents/_WORK/R_PACKAGES/soiltexture/pkg/" -R CMD build --compact-vignettes soiltexture -echo "press any key to continue"; read line - - Deleted: 2_RCMDcheck_noexamples.bat =================================================================== --- 2_RCMDcheck_noexamples.bat 2014-03-28 16:47:09 UTC (rev 102) +++ 2_RCMDcheck_noexamples.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -1,9 +0,0 @@ -set pkgname=soiltexture - -cd /D "%rPackagesDir%\%pkgname%\pkg" - -R CMD check --no-examples --as-cran %pkgname%_1.2.13.tar.gz - - at REM --as-cran - -pause Deleted: 2_RCMDcheck_noexamples.sh =================================================================== --- 2_RCMDcheck_noexamples.sh 2014-03-28 16:47:09 UTC (rev 102) +++ 2_RCMDcheck_noexamples.sh 2014-03-28 16:50:31 UTC (rev 103) @@ -1,6 +0,0 @@ -# cd "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg/" -cd "/home/jmoeys/Documents/_WORK/R_PACKAGES/soiltexture/pkg/" -R CMD check --no-tests --as-cran soiltexture -echo "press any key to continue"; read line - - Deleted: 2_RCMDcheck_notests_novignette.bat =================================================================== --- 2_RCMDcheck_notests_novignette.bat 2014-03-28 16:47:09 UTC (rev 102) +++ 2_RCMDcheck_notests_novignette.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -1,9 +0,0 @@ -set pkgname=soiltexture - -cd /D "%rPackagesDir%\%pkgname%\pkg" - -R CMD check --no-tests --no-examples --no-vignettes %pkgname% - -REM --as-cran - -pause Deleted: 2_RCMDcheck_notests_novignette.sh =================================================================== --- 2_RCMDcheck_notests_novignette.sh 2014-03-28 16:47:09 UTC (rev 102) +++ 2_RCMDcheck_notests_novignette.sh 2014-03-28 16:50:31 UTC (rev 103) @@ -1,5 +0,0 @@ -cd "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg" -R CMD check --no-tests --no-vignettes --as-cran soiltexture -echo "press any key to continue"; read line - - Deleted: 3_RCMDINSTALL_build.BAT =================================================================== --- 3_RCMDINSTALL_build.BAT 2014-03-28 16:47:09 UTC (rev 102) +++ 3_RCMDINSTALL_build.BAT 2014-03-28 16:50:31 UTC (rev 103) @@ -1,7 +0,0 @@ -set pkgname=soiltexture - -cd /D "%rPackagesDir%\%pkgname%\pkg" - -R CMD INSTALL --build --compile-both --compact-docs --byte-compile %pkgname%_1.2.13.tar.gz - -pause Deleted: 3_RCMDINSTALL_build.sh =================================================================== --- 3_RCMDINSTALL_build.sh 2014-03-28 16:47:09 UTC (rev 102) +++ 3_RCMDINSTALL_build.sh 2014-03-28 16:50:31 UTC (rev 103) @@ -1,7 +0,0 @@ -# cd "/home/jules/Documents/_WORK/R_PACKAGES/soiltexture/pkg/" -cd "/home/jmoeys/Documents/_WORK/R_PACKAGES/soiltexture/pkg/" -R CMD INSTALL --build --compact-docs --byte-compile soiltexture -echo "press any key to continue"; read line - - - Modified: packageUtilities.R =================================================================== --- packageUtilities.R 2014-03-28 16:47:09 UTC (rev 102) +++ packageUtilities.R 2014-03-28 16:50:31 UTC (rev 103) @@ -62,10 +62,14 @@ ### Vector of character strings. Names of the packages that needs to be installed ### prior to the package installation. NULL if none - pkgSuggests=NULL + pkgSuggests=NULL, ### Vector of character string. Names of the packages that needs ### to be cited in the "Suggests" field. NULL if none + pkgImports=NULL +### Vector of character string. Names of the packages that needs +### to be cited in the "Imports" field. NULL if none + ){ # Read the file DESCRIPTION desc <- readLines( @@ -148,16 +152,51 @@ sep = "" ) - if( any( desc.sel2 ) ) - { - desc[ desc.sel2 ] <- suggests.txt + if( is.null( pkgSuggests ) ){ + desc <- desc[ !desc.sel2 ] + }else{ - desc <- c( - desc, - suggests.txt - ) + if( any( desc.sel2 ) ){ + desc[ desc.sel2 ] <- suggests.txt + }else{ + desc <- c( + desc, + suggests.txt + ) + } } + + + # Find where the "Imports:" line is + desc.sel2 <- substr( + x = desc, + start = 1, + stop = nchar("Imports:") + ) == "Imports:" + + imports.txt <- paste( + "Imports: ", + paste( pkgImports, collapse = ", " ), + sep = "" + ) + if( is.null( pkgImports ) ){ + desc <- desc[ !desc.sel2 ] + + }else{ + if( any( desc.sel2 ) ) + { + desc[ desc.sel2 ] <- imports.txt + }else{ + desc <- c( + desc, + imports.txt + ) + } + } + + + # Write again the description file: desc <- writeLines( con = file.path( Modified: pkg/ternaryplot/REVISION =================================================================== --- pkg/ternaryplot/REVISION 2014-03-28 16:47:09 UTC (rev 102) +++ pkg/ternaryplot/REVISION 2014-03-28 16:50:31 UTC (rev 103) @@ -1 +1 @@ -95:101M +95:102M Added: prepare/plotParameters-plot.xls =================================================================== (Binary files differ) Property changes on: prepare/plotParameters-plot.xls ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: prepare/plotParameters-ternary.xls =================================================================== (Binary files differ) Property changes on: prepare/plotParameters-ternary.xls ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: soiltexture_1_RCMDBUILD.bat (from rev 98, 1_RCMDBUILD.bat) =================================================================== --- soiltexture_1_RCMDBUILD.bat (rev 0) +++ soiltexture_1_RCMDBUILD.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -0,0 +1,7 @@ +set pkgname=soiltexture + +cd /D "%rPackagesDir%\%pkgname%\pkg" + +R CMD build --compact-vignettes="gs+qpdf" --md5 %pkgname% + +pause Copied: soiltexture_2_RCMDcheck_noexamples.bat (from rev 97, 2_RCMDcheck_noexamples.bat) =================================================================== --- soiltexture_2_RCMDcheck_noexamples.bat (rev 0) +++ soiltexture_2_RCMDcheck_noexamples.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -0,0 +1,9 @@ +set pkgname=soiltexture + +cd /D "%rPackagesDir%\%pkgname%\pkg" + +R CMD check --no-examples --as-cran %pkgname%_1.2.13.tar.gz + + at REM --as-cran + +pause Copied: soiltexture_2_RCMDcheck_notests_novignette.bat (from rev 95, 2_RCMDcheck_notests_novignette.bat) =================================================================== --- soiltexture_2_RCMDcheck_notests_novignette.bat (rev 0) +++ soiltexture_2_RCMDcheck_notests_novignette.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -0,0 +1,9 @@ +set pkgname=soiltexture + +cd /D "%rPackagesDir%\%pkgname%\pkg" + +R CMD check --no-tests --no-examples --no-vignettes %pkgname% + +REM --as-cran + +pause Copied: soiltexture_3_RCMDINSTALL_build.BAT (from rev 97, 3_RCMDINSTALL_build.BAT) =================================================================== --- soiltexture_3_RCMDINSTALL_build.BAT (rev 0) +++ soiltexture_3_RCMDINSTALL_build.BAT 2014-03-28 16:50:31 UTC (rev 103) @@ -0,0 +1,7 @@ +set pkgname=soiltexture + +cd /D "%rPackagesDir%\%pkgname%\pkg" + +R CMD INSTALL --build --compile-both --compact-docs --byte-compile %pkgname%_1.2.13.tar.gz + +pause Modified: ternaryplot_1_RCMDbuild.bat =================================================================== --- ternaryplot_1_RCMDbuild.bat 2014-03-28 16:47:09 UTC (rev 102) +++ ternaryplot_1_RCMDbuild.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -2,6 +2,8 @@ cd /D "%rPackagesDir%\soiltexture\pkg" +svnversion > %pkgname%\REVISION + R CMD build --compact-vignettes="gs+qpdf" %pkgname% pause Deleted: ternaryplot_1_RCMDbuild_novignette.bat =================================================================== --- ternaryplot_1_RCMDbuild_novignette.bat 2014-03-28 16:47:09 UTC (rev 102) +++ ternaryplot_1_RCMDbuild_novignette.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -1,7 +0,0 @@ -set pkgname=ternaryplot - -cd /D "%rPackagesDir%\%pkgname%\pkg" - -R CMD build --no-vignettes --compact-vignette="gs" %pkgname% - -pause Deleted: ternaryplot_2_RCMDcheck_notests_noexamples_novignettes.bat =================================================================== --- ternaryplot_2_RCMDcheck_notests_noexamples_novignettes.bat 2014-03-28 16:47:09 UTC (rev 102) +++ ternaryplot_2_RCMDcheck_notests_noexamples_novignettes.bat 2014-03-28 16:50:31 UTC (rev 103) @@ -1,9 +0,0 @@ -set pkgname=ternaryplot - -cd /D "%rPackagesDir%\%pkgname%\pkg" - -R CMD check --no-tests --no-examples --no-vignettes %pkgname% - - at REM --as-cran - -pause Modified: ternaryplot_Document.R =================================================================== --- ternaryplot_Document.R 2014-03-28 16:47:09 UTC (rev 102) +++ ternaryplot_Document.R 2014-03-28 16:50:31 UTC (rev 103) @@ -15,9 +15,10 @@ pkgDescription( pkgName = pkgName, pkgDir = pkgDir, - pkgVersion = "0.1.2", - pkgDepends = "methods", + pkgVersion = "0.3.0", + pkgDepends = c( "sp", "MASS" ), pkgSuggests = NULL, + pkgImports = NULL, RVersion = NULL ) Modified: ternaryplot_ToDoList.TXT =================================================================== --- ternaryplot_ToDoList.TXT 2014-03-28 16:47:09 UTC (rev 102) +++ ternaryplot_ToDoList.TXT 2014-03-28 16:50:31 UTC (rev 103) @@ -1,38 +1,146 @@ -Create functions - blrLabels to set the labels +aa01-ternaryplot-options.R - ternaryPlot() - Add ticks labels - DONE: Add arrows - fix axis arrows labels pos and srt - - ternaryAxis() that bundles ticks, ticks labels, - arrows and arrows label - - fix axis arrows labels pos and srt + tpPar + getTpPar - DONE: ternaryPoints() to plot points on ternary plots + .tpParList (environment) + tpParList (environment) - ternaryLines() to plot lines on ternary plots +aa02-ternaryplot-classes.R - DONE: ternarySegment() to plot segments on ternary plot + ternaryCheck ternaryGeometry ternaryVariables ternarySystem + createTernaryGeometry + createTernaryVariables + createTernarySystem + +aa03-ternaryplot-classes-utility.R + + blrNames ternaryVariables ternarySystem + blrNames<- ternaryVariables ternarySystem + blrLabels ternaryVariables ternarySystem + blrLabels<- ternaryVariables ternarySystem + blrClock ternaryGeometry ternarySystem + blrClock<- ternaryGeometry ternarySystem + fracSum ternaryGeometry ternarySystem + fracSum<- ternaryGeometry ternarySystem + tlrAngles ternaryGeometry ternarySystem + tlrAngles<- ternaryGeometry ternarySystem + ternaryGeometry ternarySystem + ternaryGeometry<- ternarySystem + ternaryVariables ternarySystem + ternaryVariables<- ternarySystem + +aa04-ternarySystems.R + + ternarySystemEnv (environment) + getTernarySystem + listTernarySystem - DONE: ternaryArrows() to plot arrows on a ternary plot +onAttach.R - ternaryPolygons() to plot polygons on ternary plots + .onAttach + +ternaryplot.R - ternaryClass() that plot ternary classes (polygons + labels) + ternaryData ternarySystem character missing (includes tests) - ternaryClassify() that classify according to ternary classes + .setTernarySystem + ternaryWindow ternarySystem character missing + ternaryBox ternarySystem + ternaryPoints data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + ternarySegments data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + ternaryArrows data.frame >> make function of "ternarySystem character" (+ internal 'data' handling) + .ternaryGridBase ternarySystem + .ternaryTicks ternarySystem + ternaryGrid ternarySystem + ternaryPlot data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + TO DO: type = "p" points, "l" lines, "b" both, "c" counts, + "de" density, "di" distance (contour chosen via "...") + TO DO: facet = {category}, fCol, fPch, zCol, zCex + TO DO: make axes ticks depend on axTicks() + TO DO: make arrows and arrows labels distance from the plot a function of margin size using par("plt") + and *backward* calculating the label position + + (1) regression between plt and usr (plt -> usr) for plotting points into margin, in X-axis margin (Y coordinates!) + (2) convert between axis margin line par( "mgp" )[2] to relative 0-1 coordinates of the margin, using par( "mar" ) + (= number of lines in the margin). Summary mgp -> 0-1 coords -> plt -> XY (usr) + transfMgpTo0_1() transf0_1ToPlt() transfPltToXY() + (3) converting from X-Y to ternary coordinates with ternary2xy() + that gives the Y-distance between the triangle frame and the axis labels + (4) Using that distance to position the other two axis arrows and labels + ternaryLims data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + deg2rad + ternary2xy data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + ternaryClockSwitch data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + ternaryText data.frame matrix >> make function of "ternarySystem character" (+ internal 'data' handling) + .ternaryAxisArrowsBase ternarySystem + .ternaryAxisArrows ternarySystem + + TO DO: ternaryLines ternarySystem + + TO DO: ternaryPolygon ternarySystem + TO DO: ternaryClasses ternarySystem >> draw ternary classification systems + TO DO: ternaryClassify ternarySystem >> Same as ternaryOver + + TO DO: ternaryDensity ternarySystem + TO DO: ternaryBin ternarySystem + TO DO: ternaryDistance mahalanobis + TO DO: ternaryContour ternaryDensity ternaryBin + + TO DO: ternaryNormalise ternarySystem + + TO DO: as.data.frame ternarySystem >> what = "vertices" or "classes" + + TO DO: ternaryTheme( "default" ) Switch between themes + TO DO: more graphical parameters from par() can be overwritten with tpPar() + + TO DO: ternary2SpatialPointsDataFrame ternarySystem+data.frame or ternaryData or ternarySystem (includes extra columns) + TO DO: ternary2SpatialPolygonsDataFrame ternarySystem or ternaryPolygons (classes) + + TO DO: ternaryOver >> ternary version of sp::over + TO DO: ternaryAggregate >> ternary version of sp::aggregate + + TO DO: use ternaryGrid (ternaryPolygons) + ternaryAggregate to calculate summary statistics + + +Examples: + + Ternary Diagrams of Shepard and Pejrup: + http://rgm3.lab.nig.ac.jp/RGM/R_rdfile?f=rysgran/man/rysgran.ternary.Rd&d=R_CC + http://www.mgs.md.gov/coastal_geology/shepards.html + + QAPF diagram: + http://en.wikipedia.org/wiki/QAPF_diagram + + http://en.wikipedia.org/wiki/De_Finetti_diagram - -### Classes - -class texturePlot - ternarySystem - silt-sand limit - -NB: particle size transformations shall be done *before* plotting. +Graphical parameters: + + See plotParameters.xls + + Notes: + Number segments in arrows yes tpPar("arrow.seg") + Margins no tpPar("mar") + + type = + "n" nothing + "p" points (ternaryPoints) or text if !is.null(labels) (ternaryText) + "l" lines (ternaryLines) + "b" both points and lines + "d" density (ternaryGrid + ternaryDensity) + "c" counts (ternaryGrid + ternaryCounts) + + facet Factor variable for plot facets (sub-plots) + + extra A list of parameters passed to ternaryPoints or ternaryLines + fPch Factor variable for point symbols + fCol Factor variable for point or line colors + fLty Factor variable for line type + cCol Continuous variable for point or line colors use cut( x, breaks = 5 ) + cCex Continuous variable for point expansion use cut( x, breaks = 5 ) + position Legend position(s) (if several) + + \ No newline at end of file Deleted: ternaryplot_vignette_compile.R =================================================================== --- ternaryplot_vignette_compile.R 2014-03-28 16:47:09 UTC (rev 102) +++ ternaryplot_vignette_compile.R 2014-03-28 16:50:31 UTC (rev 103) @@ -1,26 +0,0 @@ -rm(list=ls(all=TRUE)) -pkg.name <- "template" -rootDir <- "C:/_R_PACKAGES" - - - -setwd( file.path( rootDir, pkg.name, "pkg", pkg.name, "inst/doc" ) ) - -Stangle( paste( pkg.name, "vignette.Rnw", sep = "_" ) - -Sweave( paste( pkg.name, "vignette.Rnw", sep = "_" ) - -msg <- tools::texi2dvi( - file = paste( pkg.name, "vignette.tex", sep = "_", - pdf = TRUE, - clean = TRUE, - texinputs = getwd() -) # - -file.remove( list.files( getwd(), "\\.tex$", full.names = TRUE ) ) -file.remove( list.files( getwd(), "\\.bib.bak$", full.names = TRUE ) ) -file.remove( list.files( getwd(), "\\.R$", full.names = TRUE ) ) - -library("tools") -res <- compactPDF( paths = getwd(), gs_quality = "ebook" ) # paste(sep="",file.name.root,".pdf") -res