---
title: "Data transformation"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Data transformation}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup, output=FALSE}
library(serosv)
```

## Aggregate data

Use function `transform_data()` to convert line listing data (data with `t`, `seropositive` columns) to aggregated data (data with `t`, `pos`, `tot` columns)

Arguments:

-   `t` the time vector

-   `spos` the seropositive vector (TRUE/FALSE or 1/0)

-   `heterogeneity_col` new name for the time vector, default to `heterogeneity_col = "t"`

```{r}
linelisting_data <- hcv_be_2006
aggregated_data <- transform_data(linelisting_data$dur, linelisting_data$seropositive)
aggregated_data
```
