knitr::opts_chunk$set(echo = FALSE)
library(tidyverse)
library(leaflet)
library(tmap)

Introduction

This document provides a preliminary data quality check for data collected by Region 7 MBM Waterfowl Division aerial surveys. Currently supported surveys include the Arctic Coastal Plain (ACP), Yukon-Kuskokwim Delta duck (YKD) and goose (YKG), Copper River Dusky (CRD), and North American Waterfowl Breeding Population (WBPHS).

All data checks are currently using assumptions for data fields as expected to be written into protocols and summarized and analyzed using the USFWS Alaska Region MBM survey analysis R package AKaerial. For information and current version, see https://github.com/USFWS/AKaerial.

You have chosen the file:

print(path.name)

For the area:

print(area)

We have standardized the mandatory column headings as:

r necessary

r if(s.colmatch != "green") {"\\begin{comment}"} This file contains all of the required column names.

Status - GREEN r if(s.colmatch != "green") {"\\end{comment}"}

r if(s.colmatch != "red") {"\\begin{comment}"} This file does not contain all of the required column names.

r colnames(data)

Status - RED r if(s.colmatch != "red") {"\\end{comment}"}

Spatial

There are no spatial checks provided here, instead please review the plot of transect-level observations below for accuracy.

if(area != "WBPHS"){
 tm <- tmap::tm_shape(basemap) + tmap::tm_polygons(col = "STRATNAME", alpha = 0.5) +
    tmap::tm_shape(sf.lines, name="Flown Track") + tmap::tm_lines() +
    tmap::tm_text("Transect", size=2) +
    tmap::tm_shape(sf.obs, name="Bird Obs") + tmap::tm_dots(col="Day") +
    tmap::tm_basemap(server = "Esri.WorldGrayCanvas") +
    tmap::tm_scale_bar()


leaf = tmap::tmap_leaflet(tm)

leaf
}

Swans

Swan nests should only be recorded if a swan is also present (active). Correct notation is recording the nest as open, 1 and the associated swan on a separate entry as single or pair, 1.

r if(s.swan != "green") {"\\begin{comment}"} All swan nests and associated swans appear to be recorded correctly.

Status - GREEN r if(s.swan != "green") {"\\end{comment}"}

r if(length(test.swan$bad[,1]) == 0) {"\\begin{comment}"} There are r length(test.swan$bad[,1]) not recorded as open, 1.

Status - RED r if(length(test.swan$bad[,1]) == 0) {"\\end{comment}"}

r if(length(test.swan$missing[,1]) == 0) {"\\begin{comment}"} There are r length(test.swan$missing[,1]) nests without associated swan records.

Status - RED r if(length(test.swan$missing[,1]) == 0) {"\\end{comment}"}

Obs_Type (Unit) Codes

The following Obs_Type codes are acceptable- single, pair, open, flkdrake. Leading or trailing spaces are not acceptable.

r if(s.unit != "green") {"\\begin{comment}"} All Obs_Type codes appear to be recorded correctly.

Status - GREEN r if(s.unit != "green") {"\\end{comment}"}

r if(length(test.unit$bad[,1]) == 0) {"\\begin{comment}"} The following Obs_Type values are not acceptable (if more than 6, only the first 6 shown):

kableExtra::kable_styling(kableExtra::kable(head(test.unit$bad)))

Status - RED r if(length(test.unit$bad[,1]) == 0) {"\\end{comment}"}

Seat Codes

Seat codes must be either LF, RF, LR, or RR, and are case-sensitive.

r if(s.seat != "green") {"\\begin{comment}"} All seat codes appear to be recorded correctly.

Status - GREEN r if(s.seat != "green") {"\\end{comment}"}

r if(length(test.seat$bad[,1]) == 0) {"\\begin{comment}"} The following seat values are not acceptable (first 6 shown):

kableExtra::kable_styling(kableExtra::kable(head(test.seat$bad)))

Status - RED r if(length(test.seat$bad[,1]) == 0) {"\\end{comment}"}

Species Codes

The current list of acceptable species codes can be found in the object sppntable, or for WBPHS, WBPHSsppntable.

r if(s.species != "green") {"\\begin{comment}"} All species codes appear to be recorded correctly, or at least an acceptable substitute is known (for any YELLOW status codes entered).

Status - GREEN r if(s.species != "green") {"\\end{comment}"}

r if(length(test.species$change[,1]) == 0) {"\\begin{comment}"} The following species codes are not acceptable and will be updated in the QC_Obs file:

kableExtra::kable_styling(kableExtra::kable(table(test.species$change$Species)))

Status - YELLOW r if(length(test.species$change[,1]) == 0) {"\\end{comment}"}

r if(length(test.species$bad[,1]) == 0) {"\\begin{comment}"} The following species codes are not acceptable and no replacement is available:

kableExtra::kable_styling(kableExtra::kable(table(test.species$bad$Species)))

Status - RED r if(length(test.species$bad[,1]) == 0) {"\\end{comment}"}

Observers

Observer intials must be input as 3 characters, all uppercase.

