Skip to contents

Function is useful if parameters on the `PISA' metric should be transformed into competence levels.

Usage

num.to.cat(x, cut.points, cat.values = NULL)

Arguments

x

Numeric vector.

cut.points

Numeric vector with cut scores.

cat.values

Optional: vector with labels for the cut scores. Note: if specified, length of cat.values should be length(cut.points)+1.

Value

Vector with factor values.

Author

Sebastian Weirich

Examples

values <- rnorm(10,0,1.5) * 100 + 500
num.to.cat(x = values, cut.points = 390+0:3*75)
#>  [1] 1 3 1 3 4 5 1 2 2 2
#> attr(,"cat.values")
#> [1] 1 2 3 4 5
num.to.cat(x = values, cut.points = 390+0:3*75, cat.values = c("1a", "1b", 2:4))
#>  [1] "1a" "2"  "1a" "2"  "3"  "4"  "1a" "1b" "1b" "1b"
#> attr(,"cat.values")
#> [1] "1a" "1b" "2"  "3"  "4"