Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An...

23
Package ‘elementR’ September 2, 2020 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.7 Date 2020-09-01 Author Charlotte Sirot, Francois Guilhaumon Maintainer Charlotte Sirot <[email protected]> Description Aims to facilitate the reduction of elemental microchemistry data from solid- phase LAICPMS analysis (laser ablation inductive coupled plasma mass spectrometry). The 'ele- mentR' package provides a reactive and user friendly interface (based on a 'shiny' applica- tion) and a set of 'R6' classes for conducting all steps needed for an optimal data reduc- tion while leaving maximum control for user. For more details about the methods used in 'ele- mentR', see Sirot et al (2017) <DOI:10.1111/2041-210X.12822>. Repository CRAN Depends R (>= 3.2.3) Imports gdata, shiny,devtools, shinyjs, gnumeric, R6, shinydashboard, abind, stringr, lmtest, tcltk,tcltk2, reader, readODS, readxl, EnvStats, outliers, zoo, colourpicker, stats, graphics, utils, httpuv License GPL (>= 2) Suggests testthat URL https://github.com/charlottesirot/elementR BugReports https://github.com/charlottesirot/elementR/issues NeedsCompilation no Date/Publication 2020-09-02 13:40:02 UTC R topics documented: convertingReplicate ..................................... 2 convertMol_to_PPM .................................... 3 1

Transcript of Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An...

Page 1: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

Package ‘elementR’September 2, 2020

Type Package

Title An Framework for Reducing Elemental LAICPMS Data from SolidStructures

Version 1.3.7

Date 2020-09-01

Author Charlotte Sirot, Francois Guilhaumon

Maintainer Charlotte Sirot <[email protected]>

Description Aims to facilitate the reduction of elemental microchemistry data from solid-phase LAICPMS analysis (laser ablation inductive coupled plasma mass spectrometry). The 'ele-mentR' package provides a reactive and user friendly interface (based on a 'shiny' applica-tion) and a set of 'R6' classes for conducting all steps needed for an optimal data reduc-tion while leaving maximum control for user. For more details about the methods used in 'ele-mentR', see Sirot et al (2017) <DOI:10.1111/2041-210X.12822>.

Repository CRAN

Depends R (>= 3.2.3)

Imports gdata, shiny,devtools, shinyjs, gnumeric, R6, shinydashboard,abind, stringr, lmtest, tcltk,tcltk2, reader, readODS, readxl,EnvStats, outliers, zoo, colourpicker, stats, graphics, utils,httpuv

License GPL (>= 2)

Suggests testthat

URL https://github.com/charlottesirot/elementR

BugReports https://github.com/charlottesirot/elementR/issues

NeedsCompilation no

Date/Publication 2020-09-02 13:40:02 UTC

R topics documented:convertingReplicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2convertMol_to_PPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1

Page 2: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

2 convertingReplicate

convertPPM_to_Mol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4elementR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5elementR_data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6elementR_project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8elementR_rep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12elementR_repSample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13elementR_repStandard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16elementR_sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17elementR_standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19readData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20runElementR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21splitReplicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

Index 23

convertingReplicate convertingReplicate

Description

Convert and export the elemental concentrations (relative to an internal standard) from files of arepository from ppt/ppt to Mol/Mol and vice versa while keeping the repository structure.

Usage

convertingReplicate()

Details

By running convertingReplicate(), the user has access to an interface through its web browseropened automatlically as soon as the function is launched. This interface allows to upload therepository of the files to be converted, to choose the unit of conversion and to export the finalconverted data. Note that convertingReplicate() will convert the whole data frame uploadedexcept the first column that is usually dedicted to the time (transect mode) or to the names of thereplicate (spot mode) according to runElementR() method.

See Also

convertMol_to_PPM. convertPPM_to_Mol.

Page 3: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

convertMol_to_PPM 3

convertMol_to_PPM convertMol_to_PPM

Description

Convert the elemental concentrations (relative to an internal standard) of a data frame from Mol/Molto ppm/ppm

Usage

convertMol_to_PPM(dat, AtomicMass, InternStand)

Arguments

dat a data frame of elemental concentrations (relative to an internal standard) inMol/Mol

AtomicMass a matrix describing the atomic weight of the elements included in the session

InternStand the name of the internal standard used in the calculation of the concentrations

Details

A matrix describing the atomic weight of the element is included in the present package (Atom-icMass.csv). Note that convertMol_to_PPM() will convert the whole data frame uploaded exceptthe first column that is usually dedicted to the time (transect mode) or to the names of the replicate(spot mode) according to runElementR() method.

