forked from NCRN/BirdQC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_BirdPointsQC.Rmd
112 lines (80 loc) · 3.52 KB
/
01_BirdPointsQC.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
title: "Bird Points QC"
author: "John Paul Schmit"
date: "8/3/2020"
output: html_document
---
```{r Plot_setup, include=F}
TotPlots<-nrow(QCPoints) #Total number of points being checked
# 1.1.0
Points_Bad_Unit<-QCPoints %>%
filter(!Admin_Unit_Code %in% c("ANTI", "CATO", "CHOH", "GWMP", "HAFE", "MANA", "MONO", "NACE", "PRWI", "ROCR", "WOTR")) %>%
select(Admin_Unit_Code, Point_Name)
#1.2.0
Points_No_Point_Name<-QCPoints %>%
filter(is.na(Point_Name) | Point_Name=="") %>%
select(Admin_Unit_Code, Point_Name)
Points_Duplicated<-QCPoints %>%
group_by(Point_Name) %>%
summarize(Point_Count=n()) %>%
filter(Point_Count !=1) %>%
select(Point_Name, Point_Count)
#1.3.0
Points_No_Coords<-QCPoints %>%
filter(is.na(Latitude)| is.na(Longitude)) %>%
select(Admin_Unit_Code, Point_Name, Latitude, Longitude)
Points_Bad_Coords<-QCPoints %>%
filter(Latitude < 37.7| Latitude > 40.36|Longitude< -79.5 | Longitude > -76.1 ) %>%
select(Admin_Unit_Code, Point_Name, Latitude, Longitude)
Points_Duplicated_Coords<-QCPoints %>%
group_by(Latitude,Longitude) %>%
mutate(Point_Count=n()) %>%
filter(Point_Count!=1) %>%
select(Admin_Unit_Code, Point_Name, Latitude, Longitude, Point_Count)
#1.4.0
Points_Bad_GRTS <- QCPoints %>%
filter(!GRTS_Order %in% 1:4683) %>%
select(Admin_Unit_Code, Point_Name, GRTS_Order)
Points_Duplicated_GRTS<-QCPoints %>%
group_by(GRTS_Order) %>%
mutate(Point_Count=n()) %>%
filter(Point_Count!=1) %>%
select(Admin_Unit_Code, Point_Name, GRTS_Order, Point_Count)
```
#### **Points Checked:** `r TotPlots` ####
### Unit Codes
```{r Point_unit_Codes, echo=FALSE, hold=FALSE, results="asis"}
if(nrow(Points_Bad_Unit)==0) cat("All points have a recognized Unit Code.<br>") else {
errortext("Points with a missing or unrecongized Unit Code:"); NiceTable(Plots_Bad_Unit)}
```
---
### Plot Names
```{r Points_point_names, echo=FALSE, hold=FALSE, results="asis"}
if(nrow(Points_No_Point_Name)==0) cat("All points have a point name.<br>") else {
errortext("Points without a point name:"); NiceTable(Points_No_Ponit_Name)}
if(nrow(Points_Duplicated)==0) cat("All points have a unique point name.<br>") else {
errortext("Points with a duplicated point name:"); NiceTable(Points_Duplicated)}
```
---
### Geographic Coordinates
```{r Points_geo_coords, echo=FALSE, hold=FALSE, results="asis"}
cat("<br>**Coordinates Present**<br>")
if(nrow(Points_No_Coords)==0) cat("All points have geographic coordinates.") else {
cat("Points with missing coordinates:"); NiceTable(Points_No_Coords)}
cat("<br>**Bounding Box**<br>")
if(nrow(Points_Bad_Coords)==0) cat("All points' latitude and longitude are within the NCRN bounding box.<br>") else {
errorText("Points with lat/long outside bounding box:"); NiceTable(Points_Bad_Coords)}
cat("<br>**Unique Coordinates**<br>")
if(nrow(Points_Duplicated_Coords)==0) cat("No points have the same latitude and longitude.<br>") else {
errorText("Points with duplicated latitude and longitude:"); NiceTable(Points_Duplicated_Coords)}
```
---
### GRTS Order
```{r Points_GRTS_Order, echo=FALSE, hold=FALSE, results="asis"}
cat("<br>**Points GRTS Order**<br>")
if(nrow(Points_Bad_GRTS)==0) cat("All points have a valid GRTS order.<br>") else {
errorText("Plots without a GRTS order between 1 and 4683:"); NiceTable(Points_Bad_GRTS)}
cat("<br>**Unique GRTS Order**<br>")
if(nrow(Points_Duplicated_GRTS)==0) cat("No points have duplicaed GRTS orders.<br>") else {
errorText("Points with duplicated GRTS orders:"); NiceTable(Points_Duplicated_GRTS)}
```