I have a data frame from line 16968 (reasons for accuracy are listed below). I check if the current variable (data $ Ob) works on each line in sequential order (the data of the first line $ Ob is 1 ... the last data of the line $ Ob is 16968 and for each line between them.
When I launched the summary ($ Ob data), it tells me that the maximum 16970 is not 16968. When I started max ($ Ob data), it says that the maximum is 16968, not the value from the summary.
I checked the for-loop to check every observation, and it looks like the max () function is correct and the $ Ob variable of the variable does what it should. But does anyone know why the summary function is disabled by 2? I am assuming a rounding error (somehow?), But this data validation is crucial for the analysis I am doing, and if it is wrong, then my subsequent analysis will be a bunk.
Here I ran for the cycle, but I do not think it is important for this issue.
checker <- vector(length=nrow(rd)) na.checker <- vector(length=nrow(rd)) for (i in 1:nrow(rd)){ checker[i] <- ifelse(i==rd$Ob[i], 1, 0) na.checker[i] <- ifelse(is.na(rd$Ob[i])==TRUE,0,1) } sum(checker)
Thanks.
source share