q_bts_agecomp.Rd
currently only available for goa and ai total age comps (not strata)
q_bts_agecomp(year, species, area, db, print_sql = FALSE, save = TRUE)
max year to retrieve data from
5 digit afsc species code(s) e.g., 79210 or c(79210, 90210)
options are 'ai' or 'goa' - can only call a single area
the database to query (afsc)
outputs the sql query instead of calling the data (default: false)
save the file in designated folder, if FALSE outputs to global environment
saves bts agecomp data as data/raw/area_bts_age_data.csv and area_bts_age_specimen_data.csv or outputs to the global environment, also saves a copy of the SQL code used for the query and stores it in the data/sql folder.
for the goa and ai there is a "type" switch that queries by stratum, or total - !!stratum should not be used at the moment !!. only one of these can be used at a time.
if (FALSE) {
db <- afscdata::connect("afsc")
q_bts_agecomp(year=2022, species=21921, area = "goa", db = db)
}