Description Usage Arguments Details Value Author(s) See Also Examples
Perform affine coordinate transformations.
1 2 3 4  coords(p, name = NULL, shift = 0)
appendTrfm(trfm, op = c("diag", "orth"), val)
toCoords(trfm, x)
fromCoords(trfm, y, apply.shift = TRUE)

p 
The number of variables in the original data. 
name 
A short name for the coordinate transformation (optional). 
shift 
A value subtracted from the data as the first step of the coordinate transformation. Usually, this will be the mean of the data (optional). 
trfm 
An object of class 
op 
The type of transformation to append. 
val 
Data for the transformation to append. 
x 
Data matrix, rows are observations, columns are variables. 
y 
Transformed data matrix, rows are observations, columns are variables. 
apply.shift 
Whether to apply the final shift of coordinates.
Set this to 
The function coords()
creates a new object representing an
affine coordinate transformation. Initially, the object represents a
shift by the amount shift
, mapping p
dimensional vectors
x
to xshift
. The function appendTrfm()
can then
be used to modify the transformation. The optional argument
name
, if set, is used when printing objects of class
coords
.
The function toCoords()
applies the affine transformation trfm
to the data x
. The data x
must either be a vector of
length trfm$p
, in which case the result is a vector of
length trfm$q
, or a matrix with trfm$p
columns, in which case
the transformation is applied to each row of the matrix separately.
The function fromCoords()
implements the inverse transform
to toCoords()
. The output always satisfies
toCoords(trfm, fromCoords(trfm, y)) == y
. If
trfm$p == trfm$q
, i.e. if the transformation is bijective,
the fromCoords(trfm, toCoords(trfm, x)) == x
also holds.
The argument apply.shift
can be set to false to apply only
the linear part of the (inverse) transformation, leaving out the
final shift.
The function appendTrfm()
concatenates trfm
with an
additional, linear transformation and returns the result. The
arguments op
and val
specify which kind of linear
transformation to append. There are two choices for op
:
diag
denotes multiplication with a diagonal matrix: an input
vector x
is mapped to the output x * val
. The scaling factor
val
can either be a vector of length trfm$q
(for elementwise
scaling), or a number.
orth
denotes multiplication with an orthogonal matrix.
val
must be a matrix with orthogonal columns (not necessarily
square) and trfm$q
rows. An input vector x
is mapped
to the output x %*% orth
.
The new transformation is applied after any other transformations
already associated with trfm
.
An object of class coords
, as a list with the following
components:
p 
the number of variables in the original data set 
q 
the number of variables in the transformed data set 
shift 
the affine part of the transformation 
name 
the name of the transformation 
cmds 
a representation of the transformation (internal use only) 
Jochen Voss <voss@seehuhn.de>
1 2 3 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.