add_area: Add areas to a Spatial Polygons Data Frame

View source: R/area.add.r

add_areaR Documentation

Add areas to a Spatial Polygons Data Frame

Description

This function takes a Spatial Polygons Data Frame and calculates and adds area fields to the data frame. Areas can be calculated either treating the whole SPDF as a unit or for each polygon individually.

Usage

add_area(polygons, area_ha = TRUE, area_sqkm = TRUE, area_acres = TRUE)

Arguments

polygons

An sf polygon object to calculate areas for

area_ha

Logical. If TRUE, areas will be calculated and added in hectares. Default is TRUE.

area_sqkm

Logical. If TRUE, areas will be calculated and added in square kilometers. Default is TRUE.

area_acres

Logical. If TRUE, areas will be calculated and added in acres. Default is TRUE.

Value

The original sf object with an additional field for each area unit calculated.

Examples

add_area()

nstauffer/sample.design documentation built on May 9, 2022, 3:21 a.m.