Description Usage Arguments Details Examples
1d dernel density estimate.
1 2 | kernel_density_1d(x, weight, bandwidth="bw.nrd",
kernel="gaussian", n=512, na.rm=FALSE)
|
x |
a numeric vector of positions |
weight |
|
bandwidth |
the banwidth. Either a numeric vector, or function that computes the binwidth given the data. |
kernel |
the kernel used for smoothing. Defaults to
|
n |
number of points to use for interpolation |
na.rm |
If |
Offers less flexibility than
local_density_1d
but can be much faster and
has no external dependencies.
1d case uses linear interpolation on the results of
density
. 2d case uses a modified version of
kde2d
.
1 2 3 4 5 | data(baseball, package = "plyr")
dens <- kernel_density_1d(baseball$g)
plot(dens)
plot(kernel_density_1d(baseball$g, bandwidth = 4))
plot(kernel_density_1d(baseball$g, bandwidth = 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.