lut {spatstat.geom}R Documentation

Lookup Tables

Description

Create a lookup table.

Usage

lut(outputs, ..., range=NULL, breaks=NULL, inputs=NULL, gamma=1)

Arguments

outputs

Vector of output values

...

Ignored.

range

Interval of numbers to be mapped. A numeric vector of length 2, specifying the ends of the range of values to be mapped. Incompatible with breaks or inputs.

inputs

Input values to which the output values are associated. A factor or vector of the same length as outputs. Incompatible with breaks or range.

breaks

Breakpoints for the lookup table. A numeric vector of length equal to length(outputs)+1. Incompatible with range or inputs.

gamma

Exponent for gamma correction, when range is given. A single positive number. See Details.

Details

A lookup table is a function, mapping input values to output values.

The command lut creates an object representing a lookup table, which can then be used to control various behaviour in the spatstat package. It can also be used to compute the output value assigned to any input value.

The argument outputs specifies the output values to which input data values will be mapped. It should be a vector of any atomic type (e.g. numeric, logical, character, complex) or factor values.

Exactly one of the arguments range, inputs or breaks must be specified by name.

It is also permissible for outputs to be a single value, representing a trivial lookup table in which all data values are mapped to the same output value.

The result is an object of class "lut". There is a print method for this class. Some plot commands in the spatstat package accept an object of this class as a specification of a lookup table.

The result is also a function f which can be used to compute the output value assigned to any input data value. That is, f(x) returns the output value assigned to x. This also works for vectors of input data values.

Value

A function, which is also an object of class "lut".

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

See Also

colourmap.

Examples

  # lookup table for real numbers, using breakpoints
  cr <- lut(factor(c("low", "medium", "high")), breaks=c(0,5,10,15))
  cr
  cr(3.2)
  cr(c(3,5,7))
  # lookup table for discrete set of values
  ct <- lut(c(0,1), inputs=c(FALSE, TRUE))
  ct(TRUE)

[Package spatstat.geom version 3.3-2 Index]