| rng2lev | R Documentation |
Convert values of x to the N levels in levs distinguished by the N-1 thresholds in cuts.
When values of x are equal to a value of cuts, assignment to level is dependent on whether the value of each element of cuts is less than 0 vs. greater than or equal to 0.
For a value in cuts less than 0, the level assigned is the lower of the levels distinguished by that value of cuts.
Otherwise, the level assigned is the upper of the levels distinguished by that value of cuts.
rng2lev(x, cuts, levs)
x |
An atomic object of sortable values. |
cuts |
An atomic vec of |
levs |
An atomic vec of |
An atomic object of the same dimension as x and the same mode as levs.
Other conversions:
hex_dec_help(),
tocase(),
u2u_help()
numVALS <- -5:5
chrVALS <- letters[1:11]
ordVALS <- factor(chrVALS, levels = chrVALS, ordered = TRUE)
numCUTS <- c(-3, 0, 3)
chrCUTS <- c("c", "f", "i")
ordCUTS <- factor(chrVALS, levels = chrVALS, ordered = TRUE)
rngLEVS <- c("A", "B", "C", "D")
rng2lev(numVALS, numCUTS, rngLEVS)
rng2lev(chrVALS, chrCUTS, rngLEVS)
rng2lev(ordVALS, ordCUTS, rngLEVS)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.