Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

alts2dups

Create a Matrix of Duplicate Pairs from Sequential Data


Description

Function to take data stored as stacked records or alternating rows of records for ndup duplicate pairs and generate a matrix with ndup rows and two columns for the duplicate data, for further details see x in Arguments below. The function returns a matrix for processing.

Usage

alts2dups(x, ifalt = FALSE)

Arguments

x

a column vector from a matrix or data frame, x[1], ..., x[2*n]. The default is that the first n members of the vector are the first measurements and the second n members are the duplicate measurements. If the measurements alternate, i.e. duplicate pair 1 measurement 1 followed by measurement 2, etc., set ifalt = TRUE.

ifalt

set ifalt = TRUE to accommodate alternating sets of paired observations.

Details

Function provides an easy procedure with function plot to present duplicate data as an x-y plot. The matrix generated can be passed directly to plot in its call and the matrix column headings synthesized from the input variable name are used as plot axis titles.

Value

xx

a ndup by 2 matrix containing the duplicate pairs. Row names are sequenced 1:ndup and the two column names are generated from the input variable name, x with .1 or .2 appended, respectively.

Note

Any less than detection limit values represented by negative values, or zeros or other numeric codes representing blanks in the data, must be removed prior to executing this function, see ltdl.fix.df.

Author(s)

Robert G. Garrett

Examples

## Make test data available
data(ad.test)
attach(ad.test)

## Save matrix of duplicate pairs
test.save <- alts2dups(Cu, ifalt = TRUE)

## Plot analytical duplicate analyses
plot(alts2dups(Cu, ifalt = TRUE), log = "xy")

## Clean-up and detach test data
rm(test.save)
detach(ad.test)

rgr

Applied Geochemistry EDA

v1.1.15
GPL-2
Authors
Robert G. Garrett
Initial release
2018-03-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.