My logger writes NA when a sensor read fails. In R, df[df$temp == NA, ] returns rows full of NA instead of the rows with missing temperature, mean(df$temp) is NA, and if (x > 30) stops with "missing value where TRUE/FALSE needed" on some rows.
What is the logic behind these results, and what are the correct ways to detect, skip or replace missing values?




