Masking Missing Values

Sometimes the code for a missing value gets quite complex (maybe including "and" or "or" clauses) and diffiult to manage. Since you hve to specofy exactly the same values in vectors or matrices you can easily make mistakes. One approach is to cut-nad-paste the missing value clause into everything, but that's messy. Here's an example using a mask.
mask <- ! & ! slope[mask]
So, we just create a logical variable called mask (actually y can call it anything you want) and then use it as a logical subscript in any vector or matric where we need to eleiminate items where soenthing is missing. If you have lots of missing values in your data, you can havemultiple masks andname thenm for what they are missing, e.g.
has.elev <- !