What features does the R language have to find missing values in dataframe or at least, how to know that the dataframe has missing values?
x = matrix(rep(c(NA, 1,NA), 3), ncol=3, nrow=3)
print(x)
[,1] [,2] [,3]
[1,] NA NA NA
[2,] 1 1 1
[3,] NA NA NA
matrix of boolean values: is the value NA
is.na(x)
[,1] [,2] [,3]
[1,] TRUE TRUE TRUE
[2,] FALSE FALSE FALSE
[3,] TRUE TRUE TRUE
indices of NA values:
which(is.na(x), arr.ind = T)
row col
[1,] 1 1
[2,] 3 1
[3,] 1 2
[4,] 3 2
[5,] 1 3
[6,] 3 3
see if the matrix has any missing values:
any(is.na(x))
TRUE