trim_01 {poputils} | R Documentation |
Trim Values So They Are Between 0 and 1
Description
Trim a vector so that all values are greater than 0 and less than 1.
Usage
trim_01(x)
Arguments
x |
A numeric vector. Can be an rvec. |
Details
If
-
min
is lowest element ofx
that is higher than 0, and -
max
is the highest element ofx
that is lower than 1, thentrim_01()
shifts all elements of
x
that are lower thanmin
upwards, so that they equalmin
, andshifts all elements of
x
that are higher thanmax
downwards, so that they equalmax
.
Value
A trimmed version of x
See Also
-
logit()
,invlogit()
Logit transformation
Examples
x <- c(1, 0.98, -0.001, 0.5, 0.01)
trim_01(x)
[Package poputils version 0.4.1 Index]