See Also

convertingReplicate. convertPPM_to_Mol.

Examples

## Convert the file Example1_replicate1.csv included in the package from Mol/Mol into ppm/ppm

# indicate the path and read the file to be convertedfilePath <- system.file("Example_conversion/Ex1/Example1_Replicate1.csv", package="elementR")

dat <- readData(filePath, sep = ",", dec = ".")

# indicate the path and read the file containing the atomic weight of the elementsAtomWeightPath <- system.file("AtomicMass.csv", package="elementR")

AtomicMass <- readData(AtomWeightPath, sep = ",", dec = ".")

# set the internal standardInternStand <- "Ca43"

standard <- convertMol_to_PPM(dat, AtomicMass, InternStand)

Page 4: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

4 convertPPM_to_Mol

## Display the converted datastandard

convertPPM_to_Mol convertPPM_to_Mol

Description

Convert the elemental concentrations (relative to an internal standard) of a data frame from ppm/ppmto Mol/Mol

Usage

convertPPM_to_Mol(dat, AtomicMass, InternStand)

Arguments

dat a data frame of elemental concentrations (relative to an internal standard) inMol/Mol

AtomicMass a matrix describing the atomic weight of the elements included in the session

InternStand the name of the internal standard used in the calculation of the concentrations

Details

A matrix describing the atomic weight of the element is included in the present package (Atom-icMass.csv). Note that convertPPM_to_Mol() will convert the whole data frame uploaded exceptthe first column that is usually dedicted to the time (transect mode) or to the names of the replicate(spot mode) according to runElementR() method.

See Also

convertingReplicate. convertMol_to_PPM.

Examples

## Convert the file Example1_replicate1.csv included in the package from ppm/ppm into Mol/Mol

# indicate the path and read the file to be convertedfilePath <- system.file("Example_conversion/Example2_Replicate1.csv", package="elementR")

dat <- readData(filePath, sep = ",", dec = ".")

# indicate the path and read the file containing the atomic weight of the elementsAtomWeightPath <- system.file("AtomicMass.csv", package="elementR")

AtomicMass <- readData(AtomWeightPath, sep = ",", dec = ".")

Page 5: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR 5

# set the internal standardInternStand <- "Ca43"

standard <- convertPPM_to_Mol(dat, AtomicMass, InternStand)

## Display the converted datastandard

elementR A Shiny Application for Reducing Elemental LA-ICPMS Data fromSolid Structures

Description

Aims to facilitate the reduction of elemental microchemistry data from solid-phase LA-ICPMSanalysis (laser ablation inductive coupled plasma mass spectrometry). The elementR package pro-vides a reactive and user friendly interface for conducting all steps needed for an optimal datareduction while leaving maximum control for user.

Author

Charlotte Sirot, Francois Guilhaumon, Franck Ferraton, Audrey Darnaude, Jacques Panfili, AmberChild

Maintainer

Charlotte Sirot <[email protected]>

References

Calculations of elementR procedures are based on a consensus of the literature:

• Elsdon & Gillanders. Interactive effects of temperature and salinity on otolith chemistry:challenges for determining environmental histories of fish. Can. J. Fish. Aquat. Sci. Vol. 59,2002.

• Fowler et al. Experimental assessment of the effect of temperature and salinity on elementalcomposition of otolith using laser ablation ICPMS. J. Fish. Aquat. Sci. Vol. 52, 1995.

• Milton & Chenery. The effect of otolith storage methods on the concentrations of elementsdetected by laser-ablation ICPMS. J. of Fish Biology, Vol. 53, 1998.

• Thorrold et al. 1998. Accurate classification of juvenile weakfish Cynoscion regalis to estuar-ine nursery areas based on chemical signatures in otoliths. Marine Ecology Press Series, Vol.173, 1998.

Examples

#runElementR()

Page 6: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

6 elementR_data

elementR_data Object elementR_data

Description

The R6Class object elementR_data contains the main information needed for the filtration of asingle replicate (sample or standard).

Usage

elementR_data

Format

An R6Class generator object

Details

When runElementR is running and as soon as a project is loaded, an elementR_data is automati-cally created for each replicate included in the session (standard and sample). Each of these objectscontains the basic information regarding the considered replicate (name, path and raw data) and isfilled by the intermediate and final data as user proceeds to the filtration procedure.

Fields

name A character string corresponding to the name of the considered replicate

data A matrix corresponding to the raw data of the considered replicate

fPath A character string corresponding the path of the raw data

bins A numerical value corresponding to the time at which end the blank values

plat A vector containing two numerical values corresponding respectively to the time at whichbegin and end the plateau values

