Description Usage Arguments Examples
A simple function to put numeric values into a certain interval. Suppose you have 20, 60, 80, 100, and you want them to be in the interval of [0, 1], so you can get 0, 0.5, 0.75, 1.
1 2 3 4 5 6 7 8 9 | scale_free(
x,
left = 0,
right = 1,
reverse = FALSE,
xmin = NULL,
xmax = NULL,
na.rm = FALSE
)
|
x |
a numeric vector or a numeric matrix, data frame, tibble object. |
left |
the smallest value of the the interval.
If |
right |
the largest value of the the interval.
If |
reverse |
whether to assign values in a
reverse way. Default is FALSE.
If |
xmin |
the min value. Default is NULL,
which means use the min value of |
xmax |
the same meaning as |
na.rm |
used by |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | y=scale_free(c(-1, 0, 2))
y=scale_free(c(-1, 0, 2), rev=TRUE)
#
# x is a data frame.
x=data.frame(
c(-1, 0, 0, 0, 2), c(-1, 0, 0, 0, 2),
c(-2, 0, 2, 4, 6), c(-2, 0, 2, 4, 6)
)
y=scale_free(x,
left=0, right=10,
reverse=c(FALSE, TRUE, FALSE, TRUE)
)
y=scale_free(x,
left=c(0, 0, 100, 100), right=c(10, 100, 200, 200),
reverse=c(FALSE, TRUE, FALSE, TRUE)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.