bbsBayes / bbsBayes

An R Package for Hierarchical Bayesian Analysis of North American Breeding Bird Survey Data
Other
31 stars 14 forks source link

Understanding `lump.csv` for `stratify()` #196

Closed steffilazerte closed 1 year ago

steffilazerte commented 1 year ago

Hi @AdamCSmithCWS, I'm working through tidying the stratify() function and want to confirm something with the species lumping.

With the species-lump-split/lump.csv, the n_add column reflects how many extra AOU codes there are to amalgamate. So if there are four AOU numbers in the aou1, aou2, etc. columns, n_add should be 4. Right?

My code doesn't use the n_add column, and I have a tiny discrepancy which I think is caused by a small error in the lump data frame:

In row 4, (Bullock's / Baltimore Oriole), the n_add should in fact be 3 (not 2)? Right? Or have I missed something?


> lump_sp <- utils::read.csv(system.file("species-lump-split",  "lump.csv", package = "bbsBayes"),
                             fileEncoding = "latin1", stringsAsFactors = FALSE)
> lump_sp[, c(1,2,5:10)]
   aou_original                               english_original n_add aou1 aou2 aou3 aou4 aou5
1          2973              unid. Dusky Grouse / Sooty Grouse     2 2970 2971   NA   NA   NA
2          5677                  (unid. race) Dark-eyed Junco      5 5671 5670 5680 5660 5690
3          4123    (unid. Red/Yellow Shafted) Northern Flicker     3 4125 4120 4130   NA   NA
4          5077      unid. Bullock's Oriole / Baltimore Oriole     2 5080 5070 5078   NA   NA
5          3370                                Red-tailed Hawk     1 3380   NA   NA   NA   NA
6          4022                                unid. sapsucker     4 4020 4021 4031 4032   NA
7          1690                                     Snow Goose     1 1691   NA   NA   NA   NA
8          6295       unid. Cassin's Vireo / Blue-headed Vireo     3 6292 6291 6290   NA   NA
9          4665     unid. Alder Flycatcher / Willow Flycatcher     2 4661 4660   NA   NA   NA
10         4642   unid. Cordilleran / Pacific-slope Flycatcher     2 4641 4640   NA   NA   NA
11           12            unid. Western Grebe / Clark's Grebe     2   10   11   NA   NA   NA
12         6556 (unid. Myrtle/Audubon's) Yellow-rumped Warbler     2 6550 6560   NA   NA   NA
13         5275           unid. Common Redpoll / Hoary Redpoll     2 5270 5280   NA   NA   NA
AdamCSmithCWS commented 1 year ago

Yes, I think you're right. It should be n_add = 3 for that species. Thank you for catching that.