Giter VIP home page Giter VIP logo

bbsassistant's Introduction

bbsAssistant: An R package for Downloading and Handling Data and Information from the North American Breeding Bird Survey (BBS)

Last updated: 2022-03-11

DOI R build status License: CC0 Contributors R-CMD-check

About

This repository contains the development version of bbsAssistant. Please submit Issues here.

This package contains functions for downloading, importing, and munging the official releases of the North American Breeding Bird Survey (BBS) data (retrieved from USGS ScienceBase repository) with the help of package sbtools.

Quick Start

library(bbsAssistant)
# view functions and data in package bbsAssistant
# ls("package:bbsAssistant")

Download, Unpack, and Import the Most Recent Dataset

bbs <- grab_bbs_data()
## bbs_dir not specified. bbs dataset will be saved to  data-in/5ea04e9a82cefae35a129d65
# Optional: specify `sb_id` as the USGS ScienceBase identifier for a specific data release. If sb_id is not supplied, will default to the most recent data release.

The object resulting from bbsAssistant::import_bbs_data() is a list comprising the following elements:

names(bbs)
## [1] "observations" "routes"       "observers"    "weather"      "species_list"
## [6] "citation"     "vehicle_data" "data.dir"

Filtering by State/Region

Filter the dataset using your preferred method. A lookup table is provided as a package dataset for filtering by country or state using the BBS codes (see columns CountryNum, StateNum) or ISO alpha codes and names (see columns iso_3155_2, iso_a2, name_fr, name_es):

head(bbsAssistant::region_codes, 3)
##   CountryNum StateNum               State iso_3166_2 iso_a2
## 1        484        1      aguascalientes     MX-AGU     MX
## 2        484        2     baja california     MX-BCN     MX
## 3        484        3 baja california sur     MX-BCS     MX
##                   name_fr             name_es
## 1          Aguascalientes      Aguascalientes
## 2        Basse-Californie     Baja California
## 3 Basse-Californie du Sud Baja California Sur

Filter on species names

View the species lists for your particular dataset by calling:

head(bbs$species_list,3)
## # A tibble: 3 x 12
##   Seq     AOU English_Common_Name French_Common_N~ Spanish_Common_~ ORDER Family
##   <chr> <int> <chr>               <chr>            <chr>            <chr> <chr> 
## 1 6      1770 Black-bellied Whis~ "Dendrocygne \x~ Dendrocygna aut~ Anse~ Anati~
## 2 7      1780 Fulvous Whistling-~ "Dendrocygne fa~ Dendrocygna bic~ Anse~ Anati~
## 3 8      1760 Emperor Goose       "Oie empereur"   Anser canagicus  Anse~ Anati~
## # ... with 5 more variables: Genus <chr>, Species <chr>, Scientific_Name <chr>,
## #   AOU4 <chr>, AOU6 <chr>

or view the most recent species list (may be the same as yours..):

head(bbsAssistant::species_list,3)

Keep only Passer domesticus:

# grab the aou code for House Sparrow  using common name 
hosp.aou.code <- bbs$species_list$AOU[bbs$species_list$English_Common_Name=="House Sparrow"]
# or genus and species epithet
# hosp.aou.code <-
#   bbs$species_list$AOU[bbs$species_list$Genus == "Passer" &
#                          bbs$species_list$Species == "domesticus"]

# filter the observations along  BBS "AOU" code:
## note spelling but not capitalization matters. 
## can provide species arg as species' common or latin name(s) or as BBS "AOU" code(s)
hosp.df <- munge_bbs_data(bbs_list=bbs, species = hosp.aou.code)
## Creating a flat data frame as output object.
                          # species = c("House SPARROW", "passer Domesticus", hosp.aou.code)) 

BBS Data Availability (including sb_id)

There are currently two primary products released from the USGS that are derived from the annual BBS roadside surveys, the observations data and the analysis results. The datasets (observations, results) are permanently and publicly available at USGS ScienceBase.

The most recent annual releases of the observations and results datasets are stored as data objects in this package (see data(bbs)) will be downloaded as the default in this package, but the user has the option to specify historical dataset releases should they choose. Please see the function get_bbs_data().

A lookup table containing the available datasets (N = 7) and analysis results will be regularly updated, and comprises the following entries:

