ctDensity | R Documentation |
Wrapper for base R density function that removes outliers and computes 'reasonable' bandwidth and x and y limits. Used for ctsem density plots.
ctDensity(x, bw = "auto", plot = FALSE, ...)
x |
numeric vector on which to compute density. |
bw |
either 'auto' or a numeric indicating bandwidth. |
plot |
logical to indicate whether or not to plot the output. |
... |
Further args to density. |
y <- ctDensity(exp(rnorm(80)))
plot(y$density,xlim=y$xlim,ylim=y$ylim)
#### Compare to base defaults:
par(mfrow=c(1,2))
y=exp(rnorm(10000))
ctdens<-ctDensity(y)
plot(ctdens$density, ylim=ctdens$ylim,xlim=ctdens$xlim)
plot(density(y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.