---
title: "NanoSIMS data processing of LANS data in R: HMR files"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{HMR files}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

```{r, message=FALSE, warning=FALSE}
library(lans2r)
library(dplyr)
library(knitr)
library(ggplot2)
```

This vignettes illustrates how to read and visualize data from HMR (=ion beam scan) files generated by the NanoSIMS software. These are primarily tuning files that are valuable for visualizing and evaluating how tuning parameters affect the peak shapes. This functionality is completely independent from LANS.

```{r}
hmr <- load_HMR(system.file("extdata", "nanosims_data", "hmr", package = "lans2r"), 
                prefix = "", suffix = ".hmr_txt")
```

#### Settings overview

```{r}
hmr %>% select(-step, -voltage, -cts) %>% distinct() %>% kable()
```

#### Scan overview

```{r, fig.width = 7, fig.height = 5}
hmr %>% 
  ggplot() +
  aes(voltage, cts, color = ion) + 
  geom_line() +
  scale_y_log10("counts") +
  facet_wrap(~ion, scales = "free")
```


