1 | plotDensity(x, minSep = 0.1, xlab = "Value", more = "", ...)
|
x |
|
minSep |
|
xlab |
|
more |
|
... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, minSep = 0.1, xlab = "Value", more = "", ...)
{
x <- x[!is.na(x)]
res = clusterAndCollapse(x, minSep)
means = unique(res$values)
plot(density(x, adjust = 0.5), xlab = xlab, lty = 1, lwd = 2,
..., main = paste0(res$retain, " components (dashed) at minSep=",
minSep, more))
if (res$retain > 0) {
for (i in seq_along(means)) abline(v = means[i], col = i +
2, lty = 3, lwd = 2)
dens = density(res$values, adjust = 0.5)
lines(dens$x, dens$y * (1.2/length(means)), lty = 3,
lwd = 2)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.