Learn R Programming

pawacc (version 1.1)

handleError: Handling Errors

Description

This function handles errors

Usage

handleError(x, err, code = "all", replace = NULL, na = TRUE, keep.error = FALSE)

Arguments

x
a vector of counts or steps.
err
a vector of error codes of the same length as x.
code
if code = "all" (default), any code different from zero will be flagged.
replace
value with which flagged errors are to be replaced. This argument is mandatory if na = FALSE.
na
if TRUE (default) flagged errors are replaced with NA's.
keep.error
if TRUE the function returns x. Otherwise, it will replace flagged errors as specified.

Value

  • the vector x if keep.error = TRUE or the modified vector x if keep.error = FALSE.

References

Geraci M, Rich C, Sera F, Cortina-Borja M, Griffiths LJ, and Dezateux C (2012). Technical report on accelerometry data processing in the Millennium Cohort Study. London, UK: University College London. Available at http://discovery.ucl.ac.uk/1361699