dataBlank A matrix corresponding to the blank data

dataPlateau A matrix corresponding to the plateau data

dataSuppBlank A matrix corresponding to the data obtained by substracting the averaged blankvalue (here, BlankAverarge) from the dataPlateau

dataSupLOD A matrix of data corresponding to the values of dataSuppBlank up to the limit ofdetection (here LOD)

dataNorm A matrix of data corresponding to the values of dataSupLOD normalized by the chemicalelement chosen as internal standard (here, elemstand)

Page 7: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_data 7

elemstand A character string corresponding to the name of the chemical element chosen as internalstandard

LOD A vector of numerical values corresponding to the limit of detection for each chemical elementof the considered replicate

BlankAverarge A vector of numerical values corresponding to the averaged blank value for eachchemical element of the considered replicate

remplaceValue A character string corresponding to the value replacing the dataSuppBlank belowthe limit of detection

Methods

initialize(filePath, sep , dec) Aim: Create and set basic information of the considered repli-cate; Argument: filePath = the path of the considered replicate data, dec = the decimal systemof the data, sep = the separator character of the data; Output: an R6Class elementR_dataobject

setBins(bins) Aim: set bins; Argument: bins = A numerical value corresponding to the time atwhich end the blank values

setPlat(plat) Aim: set plat; Argument: plat = A vector containing two numerical values cor-responding respectively to the time at which begin and end the plateau values

setDataBlanc(bins) Aim: set dataBlank; Argument: bins = A numerical value correspondingto the time at which end the blank values

setDataPlateau(plat) Aim: set dataPlateau; Argument: plat = A vector containing two nu-merical values corresponding respectively to the time at which begin and end the plateauvalues

setDataSuppBlank(bins,plat) Aim: set dataSuppBlank; Arguments: bins = A numerical valuecorresponding to the time at which end the blank values, plat = A vector containing twonumerical values corresponding respectively to the time at which begin and end the plateauvalues

setDataSupLOD(bins,plat) Aim: set dataSupLOD; Arguments: bins = A numerical value corre-sponding to the time at which end the blank values, plat = A vector containing two numericalvalues corresponding respectively to the time at which begin and end the plateau values

setDataNorm(bins,plat) Aim: set dataNorm; Arguments: bins = A numerical value correspond-ing to the time at which end the blank values, plat = A vector containing two numerical valuescorresponding respectively to the time at which begin and end the plateau values

reset() Aim: replace dataConcCorr by NA

OutlierDetectTietjen(x, nbOutliers) Aim: return the place of the outlier of a vector accord-ing to Tietjen and outlier methods; Arguments: x = a vector, nbOutliers = the number ofsuspected outliers; Outputs: a vector of the position of the outlier in the vector

Page 8: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

8 elementR_project

outlierDetection(dat, method, nbOutliers) Aim: return the place of the outlier of a vector;Arguments: dat = a vector, method = the method used for the detection ("Tietjen.Moore Test","SD criterion", "Rosner’s test"), nbOutliers = the number of suspected outliers; Outputs: avector of the position of the outlier in the vector

detectOutlierMatrix(dat, method, nbOutliers) Aim: return the place of the outlier for eachcolumn of a matrix; Arguments: dat = a matrix, method = the method used for the detection("Tietjen.Moore Test", "SD criterion", "Rosner’s test"), nbOutliers = the number of suspectedoutliers; Outputs: a list of vector corresponding to the position of the outlier in each columnof the matrix

outlierReplace(dat, outlierList, rempl) Aim: replace the outliers value of a matrix by rempl;Arguments: dat = a matrix, a list showing the place of the outlier for each column, rempl: thevalue to replace if outliers

is.possibleOutlier(dat) Aim: check that the vector fits with the needs for outlier detection(length of data > 30 and not all the same); Arguments: dat = a vector of data; OUtputs:TRUE: the investigated vector meets the conditions, FALSE: the investigated vector does notmeet the conditions

See Also

elementR_sample. elementR_standard.

Examples

## create a new elementR_data object based on the "filePath"## from a file containing data (accepted format of data: .csv, .ods, .xls, .xlsx)

filePath <- system.file("Example_Session/standards/Stand3.xls", package="elementR")

standard <- elementR_data$new(filePath)

## Display the raw data

standard$data

elementR_project Object elementR_project

Description

The R6Class object elementR_project contains all the information needed for running an ele-mentR session

Usage

elementR_project

Page 9: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_project 9

Format

An R6Class generator object

Details

