First, let's download these packages
# Install devtools if(!require(devtools)){install.packages('devtools')} # Install ghql and nabatr packages using devtools devtools::install_github("ropensci/ghql") devtools::install_github("talbertc-usgs/nabatr") library(nabatr)
Get a Graphical QL token for NABat Database
# Enter your NABat username here username_ = 'NABat_Username' token_ = get_nabat_gql_token(username = username_) # If you are not using R-Studio and are not prompted for a password use this code below # to manually add in your password with the password variable: # token_ = get_nabat_gql_token(username = username_, password = 'your-password')
Get Project dataframe which contains all of your acoustic stationary projects in the NABat Database
# Get your projects lookup table project_df_ = nabatr::get_projects(token = token_, username = username_) # Display your projects lookup table project_df_
Get all Acoustic Stationary Surveys within a single Project set with project_id_
# Fill in project id using the project_df_ lookup table project_id_ = 284 # Get survey dataframe survey_df_ = nabatr::get_project_surveys(username = username_, token = token_, project_id = project_id_) # Display survey dataframe survey_df_
Get all Acoustic Stationary Survey wav file data. Format: Acoustic Stationary Bulk Upload Template
# Get stationary acoustic bulk upload format dataframe acoustic_bulk_df_ = nabatr::get_acoustic_bulk_wavs(token = token_, username = username_, survey_df = survey_df_, project_id = project_id_) # Display stationary acoustic bulk upload format dataframe acoustic_bulk_df_
Use the Acoustic Stationary acoustic bulk dataframe to build a dataframe for auto and manual species id data
# Get Acoustic stationary acoustic bulk dataframe nightly_observed_list = nabatr::get_observed_nights(acoustic_bulk_df_) manual_nights_df_ = nightly_observed_list$auto_nightly_df auto_nights_df_ = nightly_observed_list$manual_nightly_df # Display the two dataframes manual_nights_df_ auto_nights_df_
Setup a leaflet map to show
grts_map = get_grts_leaflet_map(all_grts = unique(survey_df_$grts_cell_id), grts_with_data = unique(auto_nights_df_$GRTS)) # Display the grts map grts_map
build report
proj = 284 get_acoustic_stationary_report(token = token_, username = username_, output_dir = '/path/to/Downloads', file_name = paste0('report_',proj,'.html'), project_id = proj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.