This function calculates the density of a numeric vector, potentially rescaling it to a specific range and reflecting it. it is a wrapper for stats::density().

get_density(data_source, values_range, reflected = TRUE, ...)

Arguments

data_source

Vector with numeric values

values_range

A numeric vector of length 2 specifying the range to rescale the data to. If missing, the range of the data is used.

reflected

Logical. Whether or not to reflect the data around 0? (from Density Estimation for Statistics and Data Analysis by B.W.Silverman)

...

Additional parameters used in stats::density

Value

Data.frame with the data_source values and estimated density+

See also