-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMake_Catch_Figures.Rmd
49 lines (36 loc) · 1.49 KB
/
Make_Catch_Figures.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "Catch Figures"
output:
word_document:
reference_docx: output_template.docx
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.width=12, fig.height=8, out.width = 600, out.height = 400)
library(funplots)
library(keyring)
library(odbc)
#keyring::key_set_with_value(service="afsc", username="", password = "")
#keyring::key_set_with_value(service = "akfin", username = "", password = "")
```
```{r readfiles, include = FALSE, message = FALSE, warning = FALSE}
year =2022
species = 'RSOL'
area = 'BSAI'
afsc_species = 10261
norpac_species = 120
afsc_user = keyring::key_list("afsc")$username
afsc_pwd = keyring::key_get("afsc",keyring::key_list("afsc")$username)
akfin_user = keyring::key_list("akfin")$username
akfin_pwd = keyring::key_get("akfin",keyring::key_list("akfin")$username)
# establish akfin connection
akfin = DBI::dbConnect(odbc::odbc(), "akfin",
UID = akfin_user, PWD = akfin_pwd)
c.df<-afscdata::q_catch(year=year, species=species, area=area, db = akfin,save = FALSE) %>% dplyr::rename_with(stringr::str_to_title)
```
```{r plot total catch, echo = FALSE, message = FALSE, warning = FALSE, fig.cap = "Figure 1. Time series of total catch (mt) by gear. TRW is Trawl, OTH is Other, HAL is Hook and Line, and GLN is Gillnet."}
p<-plot_total_catch(thedata = c.df,year = year,species=species,area=area)
p
```
```{r close_database, include = FALSE, message = FALSE, warning = FALSE}
DBI::dbDisconnect(akfin)
```