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

```{r setup, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
link <- function(text, url) {
  return(
    paste0(
      "[", text, "]",
      "(", url, ")"
    )
  )
}
dyn_link <- function(text,
                     base_url,
                     relative_url = "",
                     # Change to TRUE when admiral adopts multiversion docs
                     is_multiversion = FALSE,
                     multiversion_default_ref = "main") {
  url <- paste(base_url, relative_url, sep = "/")
  if (is_multiversion) {
    url <- paste(
      base_url,
      Sys.getenv("BRANCH_NAME", multiversion_default_ref),
      relative_url,
      sep = "/"
    )
  }
  return(link(text, url))
}
# Other variables
admiral_homepage <- "https://pharmaverse.github.io/admiral"
```

# Introduction

As this is a package extension, if you are new to `{admiral}` then the best place to first start
reading would be this `r dyn_link("Get Started", admiral_homepage, "articles/admiral.html")`
guide. This extension package follows the same main idea and conventions, and re-uses many
functions from `{admiral}`, so it is important to thoroughly understand these to be able to
use `{admiralvaccine}`.

# Derivations

The most important functions in `{admiralvaccine}` are the
[derivations](../reference/index.html#section-derivations). Again these follow the same
conventions as `{admiral}` but are focused to vaccine-specific needs.

# Input and Output

It is expected that the input dataset is not grouped. Otherwise an error is
issued.

The output dataset is ungrouped. The observations are not ordered in a dedicated
way. In particular, the order of the observations of the input dataset may not
be preserved.

# Starting a Script

For the vaccine ADaM data structures, an overview of the flow and example function calls
for the most common steps are provided by the following vignettes:

- [Creating ADSL](adsl.html)
- [Creating ADCE](adce.html)
- [Creating ADFACE](adface.html)
- [Creating ADIS](adis.html)

`{admiralvaccine}` also provides template R scripts as a starting point. They can be
created by calling `use_ad_template()` from {admiral}, e.g.,

```{r}
library(admiral)
```

```r
use_ad_template(
  adam_name = "adce",
  save_path = "./ad_adce.R",
  package = "admiralvaccine"
)
```

A list of all available templates can be obtained by `list_all_templates()`
from {admiral}:

```{r}
list_all_templates(package = "admiralvaccine")
```

# Support

Support is provided via the [admiral Slack
channel](https://pharmaverse.slack.com/).