Skip to content

clean_coordinates puzzling error when misssing coordinates #109

@AMBarbosa

Description

@AMBarbosa

The clean_coordinates function stops with an error if there are rows with missing (NA) coordinates:

> gbif <- rgbif::occ_data(scientificName = "Pan troglodytes")

> clean_coordinates(gbif$data, lon = "decimalLongitude", lat = "decimalLatitude")

Testing coordinate validity
Flagged 4 records.
Error in clean_coordinates(gbif$data, lon = "decimalLongitude", lat = "decimalLatitude") : 
  invalid coordinates found in rows, clean dataset before proceeding:
53 
64 
345 
467 

It's a bit baffling to users that a function called clean_coordinates tells them to "clean dataset before proceeding". Couldn't the function just flag these records too, and/or output NA in their test results? The same for other types of invalid coordinates.

Otherwise, it would at least be helpful if the error message were clearer, e.g. "missing coordinates are not allowed".

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions