Skip to content

Conversation

AtomChen0425
Copy link

Summary

This PR fixes a bug in BuildPlots.R where the use of an incorrect bandwidth string in geom_density() caused runtime errors when generating density plots.

Changes

  • Replaced bw = "SJ" with bw = "sj" in all geom_density() calls:
    • Line 108
    • Line 121
    • Line 158

Problem

The original code used bw = "SJ" (uppercase), which is not a valid option for the bw parameter in geom_density(). This caused the following error:

2: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
3: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
4: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
5: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 
6: Computation failed in `stat_density()`.
Caused by error in `precompute_bw()`:
! `bw` must be one of "nrd0", "nrd", "ucv", "bcv", "sj", "sj-ste", or
  "sj-dpi", not "SJ".
ℹ Did you mean "sj"? 

Fix

Changed the bandwidth method to lowercase "sj", which is a valid and robust choice for density estimation.

Impact

This fix ensures that density plots are generated correctly without runtime errors, improving the reliability of the plotting templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant