Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First iteration of cap_birds #57

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 63 additions & 61 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,61 +1,63 @@
Package: lterdatasampler
Title: Educational dataset examples from the Long Term Ecological Research program
Version: 0.1.0
Date: 2020-08-01
Authors@R: c(
person(given = "Allison",
family = "Horst",
role = c("aut", "cre"),
email = "ahorst@ucsb.edu",
comment = c(ORCID = "0000-0002-6047-5564")),
person(given = "Julien",
family = "Brun",
role = c("aut"),
email = "brun@nceas.ucsb.edu",
comment = c(ORCID = "0000-0002-7751-6238")),
person(given = "Sam",
family = "Guo",
role = c("ctb"),
comment = c("https://github.com/TokyoExpress")),
person(given = "Adhitya",
family = "Logan",
role = c("ctb"),
comment = c("https://github.com/adhil0")),
person(given = "Lian",
family = "Ran",
role = c("ctb"),
comment = c("https://github.com/liaaaaran")),
person(given = "Sophia",
family = "Sternberg",
role = c("ctb"),
comment = c("https://github.com/sophiasternberg")),
person(given = "Karen",
family = "Zhao",
role = c("ctb"),
comment = c("https://github.com/karenezhao"))
)
Description: Selected datasets, one from each LTER site.
License: CC0
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
Depends:
R (>= 2.10)
Suggests:
knitr,
rmarkdown,
janitor,
usethis,
metajam,
tidyverse,
here,
broom,
sf,
ggmap,
leaflet,
lubridate,
patchwork
URL: https://github.com/lter/lterdatasampler
BugReports: https://github.com/lter/lterdatasampler/issues
VignetteBuilder: knitr
Package: lterdatasampler
Title: Educational dataset examples from the Long Term Ecological Research program
Version: 0.1.0
Date: 2020-08-01
Authors@R: c(
person(given = "Allison",
family = "Horst",
role = c("aut", "cre"),
email = "ahorst@ucsb.edu",
comment = c(ORCID = "0000-0002-6047-5564")),
person(given = "Julien",
family = "Brun",
role = c("aut"),
email = "brun@nceas.ucsb.edu",
comment = c(ORCID = "0000-0002-7751-6238")),
person(given = "Sam",
family = "Guo",
role = c("ctb"),
comment = c("https://github.com/TokyoExpress")),
person(given = "Adhitya",
family = "Logan",
role = c("ctb"),
comment = c("https://github.com/adhil0")),
person(given = "Lian",
family = "Ran",
role = c("ctb"),
comment = c("https://github.com/liaaaaran")),
person(given = "Sophia",
family = "Sternberg",
role = c("ctb"),
comment = c("https://github.com/sophiasternberg")),
person(given = "Karen",
family = "Zhao",
role = c("ctb"),
comment = c("https://github.com/karenezhao"))
)
Description: Selected datasets, one from each LTER site.
License: CC0
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
Depends:
R (>= 2.10)
Suggests:
knitr,
rmarkdown,
janitor,
usethis,
metajam,
tidyverse,
here,
broom,
sf,
ggmap,
leaflet,
lubridate,
patchwork,
gstat,
stars
URL: https://github.com/lter/lterdatasampler
BugReports: https://github.com/lter/lterdatasampler/issues
VignetteBuilder: knitr
25 changes: 25 additions & 0 deletions R/cap_birds_doc.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#' Bird Community Observations (2000 - 2019), Central Arizona - Phoenix LTER
#'
#' Bird count data collected in different seasons using a standardized point-count protocol. In 2000, sites were visited twice. In 2001 each site was visited in each season by three independent observers. In 2005, sites were visited in three seasons, and from 2006 - 2019, only in spring and winter.
#'
#' @format A tibble with 172,175 rows and 14 variables
#' \describe{
#' \item{survey_id}{a number denoting the unique identity of the bird survey}
#' \item{site_code}{a character denoting the identity of the survey location}
#' \item{survey_date}{a date denoting the date of observation}
#' \item{time_start}{a time denoting the start time of the observation period}
#' \item{time_end}{a time denoting the end time of the observation period}
#' \item{common_name}{a character denoting the common name of the species observed}
#' \item{distance}{a character denoting the distance of the observed birds from the observer in meters}
#' \item{bird_count}{a number denoting the count of birds observed during the survey period}
#' \item{seen}{a boolean denoting whether the bird was seen by the observer}
#' \item{heard}{a boolean denoting whether the bird was heard by the observer}
#' \item{direction}{a character denoting the direction of the bird from the observation point}
#' \item{location_type}{a character denoting the physical or research context of the site}
#' \item{lat}{a number denoting the latitude of the survey site in degrees}
#' \item{long}{a number denoting the longitude of the survey site in degrees}
#' }
#' @source {Warren, P., S.B. Lerman, H. Bateman, M. Katti, and E. Shochat. 2022. Point-count bird censusing: long-term monitoring of bird abundance and diversity in central Arizona-Phoenix, ongoing since 2000 ver 19. Environmental Data Initiative.}
#' \url{https://doi.org/10.6073/pasta/4fca7c8a6cd56a6abed9834aca72e764}

