My nightly audit script (Rscript, base R) flags freezers whose peak temp is above a limit. Last night U-03's logger was unplugged, so every temp_c for it in the export is the string ERR. The report still says U-03 is ok. Nobody got paged. The printed table shows n_valid 0, peak_c -Inf and mean_c NaN for that unit. The other units look right.
I assumed the reading step was broken. I added "ERR" to na.strings, checked that temp_c comes in numeric, and ran with --verbose. The row count is correct. Nothing changed.
The relevant part:
readings <- read.csv(infile, stringsAsFactors = FALSE,
na.strings = c("", "NA", "ERR"))
peak_c = max(df$temp_c, na.rm = TRUE),
mean_c = round(mean(df$temp_c, na.rm = TRUE), 1)
...
res$status <- ifelse(res$peak_c > LIMIT_C, "ALARM", "ok")
LIMIT_C is -65. R also prints a warning near the end of the run. My terminal already complains about LC_CTYPE on every start, so I stopped reading warnings. Once, a job of mine ran for a month on a warning like that.
Is this the reading step or something after it?