carry.over: Carry-over correction

Description Usage Arguments Details Value Author(s) Examples

View source: R/carry.over.R

Description

This function corrects for carry-over in continuous isotopic measurements.

Usage

1
carry.over(x, y, n, ref.names, ref.vals, graph = FALSE, skip.inquiry = FALSE)

Arguments

x

Vector with sample names (character). length(x) should equal length(y).

y

Vector with sample values (numeric). length(y) should equal length(x).

n

Number of itterations per sample. length(x) should be a multiplicate of n.

ref.names

Character indicating the names of two reference values in x, of which the first reference is directly followed by the second in the isotopic measurements. Leading and trailing whitespace is automaticallye removed from x.

ref.vals

Two known reference values (numeric) used for drift correction; refered to in ref.name.

graph

Optional graph which illustrates the performed correction per itteration of every sample, based on two reference values in y, by plotting the measured carry-over and the carry-over fitted to these measurements. Default setting is FALSE when undefined.

skip.inquiry

Surpres inquiries regarding possible errors, allowing a full carry-over correction, irrespective of possible NAs. This option allows use of the carry.over function in a loop. Default setting is FALSE when undefined.

Details

Possible inquiry when skip.inquiry is FALSE: (i) "Some itterations in your measurements are missing." Indicates that length(x) is not a multiplicate of n. (ii) "Following samples contained NAs which will introduce errors:" combined with "Following samples follow samples with NAs which might introduce errors:" and "Do you wish to continue? <Y/N>" If you continue, the correction will be performed. If you do not wish to continue, the original data will be returned.

Value

Returns a two-column matrix. First column contains sample names, second column contains corrected measurements.

Author(s)

J.D.M.S.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data("Iso_data")

## Example 1
names <- Iso_data$Identifier
values <- Iso_data$d.D_H.Mean

cor_data <- carry.over(names, values, 8, c("LAB1","LAB3"), c(7.7, -147))

# -> Error: "Some itterations in your measurements are missing"



## Example 2
names <- Iso_data$Identifier[1:312]
values <- Iso_data$d.D_H.Mean[1:312]

cor_data <- carry.over(names, values, 8, c("LAB1","LAB3"), c(7.7, -147), graph = TRUE)

# -> Inquiry: "Following samples contained NAs which will introduce errors: 377"
#             "Following samples follow samples with NAs which might introduce errors: 25"
#             "Do you wish to continue? <Y/N>"

# Y

IsoCorr documentation built on Jan. 8, 2021, 2:13 a.m.

Related to carry.over in IsoCorr...