List of datasets currently available for download at USGS ScienceBase. Highlighted and bold row indicates the default BBS observations dataset stored internally in the package.
sb_title release_year data_type year_start year_end sb_link sb_item
2020 Release - North American Breeding Bird Survey Dataset (1966-2019) 2020 observations 1966 2019 sciencebase.gov/catalog/item/5ea04e9a82cefae35a129d65 5ea04e9a82cefae35a129d65
2019 Release - North American Breeding Bird Survey Dataset (1966-2018) 2019 observations 1966 2018 sciencebase.gov/catalog/item/5d65256ae4b09b198a26c1d7 5d65256ae4b09b198a26c1d7
2018 Release - North American Breeding Bird Survey Dataset (1966-2017) 2018 observations 1966 2017 sciencebase.gov/catalog/item/5af45ebce4b0da30c1b448ca 5af45ebce4b0da30c1b448ca
2017 Release - North American Breeding Bird Survey Dataset (1966-2016) 2017 observations 1966 2016 sciencebase.gov/catalog/item/5cf7d4d5e4b07f02a7046479 5cf7d4d5e4b07f02a7046479
2001-2016 Releases (legacy format) - North American Breeding Bird Survey Dataset 2016 observations 1966 2015 sciencebase.gov/catalog/item/5d00efafe4b0573a18f5e03a 5d00efafe4b0573a18f5e03a
The North American Breeding Bird Survey, Analysis Results 1966 - 2018 2020 usgs_results 1966 2018 sciencebase.gov/catalog/item/5ea1e02c82cefae35a16ebc4 5ea1e02c82cefae35a16ebc4
The North American Breeding Bird Survey, Analysis Results 1966 - 2017 2018 usgs_results 1966 2017 sciencebase.gov/catalog/item/5eab196d82cefae35a2254e0 5eab196d82cefae35a2254e0

Citations

For the BBS dataset and analysis results, call citation("bbsAssistant") or see library loading message.

For general use of the R package bbsAssistant and/or companion paper:
Burnett, J.L., Wszola, L., and Palomo-MuΓ±oz, G. (2019). bbsAssistant: An R package for downloading and handling data and information from the North American Breeding Bird Survey: U.S. Geological Survey software release, https://doi.org/10.5066/P93W0EAW. or Burnett, J.L., Wszola, L., and Palomo-MuΓ±oz, G. (2019). bbsAssistant: An R package for downloading and handling data and information from the North American Breeding Bird Survey. Journal of Open Source Software, 4(44), 1768, https://doi.org/10.21105/joss.01768

Contributing

Code of Conduct

Please note that the bbsAssistant project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms. For questions, comments, or issues, feel free to email the maintainer Jessica Burnett or submit an Issue (preferred).

bbsassistant's People

Contributors

bisaloo avatar ethanwhite avatar gabspalomo avatar jsta avatar kthyng avatar lsw5077 avatar mbjoseph avatar trashbirdecology avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bbsassistant's Issues

Focus top-level API / vignette on key user behavior

This is recommendation based on my experience while reviewing this package for JOSS (openjournals/joss-reviews#1768).

Is your feature request related to a problem? Please describe.

As a new user of the software I found the API as introduced in the vignette to be a bit complicated. The order of introduction is currently: 1) Create a data directory for storing data; 2) Download and load data into R (this data doesn't end up in the data directory); 3) Export the data into a local file (in a not widely used format; I love feather but it won't be familiar to many users); 4) Import the data (which requires doing some filename matching and manipulation). This felt like a lot of stuff if my goal is to quickly and easily work the the BBS data.

Describe the solution you'd like

My core use case for a package like this would be "Get BBS data into R and start working with it. Ideally without repeatedly downloading the data if I already have it". With that use case in mind I would consider making get_bbsData handle all of this for the user, with some optional arguments to control behavior. So, the default behavior for get_bbsData would be to:

  1. Check if the requested data exists locally
  2. If it doesn't then download the data and store it locally in a permanent (not temporary) location.
  3. Load the data into R.

I'd have an argument to allow setting the data directory (where files are checked for and downloaded to) and set a default for this directory to either the working directory (in a clearly named subdirectory) or a .bbsAssistant directory in the users home directory.

Describe alternatives you've considered

Given that most of the intended usage appears to focus on single BBS files, which are relatively small, another option would be to de-emphasize the feather storing and loading functionality in the introductory vignette.

Prepare for CRAN submission

