Another reason for that, is existence of NA's. Suppose your array name is arr
. You can simply check if you have any NA's in your array by:
any(is.na(arr))
If the answer was TRUE, then you have to delete NA's as below:
arr = arr[-which(is.na(arr)]
Even without any(is.na(arr))
, you can simply run the above command and R will remove any NA's that might have existed.