n_goalposts {COINr} | R Documentation |
The distance of each value of x
from the lower "goalpost" to the upper one. Goalposts are specified by
gposts = c(l, u, a)
, where l
is the lower bound, u
is the upper bound, and a
is a scaling parameter.
n_goalposts(x, gposts, direction = 1, trunc2posts = TRUE)
x |
A numeric vector |
gposts |
A numeric vector |
direction |
Either 1 or -1. Set to -1 to flip goalposts. |
trunc2posts |
If |
Specify direction = -1
to "flip" the goalposts. This may be necessary depending on how the goalposts
were defined.
Numeric vector
x <- runif(20)
n_goalposts(x, gposts = c(0.2, 0.8, 1))