Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejohnson51 committed May 23, 2024
2 parents f63b2c2 + b80eac8 commit cb507de
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions R/custom_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,23 @@ circular_mean <- function (value, coverage_fraction) {

distribution = function(value, coverage_fraction, breaks = 10, constrain = FALSE){

if (length(value) <= 0 | all(is.nan(value))) {
return("[]")
}

x1 = value*coverage_fraction
x1 = x1[!is.na(x1)]

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

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

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

if (length(breaks) == 1){
breaks = breaks_tmp
}

}

tmp = as.data.frame(table(cut(x1, breaks = breaks)))
Expand Down

0 comments on commit cb507de

Please sign in to comment.