as_kde: Convert data frame or matrix object to kde class
Description
A density specified as a data frame or matrix can be converted to a kde object.
This is useful for plotting the density using autoplot.kde.
As kde objects are defined on a grid, the density values are interpolated
based on the points in the data frame or matrix.
Usage
as_kde(object, density_column, ngrid, ...)
Value
An object of class "kde"
Arguments
object
Data frame or matrix with numerical columns, where one column
(specified by density_column) contains the density values, and the
remaining columns define the points at which the density is evaluated.
density_column
Name of the column containing the density values, specified
as a bare expression. If missing, the last column is used.
ngrid
Number of points to use for the grid in each dimension. Default is
10001 for univariate densities and 101 for multivariate densities.