Get all of your projects and the type of data they contain (colony_count, mobile_acoustic, and stationary_acoustic)

Get a token for NABat Database

library(nabatr)
# Enter your NABat username here
username = 'NABat_Username'
token = get_nabat_gql_token(username)
token

# Note: if you leave run token = get_nabat_gql_token(),
#   it will prompt you for a username and then a password

Get all project types

# Refresh Token
token = get_refresh_token(token)
# Get all project types dataframe
poject_types_df = get_all_project_types(token)
poject_types_df

Print out of all project types found in your projects

# Store projets for each variable (summer hibernaculum, winter maternity, roost/emergence count, 
## mobile acoustic, stationary acoustic)
colony_hib_projs = sort(unique(subset(poject_types_df, poject_types_df$survey_type_id == 9)$project_id))
colony_mat_projs = sort(unique(subset(poject_types_df, poject_types_df$survey_type_id == 10)$project_id))
roost_count_projs = sort(unique(subset(poject_types_df, poject_types_df$survey_type_id == 12)$project_id))
mobile_acoustic_projs = sort(unique(subset(poject_types_df, poject_types_df$survey_type_id == 8)$project_id))
stationary_acoustic_projs = sort(unique(subset(poject_types_df, poject_types_df$survey_type_id == 7)$project_id))

# Print out the results
print (paste0('Number of winter hibernaculum colony count projects: ', length(colony_hib_projs)))
print (colony_hib_projs)
print (paste0('Number of summmer maternity colony count projects: ', length(colony_mat_projs)))
print (colony_mat_projs)
print (paste0('Number of emergence count projects: ', length(roost_count_projs)))
print (roost_count_projs)
print (paste0('Number of mobile acoustic projects: ', length(mobile_acoustic_projs)))
print (mobile_acoustic_projs)
print (paste0('Number of stationary acoustic projects: ', length(stationary_acoustic_projs)))
print (stationary_acoustic_projs)


usgs/nabatr documentation built on Jan. 28, 2024, 7:10 a.m.