concept_area_measure.Rd
Several functions in SPATA2
have arguments that take area input.
To specifically refer to an area the unit must be specified. There are
three ways to create valid input for these arguments.
To test if the input is a valid distance measure use is_area()
.
There are two valid input options to specify an area in pixel:
numeric: Single numeric values, e.g. arg_input = c(2, 3.554, 69, 100.67)
. If no unit
is specified the input will be interpreted as pixels.
character: Suffixed with 'px', e.g. arg_input = c('2px', '3.554px', '69px', '100.67px')
Note: The unit pixel and its abbreviaton 'px' is also used for numeric values which refer to area measures without any unit at all.
Furthermore, the unit pixel (px) is used for distances as well as for areas. If pixel refers to a distance the pixel side length is meant. If pixel refers to an area the number of pixels is meant.
Specifying areas in SI units e.g. arg_input = c('2mm2', '4mm2')
etc.
requires the input to be a character as the unit must be provided as suffix.
Between the numeric value and the unit must be no empty space! Valid suffixes
can be obtained using the function validUnitsOfAreaSI()
.
unit
Behind the scenes SPATA2
works with the units
package. Input
is converted into vectors of class units
. Therefore, input can be directly
provided this way: arg_input = units::set_unit(x = c(2,4), value = 'mm2')
Note that pixel is not a valid unit in the units
package. If you want
to specify the input in pixel you have to use input option 1. In pixel.
Click here
for an elaboration
on distance measures in SPATA2.