Type: Package
Title: Water and Measurements Quality
Version: 1.4
Date: 2025-04-13
Author: Maela Lupo [aut, cre], Andrea Porpatto [aut], Rosa Marzullo [aut], Alfredo Rigalli [aut]
Maintainer: Maela Lupo <maela.lupo@gmail.com>
Description: The functions proposed in this package allows to evaluate the process of measurement of the chemical components of water numerically or graphically. TSSS(), ICHS and datacheck() functions are useful to control the quality of measurements of chemical components of a sample of water. If one or more measurements include an error, the generated graph will indicate it with a position of the point that represents the sample outside the confidence interval. The function CI() allows to evaluate the possibility of contamination of a water sample after being obtained. Validation() is a function that allows to calculate the quality parameters of a technique for the measurement of a chemical component.
License: GPL-2
NeedsCompilation: no
Packaged: 2025-04-13 11:48:24 UTC; tresalamos
Depends: R (≥ 3.5.0)
Repository: CRAN
Date/Publication: 2025-04-13 12:30:01 UTC

Water and Measurements Quality

Description

The package allows you tu evaluate graphically the quality of measurements of water components

Details

The package includes five functions: TSSS(), ICHS(), datacheck(), validation() and CI(). The TSSS()function allows evaluating the quality of a set of measurement of water components, which correlate with total soluble solids. On the other hand, the ICHS() function allows evaluating the quality of a set of measurement of water components, which correlate with conductivity. The function CI() allows to evaluate the possibility of contamination of a water sample after being obtained. The function datacheck indicates de registers of a database that do not match simultaneously correlation of mass summation of chemical components with total soluble solids and correlation of charge summation of chemical components with conductivity. The function validation() allows to calculate the quality parameters of a technique for the measurement of a chemical component.

Author(s)

Maela Lupo [aut, cre], Andrea Porpatto [aut], Rosa Marzullo [aut], Alfredo Rigalli [aut] Maintainer: Maela Lupo email: maela.lupo@gmail.com


Contamination Index

Description

Calculate an index that allows to estimate the possibility of microbiological contamination of a water sample after being obtaines.

Usage

CI(sample,data)

Arguments

sample

Code of the sample whose quality you want to know.

data

Data.frame containing code of the database samples,and de concentration of the following chemical components: phosphate, nitrate, nitrite, tkn, ammonium, chemical demand of oxygen (dqo), biological demand of oxygen (dbo) and organic matter.

Details

The CI() function performs the calculation of a score whose value allows to estimate the possibility of microbiological contamination of a water sample after being obtained.

Value

The CI() function returns a number (score). If score>=0 and score<= 2, the sample is not contaminable. If score>2 and score<= 4, the sample is hardly contaminable. If score>4 and score <= 6), the sample is possibly contaminable. If score>6 and score<= 8, the sample is easily contaminable.

Author(s)

Maela Lupo, Andrea Porpatto, Rosa Marzullo, Alfredo Rigalli


Ionic Charge Summation

Description

Plots ionic charge summation as a function of conductivity.

Usage

ICHS(sample, data, conflevel = 0.95, pchdata = 19, coldata = "green", cexdata = 0.5,
 pchsample = 19, colsample = "red", cexsample = 3, xaxis = "CONDUCTIVITY", 
yaxis = "IONIC CHARGE SUMMATION", title = paste("Sample ", as.character(sample)),
 linetyprediction = 2, linewidthprediction = 1, linecolorprediction = 5)

Arguments

sample

Code of the sample whose quality you want to know.

data

Data.frame containing code of the database samples, conductivity, measurements of ionic water components.

conflevel

Significance level used in the predict function.

pchdata

Symbol used to graph all the data in the data.frame.

coldata

Color of the symbols of all the data in the data.frame.

cexdata

Symbol size of all data in the data frame.

pchsample

Symbol chosen to represent the point whose measurement quality is to be represented.

colsample

Color chosen to represent the point whose measurement quality is to be represented.

cexsample