The elementR_project structure allows to organized data in a session framework, faciliting there-fore numerous major functionalities: handling as many standard replicates as wanted, machine driftverification and correction, sample replicate realignment and averaging. Moreover, this object canbe easily exported, allowing user to re-open it later for finishing or editing final results.

Fields

name A character string corresponding to the name of the project

folderPath A character string corresponding to the path of the project

standardsPath A character string corresponding to the path of the standard folder

standardsFiles A vector containing the names of each standard file

standards A list containing the elementR_repStandard of each type of standard

samplesPath A character string corresponding to the path of the sample folder

samplesFiles A vector containing the names of each sample file

samples A list containing the elementR_repSample of each sample

EtalonPath A character string corresponding to the path of the calibration file

EtalonData A matrix corresponding to the calibration data

listeElem A vector containing the names of the chemical elements included in the project

flag_stand A vector indicating which standards have been filtered

flag_Sample A vector indicating which samples have been filtered

flagRealign A list vectors indicating which samples have been realigned or averaged

standardRank A vector corresponding to the standard rank in ICPMS analysis

sampleRank A vector corresponding to the sample rank in ICPMS analysis

elementChecking A list indicating the number and the location of the error(s) of structure withindata included in the project

errorSession A numerical value indicating the non numeric error(s) within data included in theproject

regressionModel A matrix summarizing, for each chemical element, the parameters of the linearregression corresponding to the machine drift

Page 10: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

10 elementR_project

machineCorrection A vector summarizing the chemical element(s) to correct from machine drift

flagMachineCorrection A numerical value indicating the validation of the machine correctionstep

nbCalib A vector corresponding to the number of standard values available for each chemicalelement to proceed the linear regression

elemStand A character string indicating the chemical element considered as internal standard (bydefault = Ca)

summarySettings A matrix summarizing all the parameters set by user for each replicate (sampleand standard)

ChoiceUserCorr A logical value corresponding to the choice of the user to correct or no the sessionbased on the first step of configuration

R2Threshold the threshold to switch the machine drift correction from a linear to a neighbor cor-rection

Methods

set_summarySettings(name, rank, bins, plat1, plat2, average, LOD) Aim: set summarySettings;Arguments: name = a character string corresponding to the name of the replicate to set, rank=its rank in ICPMS analysis, bins = a numerical value corresponding to the time at which endthe blank values, plat1 = a numerical value corresponding to the time at which begin theplateau values, plat2 = a numerical value corresponding to the time at which end the plateauvalues, average = a vector corresponding to the blank averaged value (here, BlankAverarge)for each chemical element of the considered replicate, LOD = a vector corresponding to thelimit of detection (here, LOD) for each chemical element of the considered replicate

is.integer0(x) Aim: test the integer(0); Arguments: x = a vector to test; Outputs: TRUE orFALSE

closest(x,y) Aim: find the nearest value among a vector of numerical data; Arguments: x = avector of numerical values, y = the investigated value; Output: val = a list of two values: thenearest value and its place within the vector

PlotIC(name, Mean,SD, coord, lengthSeg, xlim, ylim, type = "p", xlab, ylab) Aim: plotmean +/- SD; Arguments: name = a vector of the names to display on xaxis, Mean = a vectorof mean, SD = a vector of SD, coord = a vector of coordonnates to place xticks, lengthSeg =a numeric value cooresponding to the length of the top segment of the SD bar, xlim & ylim =the limits of plots, xlab & ylab = the labels of axis

setEtalon(x, sep, dec) Aim: define EtalonPath and EtalonData and check the validity oftheir data structure; Arguments: x = a character string corresponding to the path of the cali-bration file, dec = the decimal system of the data, sep = the separator character of the data

setflagMachineCorrection(x) Aim: set flagMachineCorrection; Arguments: x = the numer-ical value to set

Page 11: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_project 11

NonNumericCheck(data, col) Aim: check non numeric characters of data; Arguments: data = adataframe or a matrix, col = a vector of numerical values corresponding to the column(s) toinvestigate; Output: errB = a numerical value corresponding to the number of cells containingnon numeric characters

setflagStand(place, value) Aim: set flag_stand; Arguments: place = a numerical value cor-responding to the considered replicate, value = the numerical value to set

setflagSample(sample, replicate, value) Aim: set flag_Sample; Arguments: sample = anumerical value corresponding to the considered sample, replicate = a numerical value corre-sponding to the considered replicate, value = the numerical value to set

setCorrection(x) Aim: set machineCorrection; Arguments: x = a vector indicating the chem-ical elements to correct from machine drift

correction() Aim: proceed to the linear regression on standards replicates and set nbCalib &regressionModel

