tests/test_Unique.R

library(classInt)
set.seed(1)
data_censored<-c(rep(0,10), rnorm(100, mean=20,sd=1),rep(26,10))
cl2<-classIntervals(data_censored, n=4, style="fixed",dataPrecision=2,fixedBreaks=c(-1,1,19,25,30))

print(cl2, unique=FALSE)
print(cl2, unique=TRUE)

### example from man page
classIntervals(data_censored, n=5, style="fixed", fixedBreaks=c(15.57, 25, 50, 75, 100, 155.30))

print(classIntervals(data_censored, n=5, style="sd"), unique=FALSE)
print(classIntervals(data_censored, n=5, style="sd"), unique=TRUE)
print(classIntervals(data_censored, n=5, style="equal"),  unique=TRUE)
print(classIntervals(data_censored, n=5, style="quantile"),  unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="kmeans"),  unique=TRUE)
print(classIntervals(data_censored, n=5, style="hclust", method="complete"),  unique=TRUE)
print(classIntervals(data_censored, n=5, style="hclust", method="single"),  unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="bclust", verbose=FALSE),  unique=TRUE)
print(classIntervals(data_censored, n=5, style="fisher"),  unique=TRUE)
print(classIntervals(data_censored, n=5, style="jenks"),  unique=TRUE)

print(classIntervals(data_censored, n=5, style="fixed", fixedBreaks=c(15.57, 25, 50, 75, 100, 155.30)), unique=TRUE)
print(classIntervals(data_censored, n=5, style="sd"), unique=TRUE)
print(classIntervals(data_censored, n=5, style="equal"), unique=TRUE)
print(classIntervals(data_censored, n=5, style="quantile"), unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="kmeans"), unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="kmeans", intervalClosure="right"), unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="kmeans", dataPrecision=0), unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="kmeans"), cutlabels=FALSE, unique=TRUE)
print(classIntervals(data_censored, n=5, style="hclust", method="complete"), unique=TRUE)
print(classIntervals(data_censored, n=5, style="hclust", method="single"), unique=TRUE)
set.seed(1)
print(classIntervals(data_censored, n=5, style="bclust", verbose=FALSE), unique=TRUE)
print(classIntervals(data_censored, n=5, style="bclust", hclust.method="complete", verbose=FALSE), unique=TRUE)
print(classIntervals(data_censored, n=5, style="fisher"), unique=TRUE)
print(classIntervals(data_censored, n=5, style="jenks"), unique=TRUE)
x <- c(0, 0, 0, 1, 2, 50)
print(classIntervals(x, n=3, style="fisher"), unique=TRUE)
print(classIntervals(x, n=3, style="jenks"), unique=TRUE)

Try the classInt package in your browser

Any scripts or data that you put into this service are public.

classInt documentation built on May 30, 2017, 4:58 a.m.