Package 'hydrogeo'

Title: Groundwater Data Presentation and Interpretation
Description: Contains one function for drawing Piper diagrams (also called Piper-Hill diagrams) of water analyses for major ions.
Authors: Myles English <[email protected]>
Maintainer: Myles English <[email protected]>
License: BSD_2_clause + file LICENCE
Version: 0.6-1
Built: 2024-12-11 07:08:23 UTC
Source: CRAN

Help Index


Groundwater data presentation and interpretation.

Description

Contains one function, for drawing Piper (or Piper-Hill) diagrams from water analyses for major ions, and a dataset from Zaporozec

Details

Package: hydrogeo
Type: Package
Version: 0.5-1
Date: 2016-11-17
License: BSD
LazyLoad: yes

Author(s)

Myles English [email protected]

See Also

piper and toPercent zaporozec

Examples

library(hydrogeo)
data(zaporozec)
zaporozec$CO3 <- rep(0,9) # toPercent expects CO3
zaporozec$Na <- rep(0,9)  # toPercent expects Na
z <- toPercent(zaporozec)
pz <- piper(z)
plot(pz,cex=1.5)

Create a new piper object

Description

Create a new piper object

Usage

piper(d, ...)

Arguments

d

list passed to class piper, piper

...

additional arguments, as for piper

See Also

piper-class and toPercent


Class piper

Description

Objects of this class are plotable as Piper-Hill diagrams. A dataframe of major ions as percentages can be used to initialise a piper object.

Usage

## S4 method for signature 'piper'
initialize(.Object, l, ..., call = NULL, pt.col = NULL)

## S4 method for signature 'piperplot'
labelAxes(x, cex.axis = 0.35, side = -1, ...)

## S4 method for signature 'piper'
plot(x, type = "p", cex = 0.75, ...)

## S4 method for signature 'piper'
show(object)

Arguments

.Object

object of class piper

l

list of data, see 'Examples' below

...

additional arguments, as for piper

call

the call that asked for the new piper object

pt.col

Object of class vector of colours for points

x

an object of class piperplot

cex.axis

magnification to be used for axis annotation relative to the current setting of 'cex', see help("par")

side

integer between 1 and 10 specifying which side to lable, the default is to label all

type

what type of plot should be drawn, only "p" for *p*oints is useful

cex

magnification to be used for symbols relative to the current setting of 'cex', see help("par")

object

an object of class piper

Methods (by generic)

  • initialize: Initialiser

  • labelAxes: Label the axes

  • plot: Plot an object of class piper

  • show: Show an object of class piper

Slots

Ca

Object of class vector — Calcium

Mg

Object of class vector — Magnesium

Cl

Object of class vector — Chloride

SO4

Object of class vector — Sulphate

anion.x

x coordinate of the point on the anion triangle (internal)

anion.y

y coordinate of the point on the anion triangle (internal)

cation.x

x coordinate of the point on the cation triangle (internal)

cation.y

y coordinate of the point on the cation triangle (internal)

diamond.x

x coordinate of the point on the diamond (internal)

diamond.y

y coordinate of the point on the anion diamond (internal)

IDs

Object of class vector of sample identifiers

pt.col

Object of class vector of colours for points

pt.pch

Object of class vector of symbols for points

call

Object of class character — call that created it

Author(s)

Myles English [email protected]

References

A. Zaporozec, “Graphical interpretation of water quality data,” Ground Water 10, no. 2 (1972): 32–43.

Examples

showClass("piper")

l <- list( Ca = c(43,10,73,26,32),
           Mg = c(30,50,3,14,12),
           Cl = c(24,10,12,30,43),
           SO4 = c(24,10,12,30,43))

lp <- piper(l)
plot( lp, main="Piper-Hill Diagram of Water Quality" )

# change symbols and colours to differentiate water type groups
lp@pt.pch = c(2,2,4,4,4)
lp@pt.col = c(0,1,0,1,2)

# use larger symbols
plot( lp, main="Piper-Hill Diagram of Water Quality", cex=1.4 )

Create a new piperplot object

Description

Create a new piperplot object

Usage

piperPaper(size = NULL, ...)

Arguments

size

integer related to the size of the plot area

...

additional arguments, as for piperplot

Examples

library(hydrogeo)
p = piperPaper(size=1)
plot(p)

Class piperplot

Description

Objects of this class are plottable as empty (i.e. no points) Piper-Hill diagrams

Usage

## S4 method for signature 'piperplot'
Axis(x = NULL)

Arguments

x

an object of class piperplot

Methods (by generic)

  • Axis: Add axes to a piperplot

Slots

size

Object of class numeric — Length of the (square) plot area, defaults to 300

call

R call that created it


Plot the diagram area with two triangles and a diamond

Description

Plot the diagram area with two triangles and a diamond

Usage

## S4 method for signature 'piperplot'
plot(x, axes = TRUE, ...)

Arguments

x

object of class piperplot

axes

logical saying whether to draw the axes or not, defaults to TRUE

...

further arguments to plot.default


Major ions as a percentage of total major ions - Test Data

Description

Major ions as a percentage of total major ions - Test Data

Usage

testData(n)

Arguments

n

Number of test samples to be generated.

Examples

library(hydrogeo)
lp <- piper( testData(26) )

Major ions as a percentage of total major ions

Description

Expects certain column names

Usage

toPercent(d)

Arguments

d

list or data.frame with the following columns: Ca, Mg, Na, K and Cl, SO4, CO3, HCO3

Examples

library(hydrogeo)
l <- list( Ca = c(43,10,73,26,32),
          Mg = c(30,50,83,14,62),
          Na = c(54,76,3,14,12),
          K = c(31,22,32,22,11),
          Cl = c(24,10,12,30,43),
          SO4 = c(24,10,12,30,43),
	  CO3 = c(24,10,12,30,43),
	  HCO3 = c(42,110,12,3,4),
          IDs = c("A","B","C","D","E") )
d <- toPercent(l)
# check, should add up to 100%
z <- as.data.frame(d)
for(i in 1:length(z[[1]])) { print(sum(z[i,5:8])) }
for(i in 1:length(z[[1]])) { print(sum(z[i,1:4])) }

Major ions for groundwaters reported by Zaporozec

Description

This data set contains major ion analyses for three groundwaters.

Format

A data frame with 9 observations on the following 15 variables:

  • location a factor with levels Tertiary, Czechoslovakia Upper Cambrian, Wisconsin Upper Cretaceous, Czechoslovakia

  • K a numeric vector - potassium

  • Mg a numeric vector - magnesium

  • Ca a numeric vector - calcium

  • Mn a numeric vector - magnesium

  • Fe a numeric vector - iron

  • Cl a numeric vector - chloride

  • NO3 a numeric vector - nitrate

  • HCO3 a numeric vector - bicarbonate

  • SO4 a numeric vector - sulphate

  • sigma a numeric vector - standard deviation

  • TDS a numeric vector - total dissolved solids

  • tempC a numeric vector - temperature

  • pH a numeric vector - pH

  • units a factor with levels meq/l meq_pc mg/l

Source

Zaporozec, “Graphical interpretation of water quality data,” Ground Water 10, no. 2 (1972): pages 32–43.

Examples

data(zaporozec)
str(zaporozec)