Version: | 0.6-1 |
Date: | 2017-03-12 |
Title: | Groundwater Data Presentation and Interpretation |
Author: | Myles English <myles@rockhead.biz> |
Maintainer: | Myles English <myles@rockhead.biz> |
Copyright: | Myles English <myles@rockhead.biz> |
Description: | Contains one function for drawing Piper diagrams (also called Piper-Hill diagrams) of water analyses for major ions. |
Depends: | R (≥ 2.6.0) |
Imports: | methods |
License: | BSD_2_clause + file LICENCE |
URL: | http://rockhead.biz |
NeedsCompilation: | no |
Repository: | CRAN |
Date/Publication: | 2017-03-12 18:43:05 |
RoxygenNote: | 6.0.1 |
Suggests: | testthat |
Packaged: | 2017-03-12 16:03:40 UTC; myles |
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 myles@rockhead.biz
See Also
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, |
... |
additional arguments, as for |
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 |
call |
the call that asked for the new piper object |
pt.col |
Object of class |
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 classpiper
-
show
: Show an object of classpiper
Slots
Ca
Object of class
vector
— CalciumMg
Object of class
vector
— MagnesiumCl
Object of class
vector
— ChlorideSO4
Object of class
vector
— Sulphateanion.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 identifierspt.col
Object of class
vector
of colours for pointspt.pch
Object of class
vector
of symbols for pointscall
Object of class
character
— call that created it
Author(s)
Myles English myles@rockhead.biz
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 |
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 300call
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 levelsTertiary, 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 levelsmeq/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)