sampleQ | R Documentation |

Replace the sample function in the context of fixed quantiles. Warning : first argument has less features.

```
sampleQ(x, size, quantiles, replace = FALSE, prob = NULL)
```

`x` |
a vector of one or more elements from which to choose. |

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

`quantiles` |
1D array containing values drawn in U(0,1). Length has to be equal to size. |

`replace` |
should sampling be with replacement ? |

`prob` |
a vector of probability weights for obtaining the elements of the vector being sampled. |

a vector of length size with elements drawn from x.

```
set.seed(1)
quantiles <- runif(40)
sampleQ(1:10, 10, quantiles[1:10])
sampleQ(1:10, 10, quantiles[11:20])
sampleQ(11:20, 10, quantiles[1:10])
sampleQ(1:10, 20, quantiles[21:40], replace = TRUE)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.