read_DARLEQ: Read DARLEQ diatom data from an Excel file

Description Usage Arguments Details Value Author(s) Examples

View source: R/read_darleq.R

Description

read_DARLEQ imports DARLEQ-formatted diatom data from an Excel file.

Usage

1
read_DARLEQ(file, sheet = NULL, verbose = TRUE)

Arguments

file

Name of Excel file. See Details below for guidelines on formatting the diatom data.

sheet

Name of sheet within Excel file. If blank the function will import the first sheet in the Excel file.

verbose

logical to indicate should function stop immediately on error (TRUE) or return a simpleError (FALSE). Defaults to TRUE.

Details

read_DARLEQ imports diatom data from an Excel file in either .xls or .xlsx format. An example Excel file is included in this package. See examples below to view it. The required data and layout are slightly different for river and lake samples. Figure 1 below shows the required format for performing TDI calculations for river samples.

The first four header rows are mandatory and must contain the following information:

Figure 1: Example format for river diatom samples

Identifiers for each row of the sample header information should be listed in column 1. Diatom data then follow the header information and may be in count or percentage format. The first column must contain the taxon code in either NBS or DiatCode (http://www.ecrc.ucl.ac.uk/?q=databases/diatcode) format. The codes in this column are used to link the data to the DARLEQ3 taxon list and ecological information and cannot be empty (an empty cell indicates the end of the data). The second column must include either the taxon name or code (ie. a repeat of column 1). Empty (blank) cells in the count or percentage data matrix will be read as zero. Character data in the diatom matrix will generate an error. A full list of diatom codes (either NBS or DiatCodes) are available in the dataframe darleq3_taxa.

If the Diatom Acidification Metric (DAM) is to be calculated, rows 5 and 6 must contain estimates of mean annual Calcium and DOC concentrations, in ueq l-1 and mg l-1 respectively. Figure 2 shows an example formatted for calculation of TDI and DAM. Note that if only DAM scores are required the Alkalinity field may be left blank. Sample Date is not used for calculating DAM and may be left blank.

Figure 2: Example format for river diatom TDI and DAM samples

The required format for lake samples is shown in Figure 3. This is exactly the same as for river data except that the fourth row must contain a code indicating lake type according to the GB lake typology alkalinity classes. Marl lakes are included in the high alkalinity (HA) group. Peat and brackish lakes are not covered by the tool. Sample date for lake samples is not used in the class calculations and can contain missing values.

Figure 3: Example format for lake diatom LTDI samples

Value

A list with the following named elements:

header

data frame containing the rows of environmental data from the top of the Excel file (ie. site, sample, water chemistry and data information)

diatom_data

data frame containing the diatom data

taxon_names

data frame containing taxon codes and names

file

name of the Excel file

filepath

full path to the Excel file

sheet

name of the Excel worksheet

Author(s)

Steve Juggins [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
fn <- system.file("extdata/DARLEQ2TestData.xlsx", package="darleq3")
d <- read_DARLEQ(fn, "Rivers TDI Test Data")
head(d$diatom_data)
head(d$header)
## Not run: 
# view the example dataset in Excel
# note running the following lines will open the file in Excel (if installed)
fn <- system.file("extdata/DARLEQ2TestData.xlsx", package="darleq3")
shell.exec(fn)

## End(Not run)

nsj3/darleq3 documentation built on June 21, 2018, 8:01 a.m.