Size of the symbol chosen to represent the point whose measurement quality is to be represented.

xaxis

X axis label.

yaxis

Y axis label.

title

Title of the graph including the code of the chosen sample.

linetyprediction

Linear model prediction line type.

linewidthprediction

Linear model prediction line thickness.

linecolorprediction

Linear model prediction line color.

Details

The ICHS() function performs a linear model using column 2 (conductivity) as the independent variable and the other components of water as dependent variables (columns 3 onwards). Based on the linear model, a data prediction interval is obtained with a certain confidence level (conflevel). Then, ICHS() graphs the values of the entire database and finally graphs as a point with different color, the sample whose measurement quality you want to observe.

Value

The ICHS() function returns a graph of the sum of ionic chemical components as a function of the measurement of conductivity for each sample. It contains the confidence interval indicated in a dotted line, and the sample under observation. If the point that represents the sample is within the region delimited by the lines of the confidence interval, it is presumed that there were no serious measurement errors of the components analyzed.

Author(s)

Maela Lupo, Andrea Porpatto, Alfredo Rigalli


Total Soluble Solids Summation

Description

Plot total soluble solids summation as a function of total soluble solids measurement.

Usage

TSSS(sample, data, conflevel = 0.95, pchdata = 19, coldata = "green", cexdata = 0.5,
pchsample = 19, colsample = "red", cexsample = 3, xaxis = "TOTAL SOLUBLE SOLIDS",
yaxis = "MASS SUMMATION", title = paste("Sample ", as.character(sample)), 
linetyprediction = 2, linewidthprediction = 1, linecolorprediction = 5)

Arguments

sample

Code of the sample whose quality you want to know.

data

Data.frame containing code of the database samples, total soluble solids, measurements of other water components.

conflevel

Significance level used in the predict function.

pchdata

Symbol used to graph all the data in the data.frame.

coldata

Color of the symbols of all the data in the data.frame.

cexdata

Symbol size of all data in the data frame.

pchsample

Symbol chosen to represent the point whose measurement quality is to be represented.

colsample

Color chosen to represent the point whose measurement quality is to be represented.

cexsample

Size of the symbol chosen to represent the point whose measurement quality is to be represented.

xaxis

X axis label.

yaxis

Y axis label.

title

Title of the graph including the code of the chosen sample.

linetyprediction

Linear model prediction line type.

linewidthprediction

Linear model prediction line thickness.

linecolorprediction

Linear model prediction line color.

Details

The TSSS() function performs a linear model using column 2 (total soluble solids) as the dependent variable and the other components of water as independent variables (columns 3 onwards). Based on the linear model, a data prediction interval is obtained with a certain confidence level (conflevel). Then, TSSS() graphs the values of the entire database and finally graphs as a point with different color, the sample whose measurement quality you want to observe.

Value

The TSSS() function returns a graph of the sum of soluble solids as a function of the measurement of total soluble solids for each sample. It contains the confidence interval and the sample under observation indicated in a dotted line. If the point that represents the sample is within the region delimited by the lines of the confidence interval, it is presumed that there were no serious measurement errors of the components analyzed.

Author(s)

Maela Lupo, Andrea Porpatto, Alfredo Rigalli


Data Sets~~

Description

Data.frame with data for testing the CI() (Contamination Index) function. Column 1: sample identification code. Column 2: onwards: measurement of chemical components of water used to calculate CI, expressed in ppm.

Usage

data("dataCI")

Format

A data frame with 6 observations on the following 9 variables.

code

a character vector

phosphate

a numeric vector

nitrate

a numeric vector

nitrite

a numeric vector

ammonium

a numeric vector

dqo

a numeric vector

tkn

a numeric vector

organicmatter

a character vector

dbo

a numeric vector

Examples

# Including data.frame: dataCI in workspace.
data("dataCI")
# Column names of data.frame: dataCI
names(dataCI) 
# Data set type of columns of data.frame: dataCI.
str(dataCI)
# Calculation of CI for the sample A1
#The following code should calculate the CI for the sample A1 included in dataCI, which 
# is not acceptable as drinking water and is possibly contaminable. 
CI("A1",dataCI)
#The following code should calculate the CI for the sample A2 included in dataCI, which 
#is acceptable as drinking water and is hardly contaminable. 
CI("A3",dataCI)

