What is the correct way of writing if syntax on R?
With:
for ( i in 1:200 ) {
if( (time[i]<731) | (time[i]==NA) ) { x[i] <- NA }
}
I keep getting:
missing value where TRUE/FALSE needed
The idea is to cut the beginning of the time series to calculate statistics. x
and time
are both numeric. Also this question is not an exact duplicate, the other post was dealing with a && statement and no foo==NA but foo==0. I thought that | or || would work like (TRUE | NA) = TRUE but it seems I was wrong.