inum {inum} | R Documentation |
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 class 'data.frame'
inum(object, nmax = 20, ignore = NULL,
total = FALSE, weights = NULL, as.interval = "",
complete.cases.only = FALSE, meanlevels = FALSE, ...)
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. |
weights |
An optional vector of weights. |
as.interval |
A character vector of variable names to be converted to |
complete.cases.only |
A logical. |
meanlevels |
A logical. |
... |
Additional arguments, currently ignored. |
Details
Each variable in object
is converted to enum
or interval
.
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
.
Examples
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)