Learn R Programming

rminer (version 1.1)

factorize: Converts numeric object into a factor (levelling).

Description

Converts numeric object into a factor (levelling).

Usage

factorize(x, limits, labels)

Arguments

x
numeric vector.
limits
numeric vector with the limits [min, max[ for each label of the factor (note: length(limits) needs to be equal to length(labels)+1).
labels
the new levels of the factor.

Value

  • Returns a factor.

References

See fit.

See Also

fit, delevels, imputation.

Examples

Run this code
x=seq(-1,1,length.out=5)
f=factorize(x,c(-Inf,0,1e-99,Inf),c("neg","zero","pos"))
print(x)
print(f)

Run the code above in your browser using DataLab