Discretizes a non-factor input vector and returns the result as numeric.

discrete_by_quantile(x)

Arguments

x

A vector containing arbitrary data.

Value

A numeric vector with the data re-coded to based on the quantiles.

Examples

x <- rnorm(1000) discrete_by_quantile(x)
#> [1] 3 3 2 4 1 1 4 2 2 2 4 2 4 3 1 1 1 2 4 2 4 4 3 2 1 3 1 2 2 1 1 3 2 2 3 1 1 #> [38] 1 1 2 1 4 4 3 4 1 2 2 4 3 1 1 2 2 2 1 1 2 3 3 4 2 4 2 2 1 1 3 3 2 1 4 1 2 #> [75] 1 1 3 3 1 3 2 1 4 4 2 1 1 1 4 1 1 4 4 2 4 2 4 3 1 1 1 2 4 1 4 1 2 3 2 2 2 #> [112] 4 2 4 4 4 1 3 2 4 3 2 1 1 4 2 3 4 1 2 1 1 2 2 2 3 2 3 1 1 2 4 1 2 1 1 2 4 #> [149] 4 1 1 4 1 1 2 4 3 4 3 2 4 3 4 4 2 3 3 1 4 1 4 1 4 4 3 3 3 3 4 1 2 3 2 3 3 #> [186] 1 3 4 1 1 1 3 3 2 3 4 1 3 1 1 4 1 1 1 1 1 1 2 1 4 2 1 1 1 2 1 3 2 2 3 2 2 #> [223] 3 4 1 4 4 1 1 3 1 3 3 3 2 1 3 4 3 2 1 3 4 3 4 3 3 1 1 3 1 2 3 3 2 4 4 2 1 #> [260] 1 1 3 2 3 4 1 1 4 4 4 2 4 2 2 2 1 1 2 3 3 4 2 3 4 2 2 3 1 3 1 3 4 1 4 2 1 #> [297] 3 2 1 4 1 3 2 1 3 1 4 4 2 2 4 4 3 4 4 4 1 3 4 2 4 3 3 1 4 3 1 4 4 4 3 1 4 #> [334] 2 2 2 3 2 1 3 3 3 1 4 1 4 1 4 2 4 1 2 1 3 1 3 2 3 3 3 4 3 3 1 4 2 3 1 1 2 #> [371] 2 4 3 2 4 2 4 1 4 4 2 3 3 4 4 2 4 3 1 3 4 4 1 2 3 3 1 4 3 3 2 4 1 4 4 2 2 #> [408] 1 1 4 3 4 4 3 2 3 2 2 1 2 4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