as_kde: Coercion to class kde

Description Usage Arguments Value Examples

View source: R/distribution_functions.R

Description

A coercion function to class "kde", currently the only method is for objects of class "density" from the stats package.

Usage

1
2
3
4
as_kde(x, ...)

## S3 method for class 'density'
as_kde(x, ...)

Arguments

x

an object

...

extra arguments for methods. Currently not used.

Value

an object of class "kde"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(1234)
.x <- rnorm(5000)
dx <- density(.x)
oldPar <- par(mfrow = c(1,2), pty = "s", cex.main = 0.8,
  mar = c(3, 3, 1, 1) + 0.1, las = 1, mgp = c(1.5, 0.5, 0),
  cex.axis = 0.7, cex.lab = 0.8, tck = -0.015)
plot(dx)
plot(as_kde(dx))
par(oldPar)
rm(.x, oldPar)

BillVenables/kdeR documentation built on April 12, 2021, 1:51 p.m.