---
title: "Data Flags"
author: "Victor Granda (Sapfluxnet Team)"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Data Flags}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

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

Data flags indicate comments on individual data points raised in the quality
control assessment of site data. They are useful to understand the original
data and to track analysis problems to their origins.  

Possible values for flags when data comes from Sapfluxnet project are as follow:

  + **"CALCULATED"** Indicates that the value was originally missing and was
    calculated in the quality check step.
  
  + **"MANUAL_REMOVED"** Indicates that the value was manually removed in the
    quality control step, due to curator decision.
  
  + **"NA_ADDED"** Indicates that the value was originally non-existent and it
    was created and filled with NA. Usually the result of equalising the sap
    flow and environmental TIMESTAMPS.
  
  + **"NA_PRESENT"** Indicates that the value was originally an NA

  + **"OUT_REMOVED"** Indicates that the value was clearly an outlier and was
    removed and substituted by NA
  
  + **"OUT_WARN"** Indicates that the value could be an outlier based on hampel
    filter algorithm. Not removed nor substituted
  
  + **"RANGE_REMOVED"** Indicates values that were clearly out of the range of
    variable. Removed and converted to NA
  
  + **"RANGE_WARN"** Indicates that the value could be out of "usual" maximum
    value for the variable. Not removed.
  
  + **"USER_MODF"** Modified by the user. Added when sfn_mutate or sfn_mutate_at
    functions are used.

Data points can have more than one flag. In that case flags are separated by
`"; "` (i.e. `"OUT_WARN; OUT_REMOVED"`)
