A convenience wrapper around draw_ordered that constructs equally
spaced breaks between min and max.
Arguments
- x
Latent numeric variable.
- min, max
Range the latent variable is cut on, rather than a filter applied to it: a value outside
[min, max]joins the outermost bin. For 1.0.2's behaviour, where such a value becameNA, calldraw_ordered(x, breaks = seq(min, max, length.out = bins + 1), strict = TRUE).- bins
Number of Likert categories.
- breaks
Manual interior cut-points, read as
draw_ordered()reads them, solength(breaks) + 1categories. An alternative tomin,max, andbins. 1.0.2 read the same vector as the full set of bin boundaries; thestrict = TRUEcall above returns that answer.- labels
Optional category labels.
Value
An integer vector of category indices, one per element of
x, or an ordered factor with those labels when they are
supplied.
Examples
fabricate(N = 100, x = rnorm(N),
likert = draw_likert(x, min = -3, max = 3, bins = 5))
#> # A tibble: 100 × 3
#> ID x likert
#> <chr> <dbl> <int>
#> 1 001 0.347 3
#> 2 002 -0.918 2
#> 3 003 1.34 4
#> 4 004 -1.08 2
#> 5 005 1.07 4
#> 6 006 0.529 3
#> 7 007 -1.66 2
#> 8 008 0.678 4
#> 9 009 -1.07 2
#> 10 010 -0.341 3
#> # ℹ 90 more rows