discret: Discretizes a continuos variable

Description Usage Arguments Details Value Author(s) Examples

View source: R/discret.R

Description

Discretizes a variable in n states.

Usage

1
discret(x, classes=5, type = 7,...)

Arguments

x

a numeric vector

classes

a integer inidcating the numbers of classe for the discretization or a vector indicating the numbers of cut in the x for the discretization. See Details for more information.

type

an integer between 1 and 9 selecting one of the nine quantile algorithms to be used. See quantile for more information.

...

further arguments passed to or from other methods.

Details

classes argument may be express as an integer indication the numebr of classes for the discretization, the cuts are calculated using cut function setting the breaks arguments to get the specific number of classes. Also is posibble set the cuts inturcing a sequnce of number in [0,1] or by a vector containing specific values of x to generate the cut.

Value

A numeric vector of n classes defined in classes

Author(s)

Andres Vallone

Examples

1
2
3
4
set.seed(100)
x<-rnorm(100)
d.x<-discret(x)
table(d.x)

amvallone/spDym documentation built on May 30, 2019, 8:01 a.m.