Learn R Programming

GD (version 1.4)

disc: Convert continuous data to discretized data

Description

Convert continuous data to discretized data

Usage

disc(var, n, method = "quantile", ManualItv)
\method{print}{disc}(result)
\method{plot}{disc}(result)

Arguments

var

A numeric vector of continuous variable

n

The numeber of intervals

method

A character of discretization method

ManualItv

A numeric vector of manual intervals

result

A list of disc result

Examples

Run this code
# NOT RUN {
## method is default (quantile); number of intervals is 4
ds1 <- disc(ndvi_40$Tempchange, 4)
# ds1
## method is equal; number of intervals is 4
ds2 <- disc(ndvi_40$Tempchange, 4, method = "equal")
## method is manual; number of intervals is 4
manualitv1 <- c(-0.5, 0, 1, 2, 4)
ds3 <- disc(ndvi_40$Tempchange, 4, method = "manual", ManualItv = manualitv1)

# }

Run the code above in your browser using DataLab