How to do it…

To check if there is any missing value in any input vector in R, you could use the is.na() function. This is a very useful and intuitive function to check for missing values. Now, your objective is to check whether any missing value exists in the vectors x and y. You then need to print the location of the missing value. Here is the use of the if statement:

    if(any(is.na(x))){
cat("There are missing values in x at ")
which(is.na(x))
}

if(any(is.na(y))){
cat("There are missing values in y at ")
which(is.na(y))
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset