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.