Skip to content

Commit

Permalink
Merge pull request #24 from ajkhattak/master
Browse files Browse the repository at this point in the history
bugs_in_distribution
  • Loading branch information
mikejohnson51 authored Aug 15, 2024
2 parents cb507de + 6b63ac3 commit 677f1c7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/custom_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ distribution = function(value, coverage_fraction, breaks = 10, constrain = FALSE
x1 = value*coverage_fraction
x1 = x1[!is.na(x1)]

if(constrain | length(breaks) > 1){
if(constrain & length(breaks) > 1){

breaks_tmp = c(breaks[1],breaks[2])

breaks = breaks[!breaks > max(x1, na.rm = TRUE)]
ulimit = max(x1, na.rm = TRUE)

if (ulimit < max(breaks, na.rm = TRUE)){
ulimit = min(breaks[breaks >= ulimit])
}

breaks = breaks[breaks <= ulimit]

if (length(breaks) == 1){
breaks = breaks_tmp
Expand Down

0 comments on commit 677f1c7

Please sign in to comment.