rfromboxes {detrendr} | R Documentation |

## Randomly draw balls from boxes.

### Description

Given a number of boxes with a specified number of balls in each, randomly draw a number of balls from these boxes, recording how many balls was drawn from each. An empty box cannot be drawn from.

### Usage

```
rfromboxes(n, balls, weights = NULL)
```

### Arguments

`n` |
A natural number. The number of balls to draw. |

`balls` |
A vector of natural numbers. The number of balls in each box to begin with. |

`weights` |
A non-negative numeric vector the same length as |

### Value

A vector of natural numbers with the same length as `balls`

. The
number of balls drawn from each box.

### See Also

rtoboxes

### Examples

```
balls <- 1:10
rfromboxes(40, balls)
rfromboxes(40, balls, weights = c(rep(1, 9), 0))
```

[Package

*detrendr*version 0.6.15 Index]