Skip to contents

This function reads a GeoJSON file from a given URL, extracts continent information, and returns an sf object with continent polygons.

Usage

get_continent_sf(url = NULL)

Arguments

url

Optional URL or file path to a GeoJSON file containing country or continent data. If NULL (default), the function uses the embedded Natural Earth continent boundaries from the package's extdata directory.

Value

An sf object with:

  • continent — continent name.

  • geometry — polygon geometry for that continent.

Examples

# Get continent data from a GeoJSON file
continent_sf <- get_continent_sf()
#> Error in get_continent_sf(): Default continent GeoJSON file not found. Ensure the file is in the 'extdata' directory of the package.
print(continent_sf)
#> Error: object 'continent_sf' not found