Data Sets

Description

Data.frame with data for testing the ICHS() (Ionic Charge Summation) function. Column 1: sample identification code. Column 2: measurement of water conductivity. Column3 onwards: measurement of ionic chemical components of water expressed in milliequivalent per litre.

Usage

data("dataICHS")

Format

A data frame with 411 observations on the following 14 variables.

codigo

a character vector

conductividad

a numeric vector

cargacloruro

a numeric vector

cargacarbonato

a numeric vector

cargabicarbonato

a numeric vector

cargafosfato

a numeric vector

carganitrato

a numeric vector

carganitrito

a numeric vector

cargafloruro

a numeric vector

cargaarcenico

a numeric vector

cargaamonio

a numeric vector

cargasulfato

a numeric vector

cargasodio

a numeric vector

cargacalcio

a numeric vector

Examples

# Including data.frame: data in workspace.
data("dataICHS")
# Column names of data.frame: data
names(dataICHS) 
# Data set type of columns of data.frame: data.
str(dataICHS)
# Visualization of sample A45
#The following code should display a graphic with all samples in green dots and sample
# A45 as red big dot
ICHS("A45",dataICHS)

Data Sets~~

Description

Data.frame with data for testing the TSSS() (total soluble solids summation) function. Column 1: sample identification code. Column 2: measurement of total soluble solids. Column3 onwards: measurement of chemical components of water expressed in the same units as column 2.

Usage

data("dataTSSS")

Format

A data frame with 411 observations on the following 16 variables.

codigo

a character vector

solidostotales

a numeric vector

cloruro

a numeric vector

carbonato

a numeric vector

bicarbonato

a numeric vector

fosfato

a numeric vector

nitrato

a numeric vector

nitrito

a numeric vector

fluoruro

a numeric vector

arsenico

a numeric vector

amonio

a numeric vector

sulfato

a numeric vector

sodio

a numeric vector

tkn

a numeric vector

calcio

a numeric vector

magnesio

a numeric vector

Examples

# Including data.frame: data in workspace.
data("dataTSSS")
# Column names of data.frame: data
names(dataTSSS) 
# Data set type of columns of data.frame: data.
str(dataTSSS)
# Visualization of sample A45
#The following code should display a graphic with all samples in green dots and sample
# A45 as red big dot
TSSS("A45",dataTSSS)

Two Criteria Database Check

Description

Generate a list of records that probably have errors in chemical components concentratios, based in two criteria: correlation between chemical components concentrations with total soluble solids, and correlation between chemical ionic components concentrations with conductivity

Usage

datacheck(dataICHS, dataTSSS, conflevel = 0.95, pchdata = 19, coldata = "green", 
cexdata = 0.5, pchsample = 19, colsample = "red", cexsample = 3, xaxis = xaxis, 
yaxis = yaxis, title = title, linetyprediction = 2, linewidthprediction = 1, 
linecolorprediction = 5)

Arguments

dataICHS

Registers of a database with concentrations of chemical components of water, including concentration of ionic chemical components and conductivity.

dataTSSS

egisters of a database with concentrations of chemical components of water, including concentration of chemical components and total soluble solids.

conflevel

Significance level used in the predict function.

pchdata

Symbol used to graph all the data in the data.frame.

coldata

Color of the symbols of all the data in the data.frame.

cexdata

Symbol size of all data in the data frame.

pchsample

Symbol chosen to represent the point whose measurement quality is to be represented.

colsample

Color chosen to represent the point whose measurement quality is to be represented.

cexsample

Size of the symbol chosen to represent the point whose measurement quality is to be represented.

xaxis

X axis label.

yaxis

Y axis label.

title

Title of the graph including the code of the chosen sample.

linetyprediction

Linear model prediction line type.

linewidthprediction

Linear model prediction line thickness.

linecolorprediction

Linear model prediction line color.

Details

The datacheck() function performs two linear regressions using de functions TSSS() and ICHS() of this package. TSSS() function performs a linear model using column 2 (total soluble solids) as the dependent variable and the other components of water as independent variables (columns 3 onwards). Based on the linear model, a data prediction interval is obtained with a certain confidence level and displays as a red point the samples that are outside the prediction interval. The ICHS() function performs a linear model using column 2 (conductivity) as the independent variable and the other components of water as dependent variables (columns 3 onwards). Based on the linear model, a data prediction interval is obtained with a certain confidence level and ICHS graphs in red points those samples that are outside de prediction interval. The datacheck() function select the samples of the database, that are outside of both prediction intervals. If a sample is outside both prediction intervals, probably has an important error and must be revised.

Value

The datacheck() function returns a graph with two plots. The first plot display de linear regresion of charge summation as a function of conductivity, and the second one, the linear regresion of mass summation as a function of total soluble solids. In both plots are presented the prediction interval and the samples that are outside of it, which probably has a problem of accuracy or precision, are display as red dots. The identification code of the samples that are outside both prediction intervals are display as a list.

Author(s)

Maela Lupo, Andrea Porpatto, Alfredo Rigalli


Data Sets~~

Description

Data.frame with data for calculating the quality parameters of a technique for the measurement of a chemical component of water with the validation() function. The data.frame includes concentration and absorbance measurement of standards of the calibration curve and a solution of known concentration, called quality control (qc). The data.frame includes measurements of the absorbance of the tube at three different days. Column 1: name of the tube. The tubes b, s1, s2,s3 and s4 represent different concentrations of a calibration curve. Column 2: concentration: the concentration of each tube, expressed in micrograms. Column 3: abs: absorbance of each tube which were measured spectrophotometrically. Column 4: day: the day when the measurement was done.

Usage

data("datavalidation")

Format

A data frame with 46 measurement of the following variables.

tube

a character vector

concentration

a numeric vector

abs

a numeric vector

day

a numeric vector

Examples

# Including data.frame: datavalidation in workspace.
data("datavalidation")
# Column names of data.frame: datavalidation
names(datavalidation) 
# Data set type of columns of data.frame: datavalidation.
str(datavalidation)
# Calculation of quality parameters of the Total Kjeldhal Nitrogen (tkn) measurement technique
validation(datavalidation,numest=4,measurementunit='ug',techniquename='tkn',graph=TRUE)

Quality parameters of a measurement technique

Description

Calculate the quality parameters of a technique for the measurement of a chemical component.

Usage

validation(datavalidation, numest = NULL, measurementunit = NULL, 
techniquename = NULL,  date = Sys.Date(), graph = FALSE)

Arguments

datavalidation

Data.frame with data for points of a calibration curve of five points, including a reagent blank and four standards. The data.frame also includes a solution of known concentration called quality control (qc). The columns include name of the tube, concentration, absorbance and day of measurement.

numest

The number of standards solution used for the calibration curve. This number do not include the reagen t blank.

measurementunit

The unit of measurement of the concentration.

techniquename

The name of the technique whose quality parameters are calculated.

date

The date when the procedure is performed.

graph

Graph argument allows to plot the calibration curve.

Details

The validation() function calculates a set of quality parameters of a technique for the measurement of a chemical component. The function needs the values of a property (absorbance in the example) of standard solutions with different known concentration of one chemical component of water, measured in three different days. The function also needs the values of the property of a solution with a known concentration of the component, different from the standards of the calibration curve, which is called quality control solution (qc).

Value

The datavalidation() function returns a graph of the calibration curve if the argument graph takes the value TRUE. The function calculates and returns a list with the values of the slope of the calibration curve, the detection limit (LOD), the quantification limit (LOQ), correlation coefficient, sensitivity, accuracy, intraassay repetitivity, interassayrepetitivity, linear range and uncertainty.

Author(s)

Maela Lupo, Alfredo Rigalli