---
title: "Examples of generating combinations"
author: "Randy Lai"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Examples of generating combinations}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, echo = FALSE}
library(iterpc)
```

1. combinations: without replacement: distinct items
```{r}
I <- iterpc(5, 2)
getall(I)
```

2. combinations: with replacement: distinct items
```{r}
I <- iterpc(5, 2, replace = TRUE)
getall(I)
```

3. combinations: without replacement: non distinct items
```{r}
x <- c("a", "a", "b", "c")
I <- iterpc(table(x), 2)
# or I <- iterpc(c(2,1,1), 2, label=c("a", "b", "c"))
getall(I)
```

4. combinations: with replacement: non distinct items
```{r}
x <- c("a", "a", "b", "c")
I <- iterpc(table(x), 2, replace = TRUE)
# or I = iterpc(c(2,1,1), 2, label=c("a", "b", "c"), replace=TRUE)
getall(I)
```
