errorcare: A wrapper for trycatch, which allows ignoreing of errors and...

Description Usage Arguments Value Examples

View source: R/wrappers.R

Description

A wrapper for trycatch, which allows ignoreing of errors and leave the loop running. This is terrible behavior and should only be used when necessary

Usage

1

Arguments

...

whatever function you want to ignore errors from

Value

output of the function, or NA if something failed

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data = matrix(rnorm(40), ncol = 8)
data[,5] = NA

for(i in 2:ncol(data)) {
  result = t.test(data[,(i-1)], data[,i])$p.value
  print(result)
}
#This halts execution at the 5'th cloumn

for(i in 2:ncol(data)) {
  result = t.test(data[,(i-1)], data[,i])$p.value
  print(result)
}
#Works, but returns NA when column 5 is being used

jacobfredsoee/LCEF documentation built on Jan. 9, 2020, 9:58 a.m.