setRank(type, value) Aim: set the order in which ICPMS runs each standard (standardRank)and sample (sampleRank) replicates; Arguments: type = a character string indicating the typeof replicate standard ("standard") or sample ("sample"), value = a numerical value correspond-ing to the rank of the considered replicate

set_flagRealign(replicate, type, value) Aim: set flagRealign; Arguments: replicate = anumerical value corresponding to the number of the considered replicate, type = a characterstring indicating the raster or spot mode, value = the numerical value to set

setElemStand(elem) Aim: define elemStand and transmit this value to all elementR_rep andelementR_data objects inlcuded in the project; Arguments: elem = a character string corre-sponding to the element considered as intern standard

initialize(folderPath, sep, dec) Aim: create the project; Arguments: filePath = the path ofthe considered project, dec = the decimal system of the data, sep = the separator character ofthe data; Outputs: R6Class elementR_project

set_ChoiceUserCorr(x) Aim: information about the will of user to check or not the machinedrift; Arguments: x = T (for checking machine drift), F (for not checking machine drift)

setR2Threshold(x) Aim: set R2Threshold; Arguments: x = a value between 0 and 1

insert.at(a, pos, toInsert) Aim: insert values in vectors; Arguments: a = a vector, pos = theposition to insert, toInsert = a vector to insert

detectPlateau(dat, col) Aim: detection of the plateau limits of a matrix based on clusteringmethods and on the internal standard element; Arguments: dat = the data to proceed, col = thecolumn used for the detection

detectBlank(dat, col) Aim: detection of the blank limits of a matrix based on the derivativevalue and on the internal standard element; Arguments: dat = the data to proceed, col = thecolumn used for the detection

Page 12: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

12 elementR_rep

See Also

elementR_rep. elementR_data.

Examples

## create a new elementR_repStandard object based on the "filePath"## from a folder containing sample replicate

# filePath <- system.file("Example_Session", package="elementR")

# exampleProject <- elementR_project$new(filePath)

## Display the raw data

# exampleProject$samplesFiles

elementR_rep Object elementR_rep

Description

The R6Class object elementR_rep contains the main information needed for the filtration of abatch of replicates (standard or sample replicates).

Usage

elementR_rep

Format

An R6Class generator object

Details

When runElementR is running and as soon as a project is loaded, an elementR_rep is automaticallycreated for each batch of replicates (i.e. each folder of standards or samples) included in the session.Each of these objects contains the basic information regarding the considered batch (name and pathof the folder, the whole data of each replicates) and is filled by the intermediate and final data asuser proceeds to the filtration procedure.

Fields

rep_name A character string corresponding to the name of the considered folder

rep_folderPath A character string corresponding to the path of the considered folder

rep_Files A vector containing the name of the files within the considered folder

Page 13: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_repSample 13

rep_data A list containing the elementR_data corresponding to the replicates included in theconsidered folder

rep_pas A numerical value corresponding to the time between two consecutive analysis withindata of the considered folder

dec The decimal system used in the data (either , or .)

sep The separator character used in the data

Methods

setRep_pas() Aim: set rep_pas

initialize(filePath, sep, dec) Aim: Create and set the basic information of the consideredfolder; Argument: filePath = the path of the considered folder, dec = the decimal system ofthe data, sep = the separator character of the data; Output: an R6Class elementR_rep object

See Also

elementR_repStandard. elementR_repSample.

Examples

## see elementR_repStandard or elementR_repSample as the creation of elementR_rep depends## on the type of data created

elementR_repSample object elementR_repSample

Description

The R6Class object elementR_repSample contains the main information needed for the filtrationof a batch of replicates from the same sample.

Usage

elementR_repSample

Format

An R6Class generator object

Details

As a subclass object, the elementR_sample object already contains all fields and methods from theelementR_rep. Moreover, it also contains items specifically designed for sample filtration.

Page 14: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

14 elementR_repSample

Inheritance

The elementR_repSample object inherits from the elementR_rep.

Fields

rep_type A character string indicating the type of the considered batch (here, "sample")

rep_type2 A character string corresponding to the processing mode of averaging ("raster" or"spot")

rep_dataFiltre A list containing the data to average of each replicate of the considered sample(dataOutlierFree for spot mode and dataNorm for raster mode)

rep_dataFinalSpot A matrix containing the average and the standard deviation per chemical el-ement of the dataOutlierFree of the final replicates (i.e. chosen to be part of the finalcalculation)

rep_dataIntermRaster A list containing the realigned dataNorm of the final replicates (i.e. cho-sen to be part of the final calculation)

