Learn R Programming

spatstat (version 1.64-1)

methods.unitname: Methods for Units

Description

Methods for class "unitname".

Usage

# S3 method for unitname
print(x, ...)
  # S3 method for unitname
summary(object, ...)
  # S3 method for unitname
rescale(X, s, unitname)
  # S3 method for unitname
compatible(A,B, ..., coerce=TRUE)
  # S3 method for unitname
harmonise(..., coerce=TRUE, single=FALSE)
  # S3 method for unitname
harmonize(..., coerce=TRUE, single=FALSE)

Arguments

x,X,A,B,object

Objects of class "unitname" representing units of length.

Other arguments. For print.unitname these arguments are passed to print.default. For summary.unitname they are ignored. For compatible.unitname and harmonise.unitname these arguments are other objects of class "unitname".

s

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

unitname

Optional new name for the unit. If present, this overrides the rescaling operation and simply substitutes the new name for the old one.

coerce

Logical. If TRUE, a null unit of length is compatible with any non-null unit.

single

Logical value indicating whether to return a single unitname, or a list of unitnames.

Value

For print.unitname the value is NULL. For summary.unitname the value is an object of class summary.unitname (with its own print method). For rescale.unitname the value is another object of class "unitname". For compatible.unitname the result is logical. For harmonise.unitname the result is a list of identical unitnames if single=FALSE (the default), or a single unitname if single=TRUE.

Details

These are methods for the generic functions print, summary, rescale and compatible for the class "unitname".

An object of class "unitname" represents a unit of length.

The print method prints a description of the unit of length, and the summary method gives a more detailed description.

The rescale method changes the unit of length by rescaling it.

The compatible method tests whether two or more units of length are compatible.

The harmonise method returns the common unit of length if there is one. For consistency with other methods for harmonise, the result is a list of unitname objects, with one entry for each argument in . All of these entries are identical. This can be overridden by setting single=TRUE when the result will be a single unitname object.

See Also

box3, print, unitname