Skip to content

Commit

Permalink
move division outside vapply in proportion_cluster_size
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo Gruson <Bisaloo@users.noreply.github.com>
  • Loading branch information
joshwlambert and Bisaloo committed Jan 22, 2024
1 parent 1ab80a5 commit 9e7a07a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/proportion_cluster_size.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ proportion_cluster_size <- function(R, k, cluster_size, ..., offspring_dist,
size = df[i, "k"]
)
propn_cluster <- vapply(cluster_size, function(x) {
sum(simulate_secondary[simulate_secondary >= x]) / sum(simulate_secondary)
}, FUN.VALUE = numeric(1))
sum(simulate_secondary[simulate_secondary >= x])
}, FUN.VALUE = numeric(1)) / sum(simulate_secondary)
if (format_prop) {
propn_cluster <- paste0(round(propn_cluster * 100, digits = 1), "%")
}
Expand Down

0 comments on commit 9e7a07a

Please sign in to comment.