categorizeByIntervals: Categorize by intervals

Description Usage Arguments Details Value See Also Examples

View source: R/categorizeByIntervals.R

Description

Categorizes numeric values allowing for different types of intervals.

Usage

1
categorizeByIntervals(v_n_values, ci_intervals)

Arguments

v_n_values

a numeric vector. Must have length of at least 1.

ci_intervals

a CategorizationIntervals object. See CategorizationIntervals.

Details

Flexibles intervals are allowed in ci_intervals for example '(-Inf,0), [0,0], (0,Inf)' is valid.

Value

a vector with the same length as v_n_values with the same type as ci_intervals[['value']].

See Also

CategorizationIntervals

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
ci_intervals <- CategorizationIntervals(value = c(-1,0,1),
                                        min = c(-Inf, 0, 0),
                                        max = c(0 , 0, Inf),
                                        close_left = c(0,1,0),
                                        close_right = c(0,1,0) )
v_n_values <- -3:3
categorizeByIntervals(v_n_values, ci_intervals)


ci_intervals <- CategorizationIntervals(value = c(1,2,3),
                                        v_s_intervals = c("(-Inf,0)","[0,0]","(0,Inf)"))
v_n_values <- -3:3
categorizeByIntervals(v_n_values, ci_intervals)


ci_intervals <- CategorizationIntervals(value = c("Neg","Zero","Pos"),
                                        min = c(-Inf, 0, 0),
                                        max = c(0 , 0, Inf),
                                        close_left = c(0,1,0),
                                        close_right = c(0,1,0) )
v_n_values <- -3:3
categorizeByIntervals(v_n_values, ci_intervals)

AlejandroKantor/akmisc documentation built on May 5, 2019, 3:51 a.m.