Prepare for release:

  • Check that description is informative
    • Add relevant copyrights to libraries used (e.g. dplyr, magrittr, etc [see imports and depends in DESCRIPTION.md]) (this was a task added by JLB)
    • Add relevant copyrights to the licensing (this was a task added by JLB)
  • [x ] Check licensing of included files
    • make sure we incorporate the necessary copy rights or licenses from rBBS (CC0)
    • make sure we incorporate the necessary copy rights or licenses for the N.Amer BBS (CC0)
  • usethis::use_cran_comments()
  • devtools::check()
    • address all issues appearing in the checks (e.g. failures; no visible bindings; malformed descri. fields) (@GabsPalomo)
  • devtools::check_win_devel()
  • [] create package website (added by JLB ) see here for details
  • Polish pkgdown reference index
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('major')
  • Update cran-comments.md
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted πŸŽ‰
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • Update install instructions in README
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Basic maps (visualizations) of raw data and/or results

**Users have requested that basic visualization functions be provided. **

This issue was submitted as a task for the 2019 Google Code In

We seek help for creating basic visualization functions for depicting general summary statistics for individual species onto spatial maps (e.g. heat maps similar to this example). For example, a spatial map comprising absolute occurrences (e.g., species A is present or not present at a location-binary) or relative abundances (e.g., a relative heatmap of Species A 'abundance).

Further, we wish to provide the opportunity for the user map basic statistics at multiple spatial scales. For example, mapping at the U.S. state level, at the U.S. county level, or at regional levels (e.g., Bird Conservation Regions).

We are open to suggestions of which spatial projections to use, and which source maps for U.S. and Canadian state and county-level maps (e.g., using Ggmap vs. a spatial data package within the bbsAssistant package).

Example of a heat map

Simplify the README

I moved the previous README materials into vignettes/vignette.rmd.

I think we should simplify the README such that show only a few images, screenshots, or code chunk echoes which demonstrate the main functionality: retrieving and munging BBS data and analysis results.

Confusing API for `subset_speciesList`

This is recommendation based on my experience while reviewing this package for JOSS (openjournals/joss-reviews#1768).

Is your feature request related to a problem? Please describe.

I was confused by the API for subset_speciesList. My reading of the vignette was that passing aou.ind would subset the data to only the provided AOU. This matched my intuition for how a function named subset_speciesList would work. However, as documented in the function documentation the behavior is actually the opposite, with the list of species provided being removed and all other species kept.

Describe the solution you'd like

I would consider either renaming this function to something like remove_species or changing the argument names to something like drop_species. This would make the i

Describe alternatives you've considered

Clarifying the vignette to make the behavior clearer would be another option, but I think intuitive naming would go a long way to preventing user confusion.

Identify overlap with & acknowledge rBBS + bbsBayes

  • Identify overlaps with existing R package oharar/rBBS.
  • Acknowledge rBBS functions .
  • Point out existence but lack of maintenance of rBBS in our documentation.
  • Identify and acknowledge overlap with existing R package BBS.occurrences
  • Identify and acknowledge overlap with existing R package bbsBayes

Create functions!

  • get credibility information (stuck on this because credibility is .png, associated only with html code and not text.
  • incorporate getRouteInfo from trashbirdecology/bbsRDM
  • incorporate getDataBBS from trashbirdecology/bbsRDM
  • incorporate subsetByAOU from trashbirdecology/bbsRDM
  • incorporate getSppListBBS from trashbirdecology/bbsRDM
  • incorporate GetRegions from trashbirdecology/bbsRDM
  • incorporate GetSpNames from trashbirdecology/bbsRDM
  • get species trend estimates from web scraping --> a data frame...
  • incorporate getFuncMasss from trashbirdecology/bbsRDM

JOSS submission

Writeup for JOSS submission

  • 300-1000 word summary of the package
  • vignettes/runthrough.rmd complete

Fix `citation()` .bib entry

citation("bbsAssistant") yields the following error:

Error in .bibentry_check_bibentry1(rval) :
A bibentry of bibtype β€˜Article’ has to specify the fields: author, title, journal, year

Need to fix the relevant .bib

README.txt no longer available - implications for get_regions()

See the 'whatsnew.txt' for the 2019 data update here.

Our function, get_regions() relies on the README.txt which lists the region .zip filenames.

Region filenames will now be located at file

So, TO DO =

  • Scrape the nabbs metadata file for REGION names
    OR
  • Save an updated version of the filenames (.zip) to a data file in our package...
    OR
  • Scrape .zip names from PDF file Section B

GRRRRR

AOU numbers

We need to make sure the get_bbsAous match the AOUs in the actual bbs data.

Further, I propose we trim the LEADING whitespace from get_bbsAous() returned object, and ensure no leading zeroes on the AOU column from the get_bbsData() objects.

get_regions() raises an error

Hey @trashbirdecology! Awesome package. Maybe this is a bug? πŸ€·β€β™‚οΈ

Describe the bug

The get_regions() function raises an error that seems to be caused by attempting to read a README.txt file from the FTP server that no longer exists.

To Reproduce

library(bbsAssistant)
regions <- get_regions()
#> Parsed with column specification:
#> cols(
#>   X1 = col_character(),
#>   X2 = col_character()
#> )
#> Parsed with column specification:
#> cols(
#>   X1 = col_character(),
#>   X2 = col_character(),
#>   X3 = col_character()
#> )
#> Warning in dir.create(codesDir): '/tmp/RtmpHiEJfU/reprex156458487ca2/
#> bbsData/codes' already exists
#> Warning in download.file(url = File, destfile = paste0(codesDir, "/
#> README.txt")): cannot open URL 'ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/
#> DataFiles/README.txt': FTP status was '550 Requested action not taken; file
#> unavailable'
#> Error in download.file(url = File, destfile = paste0(codesDir, "/README.txt")): cannot open URL 'ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/README.txt'

Created on 2019-08-14 by the reprex package (v0.3.0)

Expected behavior

I was expecting to get the region data, like in the README.

Session info

R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 18.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bbsAssistant_1.0.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.2      rstudioapi_0.10 whisker_0.3-2   knitr_1.24      magrittr_1.5    hms_0.5.0       here_0.1        R6_2.4.0        rlang_0.4.0    
[10] tools_3.6.1     packrat_0.5.0   xfun_0.8        withr_2.1.2     clipr_0.7.0     htmltools_0.3.6 rprojroot_1.3-2 digest_0.6.20   tibble_2.1.3   
[19] crayon_1.3.4    processx_3.4.1  callr_3.3.1     readr_1.3.1     ps_1.3.0        vctrs_0.2.0     fs_1.3.1        curl_4.0        zeallot_0.1.0  
[28] evaluate_0.14   rmarkdown_1.14  reprex_0.3.0    compiler_3.6.1  pillar_1.4.2    backports_1.1.4 pkgconfig_2.0.2

Additional context

The error seems to stem from this file not existing: ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/README.txt

Maybe it was removed in the most recent BBS data update?

Allow downloading data by state using state name

This is recommendation based on my experience while reviewing this package for JOSS (openjournals/joss-reviews#1768).

Is your feature request related to a problem? Please describe.

Downloading data for one or more specific states as described in the vignette takes a number of steps:

  1. Load the regions table
  2. Drop null values from it
  3. Run a combination of which and stringr::str_detect to find the base filename
  4. Run get_bbsData

Since this is a core functionality for the package it would be nice to hide this complexity from the user.

Describe the solution you'd like

Move the first three steps inside of get_bbsData and have the get_bbsData argument be region so that a call to get the data for Florida looks like: get_bbsData(region = 'Florida').

JOSS Review Issues

I figured I would start an issue thread here for the JOSS Review openjournals/joss-reviews#1768

My first set of comments (1) are more or less "must-haves" to meet the JOSS requirements while the second set (2) are "nice-to-have" suggestions.

1_JOSS

  • paper.md should probably have an explicit citation for the rBBS package.

  • The testthat tests in test-get_regions.R fails for me with error:

Error in get_regions() : could not find function "get_regions"

2_Nice-to-haves

User friendliness

The stated goal of the package is to make working with bbs data more user friendly by consolidating "the efforts of the data user by automating downloading and decompression of .zip data files, downloading route-level information, and saving them as .feather files for speedy import from disk."

As a new user, there were some areas that I thought could be even more user friendly:

  • The biggest was the manual download > export > import process. Current operation is download to temporary file then manually export to "permanent" disk then later import this data. What if this was revised so that a user could optionally pass a permenent location to get_bbsData, this location would checked for an existing file (to avoid re-downloading existing files) and automatically exported?

  • I wish the docs included some maps. For instance, as a new user I didn't know the difference between Region=="S05" and Region.Code=="FLA"

  • I felt like some of the calls to the stringr package in the vignette were not needed. Maybe people who don't know stringr would have an easier time if these were replaced with base R code? Maybe the region_code object could be cleaned up so that someone could run region_codes[region_codes$State == "Florida", "zip_states"]?

  • The vignette/package uses the feather package AND variables called feather. This could be confusing.

  • Maybe the vignette could use a more descriptive title rather than "vignettes"?

Misc

  • I had trouble understanding the subset_speciesList function. Why does it remove the specified family rather than include it like dplyr::filter? What does this function offer
    beyond dplyr::filter?

  • Why are the first and second figures in the vignette different? Seems like they are both plotting AOU.Number=='s06882' and Region.Code=="S05" by year.

pkgdown

  • Seems like the pkgdown site is out of date. The current landing page doesn't match the README.

  • Vignette images on the pkgdown site are broken for me...

  • The vignette chunk Subsetting the BBS count data by AOU number prints A LOT of output. Maybe it would be good to pass the output through glimpse like the other chunk outputs?

Help file for get_bbsData is out of date

Describe the bug
The example in the help file for get_bbsData uses an out of date function name (getDataBBS): https://github.com/TrashBirdEcology/bbsAssistant/blob/master/R/get_bbsData.R#L25

To Reproduce

See ?bbsAssistant::get_bbsData

Expected behavior

The function name in the example is getDataBBS, but I expected it to be get_bbsData.

Session info


─ Session info ──────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Ubuntu 18.04.3 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US                       
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Denver              
 date     2019-08-27                  

─ Packages ──────────────────────────────────────────
 package      * version date       lib source        
 assertthat     0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
 bbsAssistant * 1.0.0   2019-08-27 [1] local         
 cli            1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
 crayon         1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
 magrittr       1.5     2014-11-22 [1] CRAN (R 3.6.0)
 packrat        0.5.0   2018-11-14 [1] CRAN (R 3.6.0)
 rstudioapi     0.10    2019-03-19 [1] CRAN (R 3.6.0)
 sessioninfo    1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
 withr          2.1.2   2018-03-15 [1] CRAN (R 3.6.0)

[1] /home/max/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

Additional context

PR on the way!

Add stratum specific parameters

Add functionality for BBS strata-level downloading, munging, etc.

To functions:
-[ ] quick_get_data()
-[ ] download_bbs()

Summary

Not sure if this should be an issue, but I was wondering what type of information you want to include in the summary.

I understand that the package is basically downloading the data that already exists in this website to make it more user friendly and more importantly R-friendly. However, would you like to include the following in this summary?

  1. Brief overview of the breeding birds survey methods? (cited obviously)
  2. Information on the BBS website/data?
  3. Why we are doing this package? User friendly, R-interface, etc.??

These are the only things I can think of at the moment to include in the summary. If you agree with them I can write them up for your review.

overwrite.bbs=TRUE doesn't appear to download the bbs data again

Describe the bug
It appears that using overwrite.bbs = TRUE does not allow `download_bbs() to download the data

suppressMessages(download_bbs(country.names="USA", data.dir = bbsDir, overwrite.bbs = TRUE, overwrite.routes = TRUE))
[1] "Data already exists. No data downloaded. To force installation, specify overwrite.bbs=TRUE, or delete local files."
[1] "Data already exists. No data downloaded. To force installation, specify overwrite.bbs=TRUE, or delete local files."

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] bbsAssistant_1.0.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 pillar_1.4.2 compiler_3.6.1 prettyunits_1.0.2 remotes_2.1.0 tools_3.6.1 testthat_2.3.0 digest_0.6.23 pkgbuild_1.0.6
[10] pkgload_1.0.2 tibble_2.1.3 memoise_1.1.0 evaluate_0.14 pkgconfig_2.0.3 rlang_0.4.2 cli_1.1.0 rstudioapi_0.10 curl_4.2
[19] yaml_2.2.0 xfun_0.11 withr_2.1.2 dplyr_0.8.3 knitr_1.26 desc_1.2.0 fs_1.3.1 devtools_2.2.1 tidyselect_0.2.5
[28] rprojroot_1.3-2 glue_1.3.1 here_0.1 R6_2.4.1 processx_3.4.1 rmarkdown_1.16 sessioninfo_1.1.1 purrr_0.3.3 callr_3.3.2
[37] magrittr_1.5 backports_1.1.5 ps_1.3.0 ellipsis_0.3.0 htmltools_0.4.0 usethis_1.5.1 assertthat_0.2.1 crayon_1.3.4

Render vignette while specifying bibliography

For some reason, when we specify bibliography: bib.bib in the html_vignette YAML, the vignette fails to render. Not sure how to ameliorate this.

have tried the following in the yaml:

.bib fn in quotes ("bib.bib"):

bibliography: "bib.bib"

and specifying as:

bibliography:
  - bib.bib

** this was identified while resolving #81**

Specifying yaml as bibliography: "bib.bib" yields error:

Could not find bibliography file: bib.bib
Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc:
Filter returned error status 1

Specifying yaml as bibliography: bib.bib yields error

Could not find bibliography file: bib.bib
Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc:
Filter returned error status 1
Error: pandoc document conversion failed with error 83

Specifying yaml as

bibliography:
  - bib.bib

yields error:

Could not find bibliography file: bib.bib
Error running filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc:
Filter returned error status 1
Error: pandoc document conversion failed with error 83

A couple of typos in the README

Describe the bug

There are a couple of minor typos on the README that will raise errors if users follow the instructions as written.

To Reproduce

The instructions under the "Function Descriptions and Vignettes" will lead to two errors:

  1. devtools::build_manual("bbsAssistant) will raise an error, because there is no closing quote before the last parenthesis. This can be simplified to devtools::build_manual(), which by default will use the current package directory.

  2. usethis::build_vignettes() will raise an error because build_vignettes() is not exported by the usethis package. Instead users can devtools::build_vignettes().

Expected behavior

Building the manual and vignettes.

Session info

─ Session info ──────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Ubuntu 18.04.3 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US                       
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Denver              
 date     2019-08-27                  

─ Packages ──────────────────────────────────────────
 package      * version date       lib source        
 assertthat     0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
 backports      1.1.4   2019-04-10 [1] CRAN (R 3.6.0)
 bbsAssistant * 1.0.0   2019-08-27 [1] local         
 callr          3.3.1   2019-07-18 [1] CRAN (R 3.6.1)
 cli            1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
 crayon         1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
 desc           1.2.0   2018-05-01 [1] CRAN (R 3.6.0)
 devtools       2.1.0   2019-07-06 [1] CRAN (R 3.6.1)
 digest         0.6.20  2019-07-04 [1] CRAN (R 3.6.1)
 evaluate       0.14    2019-05-28 [1] CRAN (R 3.6.0)
 fs             1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
 glue           1.3.1   2019-03-12 [1] CRAN (R 3.6.0)
 htmltools      0.3.6   2017-04-28 [1] CRAN (R 3.6.0)
 knitr          1.24    2019-08-08 [1] CRAN (R 3.6.1)
 magrittr       1.5     2014-11-22 [1] CRAN (R 3.6.0)
 memoise        1.1.0   2017-04-21 [1] CRAN (R 3.6.0)
 packrat        0.5.0   2018-11-14 [1] CRAN (R 3.6.0)
 pkgbuild       1.0.4   2019-08-05 [1] CRAN (R 3.6.1)
 pkgload        1.0.2   2018-10-29 [1] CRAN (R 3.6.0)
 prettyunits    1.0.2   2015-07-13 [1] CRAN (R 3.6.0)
 processx       3.4.1   2019-07-18 [1] CRAN (R 3.6.1)
 ps             1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
 R6             2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
 Rcpp           1.0.2   2019-07-25 [1] CRAN (R 3.6.1)
 remotes        2.1.0   2019-06-24 [1] CRAN (R 3.6.1)
 rlang          0.4.0   2019-06-25 [1] CRAN (R 3.6.1)
 rmarkdown      1.14    2019-07-12 [1] CRAN (R 3.6.1)
 rprojroot      1.3-2   2018-01-03 [1] CRAN (R 3.6.0)
 rsconnect      0.8.15  2019-07-22 [1] CRAN (R 3.6.1)
 rstudioapi     0.10    2019-03-19 [1] CRAN (R 3.6.0)
 sessioninfo    1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
 testthat       2.2.1   2019-07-25 [1] CRAN (R 3.6.1)
 usethis        1.5.1   2019-07-04 [1] CRAN (R 3.6.1)
 withr          2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
 xfun           0.9     2019-08-21 [1] CRAN (R 3.6.1)
 yaml           2.2.0   2018-07-25 [1] CRAN (R 3.6.0)

[1] /home/max/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

Additional context

I've got a PR in the works to provide a quick fix.

install fails when build_vignettes is used

devtools::install_github("trashbirdecology/bbsAssistant", force=TRUE, build_vignettes = TRUE)

devtools::install_github("trashbirdecology/bbsAssistant", force=TRUE, build_vignettes = TRUE)
Downloading GitHub repo trashbirdecology/bbsAssistant@master
βœ” checking for file β€˜/private/var/folders/f9/_41zf4tn4dz6bzvqyrhpp1fjs58h7x/T/Rtmp1bBXTq/remotes6f332c1174dc/TrashBirdEcology-bbsAssistant-e3ed4d7/DESCRIPTION’ ...
─ preparing β€˜bbsAssistant’:
βœ” checking DESCRIPTION meta-information ...
─ installing the package to build vignettes
E creating vignettes (10s)
--- re-building β€˜quick-overview.Rmd’ using rmarkdown
Skipping install of 'bbsAssistant' from a github remote, the SHA1 (e3ed4d7) has not changed since last install.
Use force = TRUE to force installation
TERMS OF USE: North American Breeding Bird Survey Data:

Users of these BBS data are obligated to formally recognize their use of the program's
data in publications, presentations and other outlets. Additionally, all work using these data
should acknowledge the thousands of U.S. and Canadian participants who annually perform
and coordinate the survey. It is in the best interest for the continued success of
the BBS that authors submit a reprint or pdf of their work featuring BBS data
to the National BBS staff for inclusion in the program's bibliography.
If a publication is based solely on the analysis of BBS data, we recommend
that you involve National BBS staff with the writing and/or review of the manuscript.

DATA LIABILITY DISCLAIMER: North American Breeding Bird Survey DataThis database, identified as the North American Breeding Bird Survey Dataset,has been approved for release and publication by the U.S. Geological Survey (USGS)and the Canadian Wildlife Service of Environment Canada (EC). Although this databasehas been subjected to rigorous review and is substantially complete, the USGS and ECreserve the right to revise the data pursuant to further analysis and review.Furthermore, it is released on the condition that the USGS, the U.S. Government,the EC, and the Canadian Government may not be held liable for any damages resulting from its authorized or unauthorized use.
Warning in dir.create(bbsDir) :
'/private/var/folders/f9/_41zf4tn4dz6bzvqyrhpp1fjs58h7x/T/RtmpEHusTt/Rbuild6f6e28359967/bbsAssistant/raw-data' already exists
Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

   filter, lag

The following objects are masked from 'package:base':

   intersect, setdiff, setequal, union

Quitting from lines 49-54 (quick-overview.Rmd)
Error: processing vignette 'quick-overview.Rmd' failed with diagnostics:
No files to import. If state.names is specified, please ensure files exist in data.dir.
--- failed re-building β€˜quick-overview.Rmd’

SUMMARY: processing the following file failed:
β€˜quick-overview.Rmd’

Error: Vignette re-building failed.
Execution halted
Error: Failed to install 'bbsAssistant' from GitHub:
System command error, exit status: 1, stdout + stderr (last 10 lines):
E> Quitting from lines 49-54 (quick-overview.Rmd)
E> Error: processing vignette 'quick-overview.Rmd' failed with diagnostics:
E> No files to import. If state.names is specified, please ensure files exist in data.dir.
E> --- failed re-building β€˜quick-overview.Rmd’
E>
E> SUMMARY: processing the following file failed:
E> β€˜quick-overview.Rmd’
E>
E> Error: Vignette re-building failed.
E> Execution halted

README.rmd

Create README.md from README.rmd after getting bulk of functions imported and cleaned.

Add a quick runthrough of primary features to the readme.rmd

Error

I get this warning when running this code. I understand that the file got saved but I was wondering if we could rewrite the warning to something that won't scare or alarm the users. I post the original warning and my suggestion below. In my experience, R users don't always understand errors so I'm always keen on providing more info on the errors as possible so that people may be less freaked out about them. It may be a silly suggestion though. Just a thought.

Original warning (as it is now)

export_bbsFeathers(dataIn = flBBS, newDir = bbsDir, filename = regionFileName.use)
Warning message:
In dir.create(newDir) :
'G:\bbsAssistant package\BBS_test_GP\bbsData' already exists

My suggested warning
Warning message:
In dir.create(newDir) :
'G:\bbsAssistant package\BBS_test_GP\bbsData' already exists. Make sure the new file was saved in this directory: e.g., "Florida.feather"

get_species fails

spp.lists <- get_species(data.dir=bbsDir)

Error:
trying URL 'https://www.birdpop.org/docs/misc/IBPAOU.zip'
Content type 'application/zip' length 46428 bytes (45 KB)

downloaded 45 KB

Warning in file.rename(from = aou.unzip.path, to = paste0(data.dir, "aou_alpha.txt")) :
cannot rename file '/Users/cchizinski2/Documents/git/bbsAssistant/raw-data/list19p.csv' to '/Users/cchizinski2/Documents/git/bbsAssistant/raw-data/aou_alpha.txt', reason 'No such file or directory'
Warning in file(file, "rt") :
cannot open file '/Users/cchizinski2/Documents/git/bbsAssistant/raw-data/aou_alpha.txt': No such file or directory
Error in file(file, "rt") : cannot open the connection

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] dplyr_0.8.3 bbsAssistant_1.0.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 pillar_1.4.2 compiler_3.6.1 prettyunits_1.0.2 remotes_2.1.0 tools_3.6.1 testthat_2.3.0 digest_0.6.23 pkgbuild_1.0.6
[10] pkgload_1.0.2 tibble_2.1.3 memoise_1.1.0 evaluate_0.14 pkgconfig_2.0.3 rlang_0.4.2 cli_1.1.0 rstudioapi_0.10 curl_4.2
[19] yaml_2.2.0 xfun_0.11 withr_2.1.2 knitr_1.26 desc_1.2.0 fs_1.3.1 devtools_2.2.1 tidyselect_0.2.5 rprojroot_1.3-2
[28] glue_1.3.1 here_0.1 R6_2.4.1 processx_3.4.1 rmarkdown_1.16 sessioninfo_1.1.1 purrr_0.3.3 callr_3.3.2 magrittr_1.5
[37] backports_1.1.5 ps_1.3.0 ellipsis_0.3.0 htmltools_0.4.0 usethis_1.5.1 assertthat_0.2.1 crayon_1.3.4

`here::here()` - is this an issue for installed packages?

Consider removing all here dependencies throughout the package. I am not sure how here acts when user installs package and does not work from an .rproj wtihin the package contents.

I.e. it may be best (and more efficient) to remove all calls to here and instead write the relative directories.

Wisconsin's zip file in data/region_codes.rds does not match name on FTP server

Describe the bug

The name of the zip file for Wisconsin's data appears to differ between the FTP server (Wiscons.zip at ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/States), and the data/region_codes.rds file (Wisons.zip), causing the get_bbsData() function to fail when trying to access data for Wisconsin.

To Reproduce

library(bbsAssistant)
data("region_codes")

region_filename <- region_codes$zip_states[region_codes$State == "WISCONSIN"]
print(region_filename)
#> [1] "Wisons.zip"

bbs_data <- get_bbsData(file = region_filename)
#> Warning in download.file(ZipName, temp, quiet = FALSE): cannot open URL
#> 'ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/States/Wisons.zip':
#> FTP status was '550 Requested action not taken; file unavailable'
#> Error in download.file(ZipName, temp, quiet = FALSE): cannot open URL 'ftp://ftpext.usgs.gov/pub/er/md/laurel/BBS/DataFiles/States/Wisons.zip'

Created on 2019-08-16 by the reprex package (v0.3.0)

Expected behavior

Expected the BBS data for Wisconsin to be downloaded.

Session info

─ Session info ─────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.6.1 (2019-07-05)
 os       Ubuntu 18.04.3 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US                       
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Denver              
 date     2019-08-16                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────
 package     * version date       lib source        
 assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.0)
 callr         3.3.1   2019-07-18 [1] CRAN (R 3.6.1)
 cli           1.1.0   2019-03-19 [1] CRAN (R 3.6.0)
 clipr         0.7.0   2019-07-23 [1] CRAN (R 3.6.1)
 crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.0)
 digest        0.6.20  2019-07-04 [1] CRAN (R 3.6.1)
 evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.0)
 fs            1.3.1   2019-05-06 [1] CRAN (R 3.6.0)
 htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.6.0)
 knitr         1.24    2019-08-08 [1] CRAN (R 3.6.1)
 packrat       0.5.0   2018-11-14 [1] CRAN (R 3.6.0)
 processx      3.4.1   2019-07-18 [1] CRAN (R 3.6.1)
 ps            1.3.0   2018-12-21 [1] CRAN (R 3.6.0)
 R6            2.4.0   2019-02-14 [1] CRAN (R 3.6.0)
 Rcpp          1.0.2   2019-07-25 [1] CRAN (R 3.6.1)
 reprex        0.3.0   2019-05-16 [1] CRAN (R 3.6.0)
 rlang         0.4.0   2019-06-25 [1] CRAN (R 3.6.1)
 rmarkdown     1.14    2019-07-12 [1] CRAN (R 3.6.1)
 rstudioapi    0.10    2019-03-19 [1] CRAN (R 3.6.0)
 sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.0)
 whisker       0.3-2   2013-04-28 [1] CRAN (R 3.6.0)
 withr         2.1.2   2018-03-15 [1] CRAN (R 3.6.0)
 xfun          0.8     2019-06-25 [1] CRAN (R 3.6.1)

[1] /home/max/R/x86_64-pc-linux-gnu-library/3.6
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

Additional context

I checked all other regions that have data and this seems to be the only one where the filenames don't match. Maybe also related to the recent BBS data update?

Add data

Saving example data using usethis::use_data() will allow us to avoid users having to download files from the internet AND avoid directory creation. This also allows us to run tests in CI.

Ex:

x<-1
y<-2
usethis::use_data(x, y)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.