Learn R Programming

stppSim (version 1.3.4)

compare_areas: Compare two areas

Description

To compare the sizes of two areas (boundary shapefiles).

Usage

compare_areas(area1, area2,
display_output = FALSE)

Value

Returns a plot and a text (string) comparing the sizes of two areas.

Arguments

area1

(as spatialPolygons, spatialPolygonDataFrames, or simple features). the polygon object of the first area.

area2

(as spatialPolygons, spatialPolygonDataFrames, or simple features). the polygon object of the second area.

display_output

(logical) Whether to print output in the console. Default: FALSE

Details

Compares the sizes of two areas (polygon shapefiles). The two shapefiles can be in any crs, and any spatial object formats. If enabled, the output (a value) comparing the area of the two polygons is printed. This value can be used to scale some specific spatial parameters, including n_origin, s_threshold, and step_length.

Examples

Run this code
#load 'area1' object - boundary of Camden, UK
load(file = system.file("extdata", "camden.rda",
package="stppSim"))
camden_boundary = camden$boundary

#load 'area2' - boundary of Birmingham, UK
load(file = system.file("extdata", "birmingham_boundary.rda",
package="stppSim"))

#run
compare_areas(area1 = camden_boundary,
area2 = birmingham_boundary, display_output = FALSE)

Run the code above in your browser using DataLab