Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Error in if() missing value where TRUE/FALSE needed, but there's actually a boolean argument inside

$
0
0

I have this error in R. I'm working with a database, where my NA values are called "# VALOR N/A", so I did a simple function to see how many of this values I have.

    estavencido <- function(a){
  count = 0
  for(i in 2:367){
    if(a[i]== "# VALOR N/D"){
      count = count+1
    }
  }
 return(count)
}

But when I use the function, I get the error, and I saw that data[i]=="# VALOR N/D" returns a TRUE/FALSE value, so I don't know why this is happening.


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>