r if(s.observer != "green") {"\\begin{comment}"} All observers appear to be recorded correctly.

Status - GREEN r if(s.observer != "green") {"\\end{comment}"}

r if(s.observer != "red") {"\\begin{comment}"} Some observer initials have been entered incorrectly.

print(unique(data$Observer))

Status - RED r if(s.observer != "red") {"\\end{comment}"}

Year, Month, Day

Must be numeric.

r if(s.year != "green") {"\\begin{comment}"} All years appear to be recorded correctly.

Status - GREEN r if(s.year != "green") {"\\end{comment}"}

r if(s.year != "red") {"\\begin{comment}"} There are non-numeric values in Year. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.year$bad, ])))

Status - RED r if(s.year != "red") {"\\end{comment}"}

r if(s.month != "green") {"\\begin{comment}"} All months appear to be recorded correctly.

Status - GREEN r if(s.month != "green") {"\\end{comment}"}

r if(s.month != "red") {"\\begin{comment}"} There are non-numeric values in Month. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.month$bad, ])))

Status - RED r if(s.month != "red") {"\\end{comment}"}

r if(s.day != "green") {"\\begin{comment}"} All days appear to be recorded correctly.

Status - GREEN r if(s.day != "green") {"\\end{comment}"}

r if(s.day != "red") {"\\begin{comment}"} There are non-numeric values in Day. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.day$bad, ])))

Status - RED r if(s.day != "red") {"\\end{comment}"}

Other numeric values: Wind_Vel, Lat, Lon, Time, Delay, Num

Must all be numeric (or NA).

r if(s.wind != "green") {"\\begin{comment}"} All Wind_Vel values appear to be recorded correctly.

Status - GREEN r if(s.wind != "green") {"\\end{comment}"}

r if(s.wind != "red") {"\\begin{comment}"} There are non-numeric values in Wind_Vel. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.wind$bad, ])))

Status - RED r if(s.wind != "red") {"\\end{comment}"}

r if(s.lat != "green") {"\\begin{comment}"} All Latitude values appear to be recorded correctly.

Status - GREEN r if(s.lat != "green") {"\\end{comment}"}

r if(s.lat != "red") {"\\begin{comment}"} There are non-numeric values in Lat. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.lat$bad, ])))

Status - RED r if(s.lat != "red") {"\\end{comment}"}

r if(s.lon != "green") {"\\begin{comment}"} All Longitude values appear to be recorded correctly.

Status - GREEN r if(s.lon != "green") {"\\end{comment}"}

r if(s.lon != "red") {"\\begin{comment}"} There are non-numeric values in Lon. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.lon$bad, ]))) 

Status - RED r if(s.lon != "red") {"\\end{comment}"}

r if(s.time != "green") {"\\begin{comment}"} All times appear to be recorded correctly.

Status - GREEN r if(s.time != "green") {"\\end{comment}"}

r if(s.time != "red") {"\\begin{comment}"} There are non-numeric values in Time. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.time$bad, ]))) 

Status - RED r if(s.time != "red") {"\\end{comment}"}

r if(s.delay != "green") {"\\begin{comment}"} All delays appear to be recorded correctly.

Status - GREEN r if(s.delay != "green") {"\\end{comment}"}

r if(s.delay != "red") {"\\begin{comment}"} There are non-numeric values in Delay. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.delay$bad, ]))) 

Status - RED r if(s.delay != "red") {"\\end{comment}"}

r if(s.num != "green") {"\\begin{comment}"} All group sizes (Num) appear to be recorded correctly.

Status - GREEN r if(s.num != "green") {"\\end{comment}"}

r if(s.num != "red") {"\\begin{comment}"} There are non-numeric values in Num. If more than 6, only the first 6 shown.

kableExtra::kable_styling(kableExtra::kable(head(data[test.num$bad, ]))) 

Status - RED r if(s.num != "red") {"\\end{comment}"}

Visualization

obs_plot= ggplot2::ggplot(data, ggplot2::aes(Obs_Type)) +
  ggplot2::geom_bar(fill = "#0073C2FF") 


sp_plot= ggplot2::ggplot(data, ggplot2::aes(Species)) +
  ggplot2::geom_bar(fill = "#0073C2FF") +
  ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 45, hjust = 1))

num_plot= ggplot2::ggplot(data, ggplot2::aes(Num)) +
  ggplot2::geom_bar(fill = "#0073C2FF") 

print(obs_plot)

print(sp_plot)

print(num_plot)

Transect Summary

The following section provides a table of all REPORTED NAVIGATIONAL transects in the data file. These are NOT checked against the design transects or stratification and should be used ONLY as an extra QA/QC step for the transcriber. Navigational transects are numbered incorrectly according to the design and get changed before any analysis.

trans=sort(unique(data$Transect))

trans %>%

  kableExtra::kable(format="html",
                    col.names = c("Transect"),
                    escape = F
                    ) %>%


  kableExtra::kable_styling("bordered",
                            full_width=FALSE,
                            font_size = 14)  %>%

  kableExtra::scroll_box(height = "250px")


USFWS/AKaerial documentation built on April 3, 2025, 4:06 p.m.