rep_dataFinalRaster A matrix corresponding to the average values of the data contained inrep_dataIntermRaster

rep_autoCorrel a vector which contains (1) laser diameter, (2) laser speed, (3) which point tokeep

rep_dataFinalRasterNonCorr a matrix of the final data without correlated points

Methods

setrep_type2(x) Aim: set rep_type2; Arguments: x = a character string indicating spot or rastermode

Realign2(data, pas) Aim: Realign data; Arguments: data = a list of matrix corresponding tothe data to realign, pas = the step of time between two consecutive analysis within data of theconsidered sample; Output: data = a list of matrix containing the realigned data

setRep_dataFiltre(x) Aim: set rep_dataFiltre; Arguments: x = a logical value correspond-ing to the choice of user to correct or not the machine drift

setRep_dataFinalSpot(x) Aim: set rep_dataFinalSpot; Arguments: x = the matrix to set

intermStepSpot() Aim: create and return an intermediate matrix containing the average and thestandard deviation per chemical element for all sample replicates; Output: outputTab = amatrix with two lines corresponding to the average and the standard deviation per chemicalelement for all sample replicates

intermStepRaster(decalage, input, outliers, replace) Aim: create and return an interme-diate matrix containing realigned data for all sample replicates; Inputs: decalage = a vectorindicating the translation to operate, input = the data to realign, outliers = a list of outliers, re-place = the value to replace in case of outlier, Output: outputList = a list of matrix containingrealigned data for all sample replicates

Page 15: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_repSample 15

setRep_dataIntermRaster(x) Aim: set setRep_dataIntermRaster; Arguments: x = the list ofmatrix to set

setRep_dataFinalRaster() Aim: set rep_dataFinalRaster

create() Aim: create and set the field rep_data by filling it with the elementR_sample objectscorresponding to sample replicates included in this batch

set_rep_autoCorrel(x) Aim: set rep_autoCorrel, Input: x = the value to set

set_rep_dataFinalRasterNonCorr() Aim: set rep_dataFinalRasterNonCorr

RealignCol(dat1, dat2, col, step) Aim: realign two tables according to a chosen column(based on a convolution); Inputs: dat1 & dat2 = matrix to realign, col = the column to re-align, step = the step between two consecutive analysis; Outputs: the realign data

RealignColList(listRealig, col, step) Aim: realign a list of matrix according to a chosencolumn (based on a convolution); Inputs: listRealig = a list of matrix to realign, col = thecolumn to realign, step = the step between two consecutive analysis; Outputs: the realign data

RealignAll(dat1, dat2, step) Aim: realign a list of matrix according to all columns (based on aconvolution); Inputs: dat1 & dat2 = matrix to realign, step = the step between two consecutiveanalysis; Outputs: the realign data

RealignListAll(listRealig, step) Aim: realign a list of matrix according to all columns (basedon a convolution); Inputs: listRealig = a list of matrix to realign, step = the step between twoconsecutive analysis; Outputs: the realign data

See Also

elementR_rep. elementR_repStandard.

Examples

## create a new elementR_sample object based on the "filePath"## from a folder containing sample replicate

filePath <- system.file("Example_Session/samples/Sample_1", package="elementR")

sampleBatch <- elementR_repSample$new(filePath)

## Display the data contained in this batch

sampleBatch$rep_data

Page 16: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

16 elementR_repStandard

elementR_repStandard Object elementR_repStandard

Description

The R6Class object elementR_repStandard contains the main information needed for the filtra-tion of a batch of standard replicates.

Usage

elementR_repStandard

Format

An R6Class generator object

Details

As a subclass object, the elementR_repStandard object already contains all fields and methodsfrom the elementR_rep. Moreover, it also contains items specifically designed for standard filtra-tion.

Inheritance

The elementR_repStandard object inherits from the elementR_rep.

Fields

rep_type A character string indicating the type of the batch considered (here, "standard")

rep_dataFinale A matrix containing data_standFinalMean and data_standFinalSD for allstandard replicates included in the considered batch

rep_dataFinaleMean A vector containing the average per chemical element of the rep_dataFinale

rep_dataFinaleSD A vector containing the standard deviation per chemical element of the rep_dataFinale

Methods

setrep_FinalMeanSD() Aim: define and set rep_dataFinaleMean and rep_dataFinaleSD

setRep_table(nelem) Aim: define and set rep_dataFinale; Arguments: nelem = a vector con-taining the names of the chemical elements to include in the rep_dataFinale

create() Aim: create and set rep_data by filling it with the elementR_standard objects corre-sponding to standard replicates included in this batch

See Also

elementR_rep. elementR_repSample.

Page 17: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_sample 17

Examples

## create a new elementR_repStandard object based on the "filePath"## from a folder containing sample replicate

filePath <- system.file("Example_Session/standards", package="elementR")

standBatch <- elementR_repStandard$new(rep_folderPath = filePath)

## Display the files contained in this batch

standBatch$rep_Files

elementR_sample Object elementR_sample

Description

The R6Class object elementR_sample contains the main information needed for the filtration of asingle sample replicate.

Usage

elementR_sample

Format

An R6Class generator object

Details

As a subclass object, the elementR_sample object already contains the whole fields and meth-ods from the elementR_data. Moreover, it also contains items specifically designed for samplefiltration.

Inheritance

The elementR_sample object inherits from the elementR_data

Fields

type A character string corresponding to the type of replicate (here, "sample")

dataConc A matrix corresponding to the dataNorm converted in concentration

dataConcCorr A matrix corresponding to the dataConc corrected (or not) from the machine drift

Page 18: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

18 elementR_sample

Methods

setDataConc(bins, plat, calibFile, meanStand, rempl) Aim: set dataConc; Arguments: bins= a numerical value corresponding to the time at which end the blank values, plat = a vectorof two numerical values corresponding respectively to the time at which begin and end theplateau, calibFile = a matrix corresponding to the data of the calibration file, meanStand = avector containing the averaged signal intensity per chemical element for all standard replicatesof the running session, rempl = the value replacing data if below the limit of detection

setDataConcCorr(bins, plat, name, calibFile, meanStand, rankSample, rankStandard, model, correction, rempl, threshold)Aim: set dataConcCorr; Arguments: bins = a numerical value corresponding to the time atwhich end the blank values, plat = a vector of two numerical values corresponding respec-tively to the time at which begin and end the plateau, name = a character string correspondingto the name of the sample replicates, calibFile = a matrix corresponding to the the calibrationfile, meanStand = a vector containing the averaged signal intensity per chemical element forall standard replicates of the running session, rankSample = a vector containing the rank ofeach sample in ICPMS analysis, rankStandard = a vector containing the rank of each standardin ICPMS analysis, correction = a vector indicating the chemical elements to correct from ma-chine drift, model = a matrix containing the parameters of the linear regression correspondingto the machine drift for all chemical elements, threshold = the R2 threshold to consider thatthe model does not fit to a linear model

renderData(curve) Aim: render data without proceding to their calculation; Argument: curve= a character string corresponding to the type of data to render ("Blank" for calculate and/orrender the dataBlank, "Raw" for data, "Plateau" for dataPlateau, "Blank removed" fordataSuppBlank, ">LOD" for dataSupLOD, "Normalized" for dataNorm, "Concentration" fordataConc and "Conc. corrected" for dataConcCorr); Output: a matrix of the required data

getData(curve, bins, plat, name, calibFile, meanStand, rankSample, rankStandard, model, correction)Aim: calculate and render the required data ; Arguments: curve = a character string corre-sponding to the type of data to calculate (for more details, see renderData arguments), bins= a numerical value corresponding to the time at which end the blank values, plat = a vectorof two numerical values corresponding respectively to the time at which begin and end theplateau, name = a character string corresponding to the name of the sample replicates, cal-ibFile = a matrix corresponding to the the calibration file, meanStand = a vector containingthe averaged signal intensity per chemical element for all standard replicates of the runningsession, rankSample = a vector containing the rank of each sample in ICPMS analysis, rank-Standard = a vector containing the rank of each standard in ICPMS analysis, correction =a vector indicating the chemical elements to correct from machine drift, model = a matrixcontaining the parameters of the linear regression corresponding to the machine drift for allchemical elements, threshold = the R2 threshold to consider that the model does not fit to alinear model

See Also

elementR_data. elementR_standard.

Examples

## create a new elementR_sample object based on the "filePath" from a file containing data

Page 19: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

elementR_standard 19

## replicate (accepted format of data: .csv, .ods, .xls, .xlsx)

filePath <- system.file("Example_Session/samples/Sample_1/Sample1_Rep1.csv", package="elementR")

sampleExample <- elementR_sample$new(filePath)

## Display the name of the object

sampleExample$name

elementR_standard Object elementR_standard

Description

The R6Class object elementR_standard contains the main information needed for the filtration ofa single standard replicate.

Usage

elementR_standard

Format

An R6Class generator object

Details

As a subclass object, the elementR_standard object already contains all fields and methods fromthe elementR_data. Moreover, it also contains items specifically designed for standard filtration.

