NA - Missing values

Count number of NA
nacount = colSums(is.na(df)) nacount = data.frame(nacount)

Remove rows with missing values
dataframe= na.omit(dataframe)

Replace negative values with NA
testframe[,3:5][testframe[,3:5]< 0] = NA

Remove rows with NA values

df[rowSums(sapply(testframe,`%in%`,c(-999)))==0,] df[rowSums(sapply(data[,3:10]`%in%`,c(-99,-999)))==0,]

Maximum of 5% missing values
nacount = colSums(is.na(Data)) nacount = data.frame(nacount) valid = which(nacount >= 18*as.numeric(1)) Data = Data[, -c(valid)] 
 * 1) Count NA for each Station
 * 1) Delete columns with too many NA