dimanche 6 septembre 2015

"Or" operator is not working as expected in R

I am trying to created a function as below:

remove_loan_apl <- function(x) {
  if((x==0) || (is.NA(x))) {x <- 100000} 
   return(x)
}
remove_loan_apl <- function(x) {
  if((x==0) || (x is NA)) {x <- 100000} 
   return(x)
}

But its not working. What is the correct method to apply or for the missing value?

Aucun commentaire:

Enregistrer un commentaire