inspect: Check for common errors in respirometry data

Description Usage Arguments Details Value Examples

View source: R/inspect.R

Description

inspect() scans and subsets a data.frame object for errors that may affect the use of various functions in respR. By default, the function scans only the first 2 columns of a data frame and assumes that the first columne is time data. A plot of the data is also produced, including a rolling regression plot using a width of floor(0.2 * nrow([data frame]) for a quick visual inspection of the rate pattern (or stability) of the data.

Usage

1
inspect(df, time = NULL, oxygen = NULL, plot = TRUE)

Arguments

df

data.frame object. Accepts any object of class data.frame.

time

numeric vector. Defaults to NULL. This specifies the column number(s) of the time data to subset.

oxygen

numeric vector. Defaults to NULL. This specifies the column number(s) of the oxygen data to subset.

plot

logical. Defaults to TRUE. Plots the data for quick visual diagnosis. Works only when the subset dataframe contains exactly 2 columns.

Details

Time columns are checked for NA/NaN values, sequential time, duplicate time and evenly-spaced time data. Oxygen columns are simply checked for NA/NaN data. Once data checks are complete, the function produces a list object which may be directly loaded into calc_rate(), calc_rate.bg(), calc_rate.ft(), and auto_rate() for further analyses.

If you wish to scan more than two columns, you can do so by specifying the time and oxygen arguments to select specific columns of a large data frame. However, the function will not produce a plot. Thus, you may inspect flowthrough respirometry data, which usually contains oxygen values for inflow and outflow, by specifying a vector of column numbers, e.g. oxygen = c(2,3).

Value

A list object of class inspect.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# automatically inspect first 2 columns:
inspect(sardine.rd)
inspect(urchins.rd)

# inspect specific columns:
inspect(urchins.rd, time = 1, oxygen = 4)

# inspect multiple columns
x <- inspect(urchins.rd, time = 1, oxygen = c(2:12))
print(x)
x$list$time.min  # check position of errors in data frame

# inspect flowthrough data
x <- inspect(flowthrough.rd, 1, c(2,3))
x

januarharianto/respR documentation built on Nov. 13, 2018, 1:21 p.m.