---
title: "Outputs"
output: Gmisc::docx_document
bibliography: references.bib
csl: epl.csl
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warn = FALSE,
                      message = FALSE)

```

```{r}
library(rio)
aspirin <- import("aspirin.csv")
library(dplyr)
library(knitr)
x <- aspirin %>%
    group_by(sex, condition) %>%
    summarise(N = n(), Mean = mean(value), SD = sd(value)) %>%
    ungroup()
kable(x, digits = c(rep(0, 3), 1, 2),
      col.names = c("Sex", "Condition", "N", "Mean", "SD"))
```

```{r}
library(htmlTable)
lr <- c("l", "l", "r", "r", "r")
htmlTable(txtRound(x, digits = c(rep(0, 3), 1, 2)),
          align = lr, align.header = lr,
          rnames = FALSE,
          header = c("Sex", "Condition", "N", "Mean", "SD"),
          caption = "Table 1: A htmlTable table.")
```

```{r}
lr <- c("l", "r", "r", "r")
htmlTable(txtRound(select(x, -sex), digits = c(rep(0, 2), 1, 2)),
           align = lr, align.header = lr,
          rnames = FALSE,
          rgroup = c("Female", "Male"),
          n.rgroup = c(2, 2),
          header = c("", "N", "Mean", "SD"),
          caption = "Table 2: A grouped htmlTable table.")
```

```{r dev = "png", dpi = 600, fig.width = 2, fig.height = 2, out.height="300px", out.width = "300px"}
boxplot(value ~ sex + condition, data = aspirin, xaxt = "n",
        ylab = "Value")
axis(1, at = 1:4, labels = c("Female\nAspirin", "Male\nAspirin", "Female\nPlacebo",
                 "Male\nPlacebo"), line = 0.5, tick = FALSE)
```

@Agre02
@AitS04
    
# References
