```{r, include=FALSE}
## Vowels and their quality
vowels <- voweltab <- rbind(
  c("i", "close", "front", "unrounded"),
  c("e", "close-mid", "front", "unrounded"),
  c("ɛ", "open-mid", "front", "unrounded"),
  c("a", "open", "front", "unrounded"),
  c("ɑ", "open", "back", "unrounded"),
  c("ɔ", "open-mid", "back", "rounded"),
  c("o", "close-mid", "back", "rounded"),
  c("u", "close", "back", "rounded"),
  c("y", "close", "front", "rounded"),
  c("ø", "close-mid", "front", "rounded"),
  c("œ", "open-mid", "front", "rounded"),
  c("ɶ", "open", "front", "rounded"),
  c("ɒ", "open", "back", "rounded"),
  c("ʌ", "open-mid", "back", "unrounded"),
  c("ɤ", "close-mid", "back", "unrounded"),
  c("ɯ", "close", "back", "unrounded"),
  c("ɨ", "close", "central", "unrounded"),
  c("ʉ", "close", "central", "rounded")
)
vowels <- cbind(vowels, "", "", "")

## Vowel quality parameters
height <- c("close", "near-close", "close-mid", "mid", "open-mid", "near-open", "open")
front_back <- c("front", "front centralized", "central", "back centralized", "back")
lips <- c("unrounded", "rounded")

## Binary coding of features
match_mchoice <- function(true, options) {
  x <- match(true, options)
  sapply(x, function(i) paste(append(rep(0, length(options) - 1), 1, after = i - 1), collapse = ""))
}
vowels[, 5] <- match_mchoice(vowels[,2], height)
vowels[, 6] <- match_mchoice(vowels[,3], front_back)
vowels[, 7] <- match_mchoice(vowels[,4], lips)

## Casually selecting two vowels
vowels <- vowels[sample(1:nrow(vowels), 2), ]

## Possible answers and correct solution
ans <- rep(c(height, front_back, lips), 2)
sol <- paste(t(vowels[, 5:7]), collapse = "|")
```

Question
========
Describe the following Cardinal vowels according to the three parameters
vowel height, frontness-backness, and lip rounding:

1. [`r vowels[1,1]`] is the ##ANSWER1## ##ANSWER2## ##ANSWER3## vowel.
2. [`r vowels[2,1]`] is the ##ANSWER4## ##ANSWER5## ##ANSWER6## vowel.

```{r, echo=FALSE, results="asis"}
answerlist(ans, markup = "markdown")
```

Solution
========
For an overview of the 18 Cardinal vowels see <https://en.wikipedia.org/wiki/Cardinal_vowels>.

1. [`r vowels[1,1]`] is the `r vowels[1,2]` `r vowels[1,3]` `r vowels[1,4]` vowel.
2. [`r vowels[2,1]`] is the `r vowels[2,2]` `r vowels[2,3]` `r vowels[2,4]` vowel.

Meta-information
================
exname: Cardinal vowels
extype: cloze
exclozetype: schoice|schoice|schoice|schoice|schoice|schoice
exsolution: `r sol`

