Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

alloc

Allocate values to "buckets" subject to weights and constraints


Description

Allocates tgt of something to length(bucketLims) different "buckets" subject to the constraint that each bucket has a maximum value of bucketLims that cannot be exceeded. By default counts are distributed equally between buckets, but weights can be provided using ws to have the redistribution prefer certain buckets over others.

Usage

alloc(tgt, bucketLims, ws = rep(1/length(bucketLims), length(bucketLims)))

Arguments

tgt

Value to distribute between buckets.

bucketLims

The maximum value that each bucket can take. Must be a vector of positive values.

ws

Weights to be used for each bucket. Default value makes all buckets equally likely.

Value

A vector of the same length as bucketLims containing values distributed into buckets.


SoupX

Single Cell mRNA Soup eXterminator

v1.5.2
GPL-2
Authors
Matthew Daniel Young
Initial release
2021-05-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.