---
title: "Analysing icons for climate change and with `hyper3` objects"
author: "R. K. S. Hankin"
output: bookdown::html_document2
bibliography: hyper2.bib  # copy vignettes/hyper2.bib to inst/
---

```{r setup, include=FALSE}
set.seed(0)
knitr::opts_chunk$set(echo = TRUE)
library("hyper2")
library("magrittr")
options("digits" = 5)
```

```{r out.width='20%', out.extra='style="float:right; padding:10px"',echo=FALSE}
knitr::include_graphics(system.file("help/figures/hyper2.png", package = "hyper2"))
```

To cite the `hyper2` package in publications, please use @hankin2017_rmd.
This minimal document reads file `icons.txt` and creates R objects
`icons`, `icons_matrix`, and `icons_maxp`.  The dataset is discussed
extensively in @west2008 and @hankin2010.


```{r readiconstable}
icons_table  <- as.matrix(read.table("icons.txt",header=TRUE))
icons_table
```

Thus the first row shows that a total of $5+3+4+3=15$ respondents were
shown icons `NB`, `L`, `THC`, and `WAIS`; 5 of them chose `NB` as
"most concerning", 3 chose `L`, 4 chose `THC` and 3 chose `WAIS`.

We can use function `saffy()` to convert the table into a `hyper2`
object:

```{r createhyper2}
icons <- saffy(icons_table)
icons
icons_maxp <- maxp(icons)
icons_maxp
```

This file exists for consistency; an extended discussion (and
statistical tests) are presented in the vignette `icons`.


### Package dataset {-}

Following lines create `icons.rda`, residing in the `data/` directory of the package.

```{r,label=saveiconsdataset}
save(icons_table,icons,icons_maxp,file="icons.rda")
```

## References {-}