Sample {DescTools} | R Documentation |

## Random Samples and Permutations

### Description

`Sample`

takes a sample of the specified size from the elements of x using either with or without replacement. The function does the same as the base::sample() and offers additionally an interface for data frames.

### Usage

```
Sample(x, size, replace = FALSE, prob = NULL)
```

### Arguments

`x` |
either a vector of one or more elements from which to choose, or a positive integer. |

`size` |
a positive number, the number of items to choose from. |

`replace` |
a non-negative integer giving the number of items to choose. |

`prob` |
should sampling be with replacement? |

### Value

sampled elements in the same structure as x

### Author(s)

Andri Signorell <andri@signorell.net>

### See Also

### Examples

```
sample(d.pizza, size=5)
```

[Package

*DescTools*version 0.99.54 Index]