---
title: "Zygocity - Norwegian Twin registry questionnaire"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{zygo}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
options(rmarkdown.html_vignette.check_title = FALSE)
frag_path <- here::here("man", "fragments", "zygocity")
paths <- list.files(frag_path, "Rmd", full.names = TRUE)
names(paths) <- gsub("\\.Rmd", "", basename(paths))
paths <- as.list(paths)
```

## Background

```{r child=paths$background, eval = TRUE} 
```


## Scoring
```{r child=paths$scoring, eval = TRUE} 
```

```{r child=paths$score_coding, eval = TRUE} 
```

### Equation
```{r child=paths$equation, eval = TRUE} 
```

## Data requirements  
```{r child=paths$datareq, eval = TRUE} 
```

## Use the `zygo` functions
Currently undocumented...

```{r}
library(questionnaires)
library(dplyr)
zygo <- tibble(
  id = 1:10,
  twinpair = rep(1:5, each = 2),
  drop = c(1, 2, 3, NA, 2, 2, 1, 1, NA, 2),
  stranger = c(1, 2, 4, NA, 2, 3, 3, 1, NA, 2),
  dexterity = c(1, 1, 3, NA, 2, 2, 1, 2, NA, 1),
  voice = c(2, 2, 3, NA, 2, 2, 1, 1, NA, 1),
  eye = c(2, 2, 2, NA, 2, 2, 1, 1, NA, 2),
  belief = c(1, 1, 2, NA, 2, 2, 1, 1, NA, 2)
)

zygo_compute(zygo, 
             twin_col = twinpair, 
             cols = 3:6, 
             recode = FALSE)

```

## References  
```{r child=paths$references, eval = TRUE} 
```
