Skip to content
Prev 245660 / 398506 Next

Odp: R-way to doing this?

Hi

r-help-bounces at r-project.org napsal dne 23.12.2010 05:13:37:
following
this
a
I do not understand above sentence well. R returns NaN not error.

For error handling in loop use try or tryCatch.

For simple vectorised function evaluation as log you can use is.* 
evaluation 

is.nan(log(input))*1
[1] 1 0 1 0 0 1 0 0 0 1

ifelse(is.nan(log(input)), 1,0)
 [1] 1 0 1 0 0 1 0 0 0 1

Regards
Petr
http://www.R-project.org/posting-guide.html