Description Usage Arguments Value See Also Examples
A convenience functon for creating breaks with various methods.
1 | create_breaks(x, y = NULL, method = "kmeans", control = NULL, ...)
|
x |
X is a numeric vector to be discretized |
y |
Y is the response vector used for calculating metrics for discretization |
method |
Method is the type of discretization approach used. Possible methods are: "dt", "entropy", "kmeans", "jenks" |
control |
Control is used for optional parameters for the method. It is a list of optional parameters for the function |
... |
instead of passing a list into control, arguments can be parsed as is. |
A vector containing the breaks
1 2 3 4 5 6 7 8 9 10 11 12 | kmeans_breaks <- create_breaks(1:10)
create_bins(1:10, kmeans_breaks)
# passing the k means parameter "centers" = 4
kmeans_breaks <- create_breaks(1:10, list(centers=4))
create_bins(1:10, kmeans_breaks)
entropy_breaks <- create_breaks(1:10, rep(c(1,2), each = 5), method="entropy")
create_bins(1:10, entropy_breaks)
dt_breaks <- create_breaks(iris$Sepal.Length, iris$Species, method="dt")
create_bins(iris$Sepal.Length, dt_breaks)
|
[1] 1 1 1 2 2 2 3 3 3 3
[1] 1 1 1 1 2 2 2 3 3 3
[1] 1 1 1 1 1 2 2 2 2 2
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2
[38] 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 2 3 2 3 1 3 1 1 2 2 2 2 3 2 2 3 2 2 2 3 2
[75] 3 3 3 3 2 2 2 2 2 2 1 2 3 3 2 2 2 2 2 1 2 2 2 3 1 2 3 2 4 3 3 4 1 4 3 4 3
[112] 3 3 2 2 3 3 4 4 2 3 2 4 3 3 4 3 2 3 4 4 4 3 3 2 4 3 3 2 3 3 3 2 3 3 3 3 3
[149] 3 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.