BBS Data Summarized for 10 Stops

If you want to use the finer-scale BBS data, here’s a tweak to the R code I presented. In this case, you won’t want the SpeciesTotal, country number (perhaps, otherwise add it it to the ID variables) or StopTotal (again, I assume).

BBS$countrynum <- NULL
BBS$SpeciesTotal <- NULL
BBS$StopTotal <- NULL

Then, you’re going to want to select your ID variables and melt the data frame, such that the interval is now long format instead of wide.

BBS <- melt(BBS, id.vars = c("Year","statenum","Route","RPID","Aou","rteno"),variable.name = "interval",value.name="count")

To make a unique identifier for each segment of a route, combine the unique identifier for the route with the interval name.

BBS$route_piece <- paste(BBS$rteno,BBS$interval,sep="_")

Then, to make a unique ID for each observation, add the year to the identifier.

BBS$pieceID <- paste(BBS$route_piece,BBS$Year,sep="_")

Here’s the full script: BBS10stop

Leave a Reply

Your email address will not be published. Required fields are marked *