armor {PCRedux} | R Documentation |
armor: fetch errors gently
Description
armor
is a helper function that catches errors and creates an output
that can be used for further processing.
Usage
armor(f, n = 1)
Arguments
f |
is the function that needs armor. |
n |
is the number of Zero repeats if a function fails. |
Value
gives a numeric
value (S3 class) as output for errors
Author(s)
Andrej Nikolai Spiess, Stefan Roediger
Examples
# Fetch the error from the diffQ function
# In the following the approximate derivative of the amplification curve data
# x <- RAS002[, 1] and y <- RAS002[, 2] is calculated by diffQ().
# This will not give an error.
x <- RAS002[, 1]
y <- RAS002[, 2]
armor_diffQ_passes <- armor(diffQ(cbind(x, y), verbose = TRUE)$xy)
armor_diffQ_passes
#
# In the following the approximate derivative of the sequences x <- 1:40
# and y <- 1:40 is calculated by diffQ(). However, this will fail.
# This will give the "internal" error
# >
# Error in list.res[[i]][[8]] : subscript out of bounds
# that is resolved to 0.
x <- 1:40
y <- 1:40
armor_diffQ_fails <- armor(diffQ(cbind(x, y), verbose = TRUE)$xy)
armor_diffQ_fails
[Package PCRedux version 1.2-0 Index]