Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rescale

Convert dataset to another unit of length


Description

Converts between different units of length in a spatial dataset, such as a point pattern or a window.

Usage

rescale(X, s, unitname)

Arguments

X

Any suitable dataset representing a two-dimensional object, such as a point pattern (object of class "ppp"), or a window (object of class "owin").

s

Conversion factor: the new units are s times the old units.

unitname

Optional. New name for the unit of length. See unitname.

Details

This is generic. Methods are provided for many spatial objects.

The spatial coordinates in the dataset X will be re-expressed in terms of a new unit of length that is s times the current unit of length given in X. The name of the unit of length will also be adjusted. The result is an object of the same type, representing the same data, but expressed in the new units.

For example if X is a dataset giving coordinates in metres, then rescale(X,1000) will take the new unit of length to be 1000 metres. To do this, it will divide the old coordinate values by 1000 to obtain coordinates expressed in kilometres, and change the name of the unit of length from "metres" to "1000 metres".

If unitname is given, it will be taken as the new name of the unit of length. It should be a valid name for the unit of length, as described in the help for unitname. For example if X is a dataset giving coordinates in metres, rescale(X, 1000, "km") will divide the coordinate values by 1000 to obtain coordinates in kilometres, and the unit name will be changed to "km".

Value

Another object of the same type, representing the same data, but expressed in the new units.

Note

The result of this operation is equivalent to the original dataset. If you want to actually change the coordinates by a linear transformation, producing a dataset that is not equivalent to the original one, use affine.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Other generics: unitname, affine, rotate, shift.


spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.