-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfaunmap_site_taxonomy.Rmd
More file actions
536 lines (354 loc) · 21.9 KB
/
Copy pathfaunmap_site_taxonomy.Rmd
File metadata and controls
536 lines (354 loc) · 21.9 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
---
title: "FAUNMAP site taxonomy"
author: "Nick Hoffman"
date: "`r Sys.Date()`"
output:
html_document:
df_print: paged
css: db_by_db.css
toc: true
number_sections: true
toc_depth: 1
toc_float: true
theme: journal
---
```{r, results='asis', echo = F}
toc_depth <- rmarkdown::metadata$output$html_document$toc_depth
sel <- paste0("h",(toc_depth+1):10, collapse = " > span, ")
cat(paste0("<style>",
sel,
" > .header-section-number { display: none; } </style>"))
```
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(httr)
library(dplyr)
library(DT)
library(geojsonsf)
library(osmdata)
library(rosm)
library(rmapshaper)
library(tmap)
library(sf)
library(leaflet)
library(stringr)
library(wkb)
library(tidyverse)
library(neotoma2)
library(lubridate)
```
# Faunmap overall
```{r download-tables,message=FALSE,warning=FALSE,echo=FALSE}
tables = c("datasets","publications", "datasetpublications","collectionunits","datasetdatabases","constituentdatabases","sites","depenvttypes", "variables","repositoryspecimens","repositoryinstitutions")
for (i in seq(length(tables))) {
table = tables[[i]]
dslinks = content(GET(paste0("https://api.neotomadb.org/v2.0/data/dbtables?table=",table,"&limit=75000&offset=0")))$data
if (table == "publications") {
dsl_df = matrix(nrow=length(dslinks),ncol=(length(dslinks[[1]]) - 2))
for (j in seq(1,length(dslinks))) {
for (k in seq((length(dslinks[[1]])) - 2)) {
if (!is.null(dslinks[[j]][[k]])) {
dsl_df[j,k] = dslinks[[j]][[k]]
}
}
}
}
else {
dsl_df = matrix(nrow=length(dslinks),ncol=length(dslinks[[1]]))
for (j in seq(1,length(dslinks))) {
for (k in seq(length(dslinks[[1]]))) {
if (!is.null(dslinks[[j]][[k]])) {
dsl_df[j,k] = dslinks[[j]][[k]]
}
}
}
}
dsl_df = as.data.frame(dsl_df)
if (table =="publications") {
names(dsl_df) = names(dslinks[[1]])[1:(length(dslinks[[1]])-2)] }
else {
names(dsl_df) = names(dslinks[[1]])
}
assign(paste0(table,"_df"), dsl_df)
}
faun_sites = sites_df %>% dplyr::left_join(collectionunits_df, by=join_by(siteid)) %>% left_join(depenvttypes_df, by=join_by(depenvtid)) %>% left_join(datasets_df,by=join_by(collectionunitid)) %>% left_join(datasetdatabases_df,by=join_by(datasetid)) %>% left_join(constituentdatabases_df,by=join_by(databaseid)) %>% dplyr::filter(databaseid=='10')
```
## Faunmap Units
```{r mni, message=FALSE,warning=FALSE,echo=FALSE}
faun_ds = faun_sites %>% distinct(datasetid)
#all = list()
#for (i in seq(length(faun_ds[[1]]))) {
# dsid= faun_ds[i,]
# print(i)
# return = content(GET(paste0('https://api.neotomadb.org/v2.0/data/downloads/',dsid)))$data
# all = append(all,return)
#}
#saveRDS(all, file = "all.rds")
all <- readRDS("all.rds")
idx = 0
for (i in seq(length(all))) {
samp = all[[i]]$site$collectionunit$dataset$samples
for (j in seq(length(samp))) {
for (k in seq(length(samp[[j]]$datum))) {
idx = idx + 1
}
}
}
faun_dats = matrix(nrow=idx,ncol=8)
idx = 0
for (i in seq(length(all))) {
samp = all[[i]]$site$collectionunit$dataset$samples
for (j in seq(length(samp))) {
for (k in seq(length(samp[[j]]$datum))) {
idx = idx +1
if(!is.null(samp[[j]]$datum[[k]]$value)) {
faun_dats[[idx,1]] = samp[[j]]$datum[[k]]$value
}
if(!is.null(samp[[j]]$datum[[k]]$units)) {
faun_dats[[idx,2]] = samp[[j]]$datum[[k]]$units
}
if(!is.null(samp[[j]]$datum[[k]]$elementtype)) {
faun_dats[[idx,3]] = samp[[j]]$datum[[k]]$elementtype
}
if(!is.null(samp[[j]]$datum[[k]]$variablename)) {
faun_dats[[idx,4]] = samp[[j]]$datum[[k]]$variablename
}
faun_dats[[idx, 5]] = all[[i]]$site$collectionunit$dataset$datasetid
faun_dats[[idx, 6]] = all[[i]]$site$siteid
faun_dats[[idx, 7]] = all[[i]]$site$sitename
faun_dats[[idx, 8]] = all[[i]]$site$collectionunit$dataset$datasettype
}
}
}
faun_dat_df = as.data.frame(faun_dats)
names(faun_dat_df) = c("value","units","elementtype","variablename","datasetid","siteid","sitename","datasettype")
specific = faun_dat_df %>% dplyr::filter(units %in% c("NISP","MNI","individual specimen","ml","1-4 scale","g/m^2", "MNE"))
specsites = specific %>% group_by(sitename) %>% count()
numspecsites = length(specsites[[1]])
faun_dat_df %>% group_by(units,datasettype) %>% count() %>% arrange(desc(n)) %>% datatable(rownames=FALSE)
na_fauna = faun_dat_df %>% dplyr::filter(is.na(units) & datasettype == "vertebrate fauna")
nafaun_neo2 = get_datasets(as.numeric(na_fauna$datasetid),all_data=TRUE)
nafaun_samps = samples(get_downloads(nafaun_neo2,all_data=TRUE))
datatable(nafaun_samps[c("units","value","variablename","datasetid","database","datasettype","siteid","sitename")],rownames=FALSE)
```
## FAUNMAP dataset repositories
```{r repojoin, message=FALSE,warning=FALSE,echo=FALSE}
repos = repositoryspecimens_df %>% dplyr::filter(datasetid %in% faun_sites$datasetid) %>%
left_join(repositoryinstitutions_df, by = join_by(repositoryid))
repos %>% group_by(repository) %>% count() %>% arrange(desc(n)) %>% datatable(rownames=FALSE)
```
```{r smiths, echo=FALSE, message=FALSE,warning=FALSE}
states = read_sf("tl_2024_us_state.shp")
states = ms_simplify(states)
# https://www.digtech-llc.com/blog/2012/3/27/94-shovelbums-guide-part-15-the-smithsonian-trinomial-system.html
state_names = c("Alabama", "Alaska", "American Samoa", "Arizona", "Arkansas", "California", "Colorado","Connecticut","Delaware", "District of Columbia", "Federated States of Micronesia", "Florida", "Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Marshall Islands", "Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Palau","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virgin Islands","Virginia","Washington","West Virginia","Wisconsin","Wyoming")
tris = c(1,49,NA,2,3,4,5,6,7,NA,NA,8,9,NA,50,10,11,12,13,14,15,16,17,NA,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,NA,33,34,35,NA,36,NA,37,38,39,40,41,42,43,NA,44,45,46,47,48)
state_tri_mapper=data.frame(names=state_names,trinom_num=tris) %>% dplyr::mutate(trinom_num = as.character(trinom_num))
state_tri_mapper = state_tri_mapper %>% dplyr::mutate(trinom_num = case_when(names=="Arizona" ~ "AZ", names=="California" ~ "CA", names=="New Mexico" ~ "LA",names=="Maine" ~ "ME",
TRUE ~ trinom_num))
siteid=c("junk")
sitename=c("junk")
state=c("junk")
collectionunitid=c("junk")
geography=("junk")
potentials = data.frame(siteid=siteid,sitename=sitename,state=state,geography=geography, collectionunitid=collectionunitid)
for (num in seq(length(states[[1]]))) {
coordinates_sf = states[num,] %>% st_convex_hull()
coord_json = sf_geojson(coordinates_sf) %>% URLencode()
sites = content(GET(paste0("https://api.neotomadb.org/v2.0/data/sites?loc=",coord_json,"&limit=9999&offset=0")))$data
if (length(sites) > 0) {
idx = 0
for (i in seq(length(sites))) {
for (j in seq(length(sites[[i]]$collectionunits))) {
for (k in seq(length(sites[[i]]$collectionunits[[j]]$datasets))) {
idx = idx + 1
}
}
}
sites_mat = matrix(nrow=idx,ncol=11)
idx2 = 0
for (i in seq(length(sites))) {
for (j in seq(length(sites[[i]]$collectionunits))) {
for (k in seq(length(sites[[i]]$collectionunits[[j]]$datasets))) {
idx2 = idx2 + 1
for (m in seq(5)) {
if (!is.null(sites[[i]][[m]])) {
sites_mat[[idx2, m]] = sites[[i]][[m]]
}
}
if (!is.null(sites[[i]]$collectionunits[[j]]$handle)) {
sites_mat[[idx2,6]] = sites[[i]]$collectionunits[[j]]$handle
}
if (!is.null(sites[[i]]$collectionunits[[j]]$collectionunit)) {
sites_mat[[idx2,7]] = sites[[i]]$collectionunits[[j]]$collectionunit
}
if (!is.null(sites[[i]]$collectionunits[[j]]$collectionunitid)) {
sites_mat[[idx2,8]] = sites[[i]]$collectionunits[[j]]$collectionunitid
}
if (!is.null(sites[[i]]$collectionunits[[j]]$collectionunittype)) {
sites_mat[[idx2,9]] = sites[[i]]$collectionunits[[j]]$collectionunittype
}
if (!is.null(sites[[i]]$collectionunits[[j]]$dataset[[k]]$datasetid)) {
sites_mat[[idx2,10]] = sites[[i]]$collectionunits[[j]]$dataset[[k]]$datasetid
}
if (!is.null(sites[[i]]$collectionunits[[j]]$dataset[[k]]$datasettype)) {
sites_mat[[idx2,11]] = sites[[i]]$collectionunits[[j]]$dataset[[k]]$datasettype
}
}
}
}
sites_state_df = as.data.frame(sites_mat)
names(sites_state_df) = c("siteid","sitename","sitedescription","geography","altitude","handle","collectionunit","collectionunitid","collectionunittype","datasetid","datasettype")
numb = state_tri_mapper %>% dplyr::filter(names == states$NAME[[num]]) %>% dplyr::select(trinom_num)
if (states$NAME[[num]] == "Vermont") {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename, "VT")) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else if (states$NAME[[num]] == "Rhode Island") {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename, "RI")) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else if (states$NAME[[num]] == "Connectictut") {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename, "CT")| str_detect(sitename, "6")) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else if (states$NAME[[num]] == "Arizona") {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename, "[A-Za-z]{1,2}:[0-9]{1,2}")) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else if (states$NAME[[num]] == "Alaska") {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename, "[A-Za-z]{3}-[0-9]+")) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else if (states$NAME[[num]] == "New York") {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename, "\\d{5}")|
str_detect(sitename,"30")) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else if (!is.na(numb[[1]])) {
potentialsites = sites_state_df %>% dplyr::filter(str_detect(sitename,as.character(numb[[1]]))) %>% dplyr::select(siteid,sitename,geography,collectionunitid) %>% dplyr::mutate(state = states$NAME[[num]])
potentials = rbind(potentials,potentialsites)
} else {
#print(paste0("Null mapper value for ", states$NAME[[num]]))
}}}
potentials = potentials %>% dplyr::filter(sitename != "junk") %>% dplyr::filter(!str_detect(sitename,"Jensen 1998")) %>% dplyr::filter(!str_detect(sitename,"Riegel 1965")) %>% dplyr::filter(!str_detect(sitename,"Haile 8A")) %>% dplyr::filter(!str_detect(sitename,"Santa Fe River 8A")) %>% distinct() %>% dplyr::filter(!sitename %in% c("Site 66 (Delcourt et al. 1983)","Site 110 (G.M. Peterson 1978)","Site 10 (Mack, Bryant, and Pell 1978)","LRRB31","Site 106 (Swain unpublished)","Anthony Cave [MALB 29]","Baldy Peak Cave [MALB 29]","Solar Energy Generating Station II [1.76.42]","Luz Solar Trough [1.76.34]", "Site 13 (Delcourt et al. 1983)","Site 14 (Delcourt et al. 1983)","Site 66 (Delcourt et al. 1983)","CHUSKA29","CHUS29","Upper Alturas [UO Loc 2424; CAS Loc 36805]","Site 35 (Heusser 1978)","BECL360","Stand 45 (Mack and Bryant 1974]","Law's [MSv100]","Seven Springs [CE101x3]","Rock House [MS201]","Mobile Bay, MB0810-GC20","Spring Canyon [A-41]","Pratt Cave [TMM-41172]","Little Sunday Canyon Local Fauna [V5414]","Avery Ranch [s:5:8]","Big Juniper House [1595]","Badger House [1453]","Mesa Verde Site 875","La Poudre LP5 Site","SNMN5","SNMN15","ANIM5","ANIM35","COMO5","LPLT5","GATC26","Mile 49 Lac la Ronge Highway","Stations 49-55 (Lichti-Federovich and Ritchie 1968)","TK-49","49 [HFL49]","Valkenswaard N49","Mosquito Lake Site, [PSM-00049]","BOREA24, Mile 49","LR49","ALTAK49","ABD249","Island 35 [10-Q-7]","Hancock Ditch (ditch #39)","Tunica Bayou Site 22","NLA06608-1232","JHMN24 (McAndrews and Wright 1969)","NLA06608-0439","Twin Peaks, AZ","Tucson Mountains, Pima Co., AZ","Vijdt Polder (B49D0349)","Borteldonk (B49F0399)","Halsteren (B49B0566)","Ossendrecht 49D20-1","Shangri-La Bog","Oskino-09","'White-2 (Le4) Pond'","Mud Pond (VT)")) %>%
dplyr::filter(!str_detect(sitename,"Mount Evans Surface")) %>% dplyr::filter(!str_detect(sitename,"Elliot-Fisk")) %>% dplyr::filter(!str_detect(sitename,"Raux-Feui")) %>% dplyr::filter(!str_detect(sitename,"Exposure")) %>%
dplyr::filter(!str_detect(sitename,"LDDsite")) %>% dplyr::filter(!str_detect(sitename,"Pond,")) %>%
dplyr::filter(!str_detect(sitename,"Begin boardwalk")) %>% dplyr::filter(!str_detect(sitename,"unpublished")) %>%
dplyr::filter(!str_detect(sitename,"Colonel's Island Site")) %>%
dplyr::filter(!str_detect(sitename,"Delcourt")) %>% dplyr::filter((state !="California") | state == "California" & str_detect(sitename,"CA"))
us_bounds = read_sf("cb_2018_us_nation_20m.shp")
unique_pot = geojson_sf(potentials$geography) %>% cbind(potentials) %>% distinct(siteid,.keep_all=TRUE) %>% st_transform(crs=st_crs(us_bounds)) %>% st_filter(us_bounds)
unique_pot = unique_pot %>% left_join(datasets_df,by=join_by("collectionunitid")) %>% left_join(datasetdatabases_df,by=join_by("datasetid")) %>% left_join(constituentdatabases_df, by=join_by("databaseid"))
faun_smiths = unique_pot %>% dplyr::filter(databasename =="FAUNMAP") %>% distinct(sitename,.keep_all=TRUE)
num_smiths = length(faun_smiths[[1]])
```
```{r depenv, echo=FALSE,warning=FALSE,message=FALSE}
archaeo_faun = faun_sites %>% dplyr::filter(depenvthigherid == "1") %>% distinct(siteid,depenvt,.keep_all = TRUE)
arch_sfc = st_as_sfc(hex2raw(archaeo_faun$geog),EWKB=TRUE)
arch_sf = st_as_sf(archaeo_faun,geom=arch_sfc) %>% dplyr::select(!geog)
```
```{r sensitive, message=FALSE,echo=FALSE,warning=FALSE}
dictionary = c("human","Human","Homo","homo","indian","Indian","native","Native","indigenous","Indigenous","mound","Mound","buri","Buri","bury","Bury","archaeo","Archaeo","person","Person","people","People","cairn","Cairn")
dictionary = as.data.frame(dictionary)
dictionary <- dictionary[order(dictionary$dictionary),]
matches_sitename <- grep(paste(dictionary,collapse="|"),
faun_sites$sitename)
sitename_results= faun_sites[matches_sitename,] %>% distinct(siteid,.keep_all = TRUE)
num_sacredsites = length(sitename_results[[1]])
```
## Faunmap site info
This table shows all FAUNMAP sites, their geographic precision when known, their archaeological status, units when more specific than present/absent, and the associated repositories.
```{r origifuzz, echo=FALSE,warning=FALSE,message=FALSE}
precision_df <- data.frame(
Code = c("E", "QA", "QP", "QC", "T"),
Description = c(
"Exact (lat/long)",
"Quadrangle Approximate",
"Quadrangle Precise",
"Quad. in center of county",
"USGS Township Coord."
)
)
locs = read.csv("LOCALITY.txt",header=FALSE)
recov = read.csv("L_RECOV.txt",header=FALSE)
depo = read.csv("DEPOSIT.txt",header=FALSE)
faun= read.csv("FAUNAL.txt",header=FALSE)
names(faun) = c("locid","analysisunit","taxon","confidence","mni","nisp","context","modifications")
names(depo) = c("locid","analysisunit","recoverymethod","depsys","depenv","facies","mixing")
names(locs) = c("locid","sitename_f","alternate_name","state/province","county","sitenumber","coded_by","recdatecreated","recdatemodified","notes","geographic_precision","quadrangle","quadrangle_size","lat","lon","altitude","repository")
faun_sites2 = faun_sites %>% dplyr::mutate(faun_name = str_replace(sitename, "\\s*\\[.*$", "")) %>% dplyr::mutate(extracted = str_extract(sitename, "(?:(?:\\[[^\\]]*\\]){2}|\\[[^\\]]*\\])$")) %>% dplyr::mutate(extracted = str_replace_all(extracted, "[\\[\\]]", "")) %>% distinct(siteid,sitename,faun_name,extracted) %>% left_join(locs, by=join_by("faun_name" == "sitename_f")) %>% group_by(faun_name) %>% dplyr::filter(sitenumber == extracted | n() == 1 | is.na(extracted)) %>% dplyr::select(siteid,sitename,faun_name,extracted,sitenumber,geographic_precision,quadrangle,quadrangle_size,lat,lon,repository) %>% dplyr::mutate(sitename_sensitive = case_when(siteid %in% sitename_results$siteid ~ "yes", TRUE ~ "no")) %>% mutate(smith = case_when(siteid %in% faun_smiths$siteid ~ "yes", TRUE ~ "no")) %>% mutate(archaeo = case_when(siteid %in% archaeo_faun$siteid ~ "yes", TRUE ~ "no"))
unittypes = specific %>% group_by(siteid,sitename) %>% summarize(toString(unique(units)))
names(unittypes) = c("siteid","sitename","units")
repo_bysite = repos %>% left_join(faun_sites, by=join_by(datasetid)) %>% group_by(siteid) %>% summarize(toString(unique(repository)))
names(repo_bysite) = c("siteid","repos")
faun_dt = faun_sites2 %>% select(siteid,sitename,faun_name,extracted,sitenumber,geographic_precision,sitename_sensitive,smith,archaeo) %>% left_join(unittypes) %>% left_join(repo_bysite)
datatable(faun_dt,rownames=FALSE)
```
`r numspecsites` sites in FAUNMAP have units associated with them that are more specific than presence absence
```{r specsitesshow,message=FALSE,warning=FALSE,echo=FALSE}
```
# Priorities
## Highest Priority: very archaeo, exact, specific
The highest priority sites have
* sensitive site name,
* archaeological depositional environment,
* a smithsonian trinomial,
* exact geographic precision, and
* data more specific than presence/absence:
```{r dinaa, echo=FALSE,warning=FALSE,message=FALSE}
priority1 = faun_dt %>% dplyr::filter(sitename_sensitive == "yes" & archaeo=="yes" & smith =="yes" & geographic_precision == "E" & !is.na(units))
datatable(priority1,rownames=FALSE)
```
Still high priority: very archaeo, exact, just presence/absence
```{r dinaa100, echo=FALSE,warning=FALSE,message=FALSE}
priority10 = faun_dt %>% dplyr::filter(sitename_sensitive == "yes" & archaeo=="yes" & smith =="yes" & geographic_precision == "E" & is.na(units))
datatable(priority10,rownames=FALSE)
```
## High Priority: archaeo and exact
Also high priority are those sites which have at least one of
* sensitive site name,
* archaeological depositional environment, or
* smithsonian trinomial
also have exact geographic precision, and have specific units.
```{r stillhigh, echo=FALSE,warning=FALSE,message=FALSE}
priority2 = faun_dt %>% dplyr::filter((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & !(sitename_sensitive == "yes" & archaeo=="yes" & smith =="yes" ) & geographic_precision == "E" & !is.na(units))
datatable(priority2,rownames=FALSE)
```
Sites that are archaeo, exact, and not specific are still high priority.
```{r stillhigh100, echo=FALSE,warning=FALSE,message=FALSE}
priority20 = faun_dt %>% dplyr::filter((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & !(sitename_sensitive == "yes" & archaeo=="yes" & smith =="yes" ) & geographic_precision == "E" & is.na(units))
datatable(priority20,rownames=FALSE)
```
## High Priority: archaeo and unknown
Also high priority are sites that have at least one of
* sensitive site name,
* archaeological depositional environment, or
* smithsonian trinomial
have unknown geographic precision, and specific units:
```{r stillhigh2, echo=FALSE,warning=FALSE,message=FALSE}
priority3 = faun_dt %>% dplyr::filter((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & is.na(geographic_precision) & !is.na(units))
datatable(priority3,rownames=FALSE)
```
These sites are archaeo, uknown, and presence/absence:
```{r stillhigh200, echo=FALSE,warning=FALSE,message=FALSE}
priority30 = faun_dt %>% dplyr::filter((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & is.na(geographic_precision) & is.na(units))
datatable(priority30,rownames=FALSE)
```
## Lower Priority: archaeo and QA/QP//Q/T
These sites are archaeological by some indicator and are fuzzed to the quadrangle level, and they have units more specific than presence/absence. Well, "Q" is a little ambiguous. Only five sites have geographic precision Q and there's no metadata about what it means. To be safe, we'll assume it means quadrangle level fuzzing.
```{r lower, echo=FALSE,warning=FALSE,message=FALSE}
priority4 = faun_dt %>% dplyr::filter((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & geographic_precision %in% c("QA","QP","T","Q") & !is.na(units))
datatable(priority4,rownames=FALSE)
```
These sites are archaeo, quadrangle-fuzzed, and presence/absence:
```{r lower100, echo=FALSE,warning=FALSE,message=FALSE}
priority40 = faun_dt %>% dplyr::filter((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & geographic_precision %in% c("QA","QP","T","Q") & is.na(units))
datatable(priority40,rownames=FALSE)
```
## Low priority: Paleontological and Archaeological/QC
The lowest priority are those archaeological sites already obfuscated to the county level or any sites which fail all tests for archaeological status.
These ones are more specific than presence/absence:
```{r lowerstill, echo=FALSE,warning=FALSE,message=FALSE}
priority5 = faun_dt %>% dplyr::filter(((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & geographic_precision %in% c("QC")) | ((sitename_sensitive == "no" & archaeo=="no" & smith =="no")) & !is.na(units))
datatable(priority5,rownames=FALSE)
```
These ones are presence/absence
```{r lowerstill100, echo=FALSE,warning=FALSE,message=FALSE}
priority50 = faun_dt %>% dplyr::filter(((sitename_sensitive == "yes" | archaeo=="yes" | smith =="yes") & geographic_precision %in% c("QC")) | ((sitename_sensitive == "no" & archaeo=="no" & smith =="no")) & is.na(units))
datatable(priority50,rownames=FALSE)
```