Learn R Programming

inum (version 1.0-5)

inum: Coerse Variables in Data Frames to enum or interval

Description

Represents elements of a data frame as enum or interval.

Usage

inum(object, nmax = 20, ...)
# S3 method for data.frame
inum(object, nmax = 20, ignore = NULL, 
     total = FALSE, weights = NULL, as.interval = "",
     complete.cases.only = FALSE, meanlevels = FALSE, ...)

Value

An object of class inum, basically a list of enum or interval objects. If total = TRUE, an integer vector with a data frame as levels attribute is returned. In this case, 0

means NA.

Arguments

object

A data frame.

nmax

Maximal number of categories for each of the numeric variables.

ignore

A character vector of variable names not to be discretised.

total

A logical. TRUE means that a condensed data frame of all variables is returned, FALSE a list of discretised variables.

weights

An optional vector of weights.

as.interval

A character vector of variable names to be converted to interval instead of enum.

complete.cases.only

A logical. TRUE removes all rows with missing values.

meanlevels

A logical. TRUE, the level is the mean of the observations in the corresponding bin. The default FALSE uses the largest observation in the bin.

...

Additional arguments, currently ignored.

Details

Each variable in object is converted to enum or interval.

Examples

Run this code
data("iris", package = "datasets")
iris[1,1] <- NA
inum(iris, nmax = 5)
inum(iris, nmax = 5, total = TRUE)
inum(iris, nmax = 5, total = TRUE, as.interval = "Sepal.Width",
     complete.cases.only = TRUE)

Run the code above in your browser using DataLab