Inheritance

The elementR_standard object inherits from the elementR_data.

Fields

type A character string indicating the type of replicate (here, "standard")

dataOutlierFree A matrix corresponding to the dataNorm without abnomalities

data_standFinalMean A vector corresponding to the average of dataOutlierFree per chemicalelement

data_standFinalSD A vector corresponding to the standard deviation of dataOutlierFree perchemical element

Page 20: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

20 readData

Methods

setDataOutlierFree(bins, plat, rempl, method, nbOutliers) Aim: set dataOutlierFree;Arguments: bins = a numerical value corresponding to the time at which end the blank values,plat = a vector of two numerical values corresponding respectively to the time at which beginand end the plateau, rempl = value to replace outliers, method = the method used to detectoutliers ("Tietjen.Moore Test", "SD criterion", "Rosner’s test"), nbOutliers = nb of suspectedoutliers

setdata_standFinal() Aim: set data_standFinalMean and data_standFinalSD

renderData(curve) Aim: render data without proceeding to their calculation; Argument: curve =a character string corresponding to the type of data to render ("Blank" for dataBlank, "Raw"for data, "Plateau" for dataPlateau, "Blank removed" for dataSuppBlank, ">LOD" fordataSupLOD, "Normalized" for dataNorm, "Outliers free" for dataOutlierFree); Output: amatrix of the required data

getData(curve, bins, plat, rempl, method, nbOutliers) Aim: calculate and render the re-quired data ; Arguments: curve = a character string corresponding to the type of data to render(for more details, see the curve argument of the renderData function), bins = a numerical valuecorresponding to the time at which end the blank values, plat = a vector of two numerical val-ues corresponding respectively to the time at which begin and end the plateau, rempl = valueto replace outliers, method = the method used to detect outliers ("Tietjen.Moore Test", "SDcriterion", "Rosner’s test"), nbOutliers = nb of suspected outliers; Output: a matrix of therequired data

See Also

elementR_data. elementR_sample.

Examples

## create a new elementR_standard object based on the "filePath" from a file containing data

filePath <- system.file("Example_Session/standards/Stand1.csv", package="elementR")

standardExample <- elementR_standard$new(filePath)

## Display the raw data

standardExample$data

readData readData

Description

Read the content of an Excel (.xls and .xlsx), OpenOffice (.ods) and text (.csv) worksheet

Page 21: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

runElementR 21

Usage

readData(x, sep, dec)

Arguments

x a character string corresponding to the path or name of the file to read

sep a character string corresponding to the separator

dec a character string corresponding to the decimal

Details

For the Excel and text format, readData reads by default the first worksheet of the file and the onecalled "data" for the OpenOffice format.

Examples

## Read data based on its path "filePath"

filePath <- system.file("Example_Session/standards/Stand1.csv", package="elementR")

readData(filePath, sep = ";", dec = ".")

runElementR runElementR

Description

Launch the shiny application contained in the elementR package.

Usage

runElementR()

Details

By running runElementR(), user has access through its web browser opened as soon as the appli-cation is launched to the whole functionalities for reducing data from solid-phase ICPMS analysis(project creation or edition, data or project export, standard and sample filtration, verification of themachine drift).

Page 22: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

22 splitReplicate

splitReplicate splitReplicate

Description

Split a single file corresponding to a whole session (Excel (.xls and .xlsx), OpenOffice (.ods) and text(.csv) worksheet) in separate files containing each only one replicate in order to fit to runElementRrequirment

Usage

splitReplicate()

Details

By running splitReplicate(), the user has access to an interface through its web browser openedautomatlically as soon as the function is launched. This interface allows to upload the file to split(sep = ";", dec = "."). The function helps the user to divide the file thanks to a clustering method(kmean). At the end, the user has the possibility to export the split data in the chosen directory(export in .csv).

Page 23: Package ‘elementR’ · 2018. 5. 3. · Package ‘elementR’ May 3, 2018 Type Package Title An Framework for Reducing Elemental LAICPMS Data from Solid Structures Version 1.3.6

Index

convertingReplicate, 2, 3, 4convertMol_to_PPM, 2, 3, 4convertPPM_to_Mol, 2, 3, 4

elementR, 5elementR_data, 6, 12, 17–20elementR_project, 8elementR_rep, 12, 12, 13, 15, 16elementR_repSample, 9, 13, 13, 16elementR_repStandard, 9, 13, 15, 16elementR_sample, 8, 17, 20elementR_standard, 8, 18, 19

readData, 20runElementR, 6, 21

splitReplicate, 22

23