decode | R Documentation |
Encode and decode values that are in a range of -1 to 1 into a specified range.
encode(value, bounds) decode(value, bounds) decodeAll(values, params)
value |
A value |
values |
A vector with values in the range [-1,1] |
bounds |
A vector of two values defining the lower and upper bound of a range. |
params |
A list where evere list-item consist of two values defining a lower and an upper bound. |
Decodes a values from ranges of -1 to 1 to ranges specified.
A function used to decode values that are in a range of -1 to 1 into a specified range. For every value a list item with lower and upper bound has to be supplied.
A function used to encode values that are in a specified range into a range between -1 to 1.
decode: The encoded value. decodeAll: A vector of decoded values.
Gunnar Libiseller
decode(0, c(10, 20)) decode(-0.5, c(10, 20)) decode(1, c(10, 20)) bounds <- c(10, 20) encode(decode(1, bounds), bounds) ## Multiple values: values <- c(-1, -0.25, 0, 0.75) params <- getDefaultXcmsSetStartingParams() type_params <- typeCastParams(params) decodeAll(values, type_params$to_optimize) ## Combination of encode and decode encode(15, c(10, 20)) encode(10, c(10, 20)) encode(5, c(1, 5)) bounds <- c(1,5) decode(encode(5, bounds), bounds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.