Internal helper to calculate the (group-specific) density of a variable
Source:R/plot_density_helpers.R
calc_density.RdInternal helper function that is called in plot_density to
calculate the density of a metric variable. If plot_density is called
from within plot_densityMatrix (i.e., when some of the columns
c("age_group","period_group","cohort_group") are part of the dataset,
the density is computed individually for all respective APC groups.
Arguments
- dat
Dataset with columns
periodandageand the main variable specified through argumenty_var.- y_var
Character name of the main variable to be plotted.
- weights_var
Optional character name of a weights variable used to project the results in the sample to some population.
- ...
Additional arguments passed to
density.