This one may not be as step-by-step, because the GIS layer of BBS routes I have may not have been published yet. Nonetheless, here’s what I did.
- Cleaning up the spatial data and splitting routes
- Assigning segment order once the routes are split
- Summarizing spatial covariates by segment
- Determining which segments can be considered the same
- Importing BBS and spatial data into R at the segment level
The final step looks similar to the route-level tutorial, but with pieceID being the variable to match on. Set “bird” to the AOU code of your species of interest.
dataperspecies <- subset(BBS[which(BBS$Aou == bird),]) vars$abundance <- dataperspecies$count[match(vars$pieceID, dataperspecies$pieceID)] vars[is.na(vars)] <- 0 assess <- data.table(vars) whattodrop <- assess[,list(abundance=sum(abundance)),by='rteno'] droprtes <- whattodrop$rteno[whattodrop$abundance==0] perspp <- vars[!(vars$rteno %in% droprtes),] perspp$Year <- as.integer(perspp$Year) perspp$yearfix <- perspp$Year perspp <- perspp[perspp$RunType > 0,] #vars <- vars[vars$RPID < 102] perspp <- perspp[c("Year","MN","firstyear","rteno","ObsN","abundance")]
Here is the full script: bbs_10stop_species