Learn R Programming

Waypoint (version 1.1.0)

review: Review Coordinates and Waypoints Validity

Description

Review validity of elements of "coords" and "waypoints" objects.

Usage

review(x, ...)

# S3 method for coords review(x, ..., show_n = 20L)

# S3 method for waypoints review(x, ..., show_n = 20L)

Value

The review() method for class "coords" returns a list

comprising the following elements: -

allvalid

logical, whether or not all the elements of argument x are valid.

n_invalid

integer, the number of invalid elements in argument x, if any.

invalids

numeric vector including invalid elements of argument x, if any.

which_invalid

integer vector specifying which elements of argument x are invalid, if any.

The method for class "waypoints" returns a list of two sub-lists, each sub-list with elements as described above for the method for class "coords", one each for latitude and longitude.

Arguments

x

object of class "coords" created by function as_coords(), or class "waypoints" created by function as_waypoints().

...

further arguments passed to or from other methods.

show_n

integer, the maximum number of invalid elements of argument x to include in the output; default 20L.

Details

review() reveals elements of "coords" and "waypoints" objects that do not conform to the criteria checked by validate(), i.e. are not valid geographic locations.

See Also

"coords" and "waypoints".

Other validate: validate()

Examples

Run this code
## Continuing example from `validate()`...
suppressWarnings(dm <- (\(){
    tmp <- as_coords(c(5160.4659, 4932.7726, 4806.4339, 3853.3696, 0.0000, -3706.7044, -5306.2869, -2514.4093,
        -007.6754, 1823.9137, -12246.7203, -7702.1145, 0.0000, -1217.3178, 7331.0370, -5731.1536), fmt = 2)
    names(tmp) <- rep(c("Nelson's Column", "Ostravice", "Tally Ho", "Washington Monument", "Null Island",
        "Tristan da Cunha", "Mawson Peak", "Silvio Pettirossi International Airport"), 2)
    latlon(tmp) <- rep(c(TRUE, FALSE), each = 8)
    tmp
})())

## Review "coords" object in degrees and minutes, having
## an erroneous first value of more than 60 minutes
review(dm)

###
## Continuing example from `validate()`...
suppressWarnings(
   wp <- as_waypoints(data.frame(
       name = c("Nelson's Column", "Ostravice", "Tally Ho", "Washington Monument", "Null Island",
                "Tristan da Cunha", "Mawson Peak", "Silvio Pettirossi International Airport"),
       lat = c(51.507765, 49.54621, 48.107232, 38.889494, 0, -37.11174, -93.104781, -25.240156),
       lon = c(-0.127924, 18.398562, -122.778671, -77.035242, 0, -12.28863, 73.517283, -57.519227)
   ), fmt = 1)
)

## Review "waypoints" object in  decimal degrees, having an erroneous
## penultimate latitude absolute value greater than 90 degrees
review(wp)

rm(dm, wp)

Run the code above in your browser using DataLab