Description Usage Arguments Value Examples
We transform a vector data
using a given
Transformation
, i.e., create a TransformedData
object where all elements are the result of the Transformation@forward
function. If the parameter normalize
is set to TRUE
, which it
is by default, the transformed data will further be normalized and the
transformation
is adapted accordingly. In this case, it is ensured
that all elements of the produced TransformedData@data
vector will be
in [0, 1]
. If the transformation fails, i.e., produces non-finite,
NaN
, or NA
values, NULL
is returned.
1 2 | Transformation.apply(data, transformation, normalize = TRUE,
negateNormalization = FALSE)
|
data |
the data vector to normalize |
transformation |
the transformation to be applied first |
normalize |
normalize the result (and modify the transformation
accordingly)? ... |
negateNormalization |
if |
the corresponding TransformedData
instance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | trafo <- Transformation.new(function(x) x*x, sqrt)
data <- c(1, 2, 3, 4)
Transformation.apply(data, trafo, normalize=FALSE)
# An object of class "TransformedData"
# Slot "transformation":
# An object of class "Transformation"
# Slot "forward":
# function (x)
# x * x
#
# Slot "backward":
# function (x) .Primitive("sqrt")
#
# Slot "data":
# [1] 1 4 9 16
Transformation.apply(data, trafo, normalize=TRUE)
# An object of class "TransformedData"
# Slot "transformation":
# An object of class "Transformation"
# Slot "forward":
# function (x)
# ((x * x - 1)/15)
# <environment: 0x42a5ee8>
#
# Slot "backward":
# function (x)
# sqrt(x = (x * 15) + 1)
# <environment: 0x4085558>
#
#
# Slot "data":
# [1] 0.0000000 0.2000000 0.5333333 1.0000000
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.