Skip to content

unify argument defaults for density-like plots #131

@tjmahr

Description

@tjmahr

This is something I noticed while reviewing ppc_dens_overlay(). The density defaults were hard-coded for ppc_dens_overlay() but not for these similar functions.

mcmc_areas <- function(..., 
                       bw = NULL,
                       adjust = NULL,
                       kernel = NULL,
                       n_dens = NULL) {}

mcmc_areas_data <- function(...,
                            bw = NULL,
                            adjust = NULL,
                            kernel = NULL,
                            n_dens = NULL) {}

mcmc_areas_ridges <- function(...,
                             bw = NULL, 
                             adjust = NULL, 
                             kernel = NULL,
                             n_dens = NULL){}

mcmc_areas_ridges_data <- function(...,
                                   bw = NULL, 
                                   adjust = NULL, 
                                   kernel = NULL,
                                   n_dens = NULL) {}

# this function does all the density calculations for the four above functions
compute_interval_density <- function(x, interval_width = 1, n_dens = 1024,
                                     bw = NULL, adjust = NULL, kernel = NULL) {
  n_dens <- n_dens %||% 1024
  ...
}

We should make this more consistent and update the @template args-density-controls boilerplate file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions