> -----Original Message----- > if(num!=NA) > it yields an error message.
> Why doesn't the first statement work? Because you just compared something with NA (usually interpreted as 'missing') and because of that the comparison result is also NA. 'if' then tells you that you have a missing value where you need either TRUE or FALSE. Play with num!=NA #returns NA and if(NA) "Not there" #returns error is.na() returns TRUE for NA's, so 'if' knows what to do with the answer. S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.