equal_discrete {gtexture}R Documentation

Function Factory for Even Discretization Functions

Description

Returns a function that converts a continuous numeric vector into an integer vector with discrete levels.

Usage

equal_discrete(nlevels)

Arguments

nlevels

number of levels to split continuous vector into

Value

function that makes a numeric vector discrete

Examples

# test data
x <- 1:10

# create and apply function to split x into 2 discrete levels
split_2 <- equal_discrete(2)
split_2(x)

# create and apply function to split x into 5 discrete levels
split_5 <- equal_discrete(5)
split_5(x)

[Package gtexture version 1.0.0 Index]