"cap_birds"
79 changes: 79 additions & 0 deletions data-raw/cap_birds_data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#' ---
#' title: "Data Preparation"
#' ---
#' ### Download the raw data from EDI.org

#+ download_data, eval=FALSE
library(metajam)
library(tidyverse)

# Point-count bird censusing: long-term monitoring of bird abundance and diversity in central Arizona-Phoenix, ongoing since 2000
# Main URL: https://doi.org/10.6073/pasta/4fca7c8a6cd56a6abed9834aca72e764

# Location Data
locations_url <-
"https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-cap.46.19&entityid=86856afb2e6779f5acb261a2b04d1e13"


# Sighting data
cap_url <-
"https://portal.edirepository.org/nis/dataviewer?packageid=knb-lter-cap.46.19&entityid=832065765ce5a9a8238a0b25cb549722"

# Download the data packages with metajam
locations_download <-
download_d1_data(data_url = locations_url, path = tempdir())

cap_download <-
download_d1_data(data_url = cap_url, path = tempdir())

#' ### Data cleaning
#+ data sampling, eval=FALSE

# Read in location data
locations_files <-
read_d1_files(locations_download)
locations_raw <- locations_files$data

# Discard repeated site locations. Some sites were moved over the course of the study, but the changes in location were very small
locations <- locations_raw %>%
select(
-begin_date,
-begin_date_month,
-begin_date_year,
-end_date,
-end_date_month,
-end_date_year,
) %>%
mutate(
location_type = recode(
location_type,
"ESCA" = "Ecological Survey of Central Arizona",
"NDV" = "North Desert Village",
"riparian" = "Riparian",
"SRBP" = "Salt River Biodiversity Project",
"PASS" = "Phoenix Area Social Survey",
"desert_fertilization" = "Desert Fertilization"
)
) %>%
group_by(site_code) %>%
slice_tail() %>%
ungroup()

# Read in count data
cap_files <- read_d1_files(cap_download)
cap_birds_raw <- cap_files$data

# Select needed variables, spell out abbreviations
cap_birds <-
cap_birds_raw %>%
mutate(survey_date = as.Date(survey_date)) %>%
select(-observer, -code, -observation_notes, -qccomment) %>%
mutate(distance = recode(distance, "FT" = "Flying Through"))

# Combine location data with count data
cap_birds <-
cap_birds %>% full_join(locations, by = "site_code")

#+ save data, include=FALSE, EVAL=FALSE
## Save sample file
usethis::use_data(cap_birds, overwrite = TRUE)
Binary file added data/cap_birds.rda
Binary file not shown.
36 changes: 36 additions & 0 deletions man/cap_birds.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading