Skip to content
Prev 132598 / 398506 Next

ifelse problem

To check for NA, use is.na. For instance your second ifelse should read:

ifelse(is.na(Sheet1$Claims),0,Sheet1$Claims))

Converting Sheet1$Claims to character doesn't have the effect you  
think it does. NA is still NA, it does not become "NA". Try for  
instance:

as.character(NA)
as.character(NA) == "NA"

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College
On Dec 20, 2007, at 10:26 AM, Randy Walters wrote: