View source: R/createLocationMask.R
createLocationMask | R Documentation |
A logical vector is created with either TRUE
or
FALSE
for each incoming longitude, latitude
pair with
TRUE
indicating a valid location. This can be used to filter dataframes
to retain only records with valid locations.
lonRange
and latRange
can be used to create a valid-mask for
locations within a rectangular area.
removeZeroZero
will invalidate the location 0.0, 0.0
which is
sometimes seen in poorly QC'ed datasets.
NA
values found in longitude
or latitude
will result
in a mask value of FALSE
.
createLocationMask(
longitude = NULL,
latitude = NULL,
lonRange = c(-180, 180),
latRange = c(-90, 90),
removeZeroZero = TRUE
)
longitude |
Vector of longitudes in decimal degrees E. |
latitude |
Vector of latitudes in decimal degrees N. |
lonRange |
Range of valid longitudes. |
latRange |
Range of valid latitudes. |
removeZeroZero |
Logical indicating whether locations at |
Vector of logical values.
library(MazamaCoreUtils)
createLocationMask(
longitude = c(-120, NA, -120, -220, -120, 0),
latitude = c(45, 45, NA, 45, 100, 0)
)
createLocationMask(
longitude = c(-120:-90),
latitude = c(20:50),
lonRange = c(-110, -100),
latRange = c(30, 40)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.