-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11bf8ce
commit 6b91d47
Showing
25 changed files
with
603 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
#' Clean raw Breeding Bird Survey survey data | ||
#' | ||
#' The raw data for the Breeding Bird Survey includes unidentified species and some species that are not well-sampled by the BBS methods. This function filters a dataframe to remove those species. | ||
#' The raw data for the Breeding Bird Survey includes unidentified species and | ||
#' some species that are not well-sampled by the BBS methods. This function | ||
#' filters a dataframe to remove those species. | ||
#' | ||
#' @param bbs_survey_data data frame with columns for species and AOU | ||
#' | ||
#' @return bbs_survey_data with unidentified species, nightbirds, waterbirds, non-targets removed | ||
#' @return bbs_survey_data with unidentified species, nightbirds, waterbirds, | ||
#' non-targets removed | ||
#' @export | ||
#' @importFrom utils data | ||
#' @examples | ||
#' head(filter_bbs_survey(demo_route_raw)) | ||
|
||
filter_bbs_survey <- function(bbs_survey_data) { | ||
colnames(bbs_survey_data) <- tolower(colnames(bbs_survey_data)) | ||
colnames(bbs_survey_data)[which(colnames(bbs_survey_data) == "aou")] <- "AOU" | ||
colnames(bbs_survey_data)[which(colnames(bbs_survey_data) == "aou")] <- | ||
"AOU" | ||
|
||
|
||
if (!("AOU" %in% colnames(bbs_survey_data))) { | ||
stop("`AOU` column is required!") | ||
} | ||
|
||
|
||
bbs_survey_data <- bbs_survey_data[!(bbs_survey_data$AOU %in% unidentified_species$AOU), ] | ||
bbs_survey_data <- bbs_survey_data[!(bbs_survey_data$AOU %in% nontarget_species$AOU), ] | ||
bbs_survey_data <- | ||
bbs_survey_data[!(bbs_survey_data$AOU %in% unidentified_species$AOU),] | ||
bbs_survey_data <- | ||
bbs_survey_data[!(bbs_survey_data$AOU %in% nontarget_species$AOU),] | ||
|
||
bbs_survey_data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.