diff --git a/.quarto/xref/14aca4aa b/.quarto/xref/14aca4aa index 953f991..6d79b57 100644 --- a/.quarto/xref/14aca4aa +++ b/.quarto/xref/14aca4aa @@ -1 +1 @@ -{"entries":[],"options":{"chapters":true},"headings":["our-objective","user-resources","background-of-the-gap_products-repo","major-advantages"]} \ No newline at end of file +{"headings":["our-objective","user-resources","background-of-the-gap_products-repo","major-advantages"],"entries":[],"options":{"chapters":true}} \ No newline at end of file diff --git a/GAP-Production-Data-Documentation.tex b/GAP-Production-Data-Documentation.tex index 84314a2..e910175 100644 --- a/GAP-Production-Data-Documentation.tex +++ b/GAP-Production-Data-Documentation.tex @@ -519,7 +519,7 @@ \setcounter{page}{1} \end{frontmatter} -%%%%% end titlepage extension code\ifdefined\Shaded\renewenvironment{Shaded}{\begin{tcolorbox}[boxrule=0pt, frame hidden, sharp corners, interior hidden, borderline west={3pt}{0pt}{shadecolor}, breakable, enhanced]}{\end{tcolorbox}}\fi +%%%%% end titlepage extension code\ifdefined\Shaded\renewenvironment{Shaded}{\begin{tcolorbox}[boxrule=0pt, interior hidden, frame hidden, sharp corners, borderline west={3pt}{0pt}{shadecolor}, enhanced, breakable]}{\end{tcolorbox}}\fi \renewcommand*\contentsname{Table of contents} { @@ -1114,96 +1114,38 @@ \section{Data levels}\label{data-levels}} \hypertarget{news}{% \chapter{News}\label{news}} -\hypertarget{future-plans}{% -\section{Future plans}\label{future-plans}} - -\hypertarget{goa-2025-restratification-mock-data-for-testing}{% -\subsection{GOA 2025 Restratification -- Mock Data for -Testing}\label{goa-2025-restratification-mock-data-for-testing}} - -The plan will be, once all are satisfied with the new GAP\_PRODUCTS -schema and tables, to sunset the historic product tables in 2024 and -proceed with only GAP\_PRODUCTS for the 2024 post-survey stock -assessment season. - -\begin{itemize} -\item - December 2023 - March 2024: Meeting between GAP and stock assessment - groups in early December 2023 to update progress on the GAP\_PRODUCTS - testing phase. \textbf{Deadline for Comments and Feedback on - GAP\_PRODUCTS data structures is March 8, 2024.} -\item - September 2024: GAP will only release data products according to the - new standard. Current, historical data product tables will be archived - in a new schema called "\textbf{GAP\_ARCHIVE}". -\end{itemize} - -\hypertarget{previous-updates}{% -\section{Previous updates}\label{previous-updates}} - -\begin{itemize} -\item - September 2023: Provisional data product tables -- CPUE, BIOMASS, - SIZECOMP, and AGECOMP -- as well as provisional support tables -- - AREA, STRATUM\_GROUPS, METADATA\_COLUMN, SPECIES\_YEAR, SURVEY\_DESIGN - -- are available in the GAP\_PRODUCTS Oracle schema with updated 2023 - GOA and EBS survey data. - - \begin{itemize} - \item - Additionally, the inclusion of mock data for the under the new 2025 - GOA stratified random survey (labeled in the GAP\_PRODUCTS tables as - YEAR 2025) will provide stock authors with the opportunity to - interact with data from the new survey design to be implemented in - 2025. - \item - Provisional AKFIN and FOSS tables are also available in the - GAP\_PRODUCTS Oracle schema. These include: AKFIN\_AGECOMP, - AKFIN\_AREA, AKFIN\_BIOMASS, AKFIN\_CATCH, AKFIN\_CPUE, - AKFIN\_CRUISE, AKFIN\_HAUL, AKFIN\_LENGTH, AKFIN\_METADATA\_COLUMN, - AKFIN\_SIZECOMP, AKFIN\_SPECIMEN, AKFIN\_SURVEY\_DESIGN, - AKFIN\_STRATUM\_GROUPS, FOSS\_CATCH, FOSS\_CPUE\_PRESONLY, - FOSS\_HAUL, and FOSS\_TAXON\_GROUP. - \end{itemize} -\item - May 2023: Release of new, draft, standard data product tables, - including restratified GOA data. Stock assessment authors will have - the opportunity to explore differences between datasets, test - workflows, and provide comments and issues during summer 2023. -\item - February 2023: Decision was made to include the mock restratified GOA - data with the development of the new consolidated standard data - products. -\item - December 2022: - \href{https://docs.google.com/document/d/1AURrvC1na6TL1Um3p7018svBLDOnih_7nxxyRU34M0k/edit}{GAP - and SSMA discuss} integration of the restratification of the GOA - survey design into standard data products. - - \begin{itemize} - \item - Stock assessors requested a "dry run" test to work with new mock - restratified GOA survey data before implementation of the new survey - design. - \item - This prompted the postponement of the restratified GOA design to - 2025. - \end{itemize} -\item - October 2022: The data processes and index computation working group - convened to address the development of standard survey data products - (e.g., biomass/abundance, size composition, age composition, CPUE). - - \begin{itemize} - \item - Index Computation Working Group: consolidation of index computation - methods between the Bering Sea and AI-GOA regions. - \item - Data Processes Working Group: consolidation, clean up, and - reorganization of survey oracle schemata, tables, and other data for - all surveys. - \end{itemize} -\end{itemize} +\hypertarget{newschange-logs}{% +\section{News/change logs}\label{newschange-logs}} + +-- +\href{C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-06-01_v2-1-0.txt}{Run +2023-06-01 gapindex v2.1.0}: Initial compiling and planning notes + +-- +\href{C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-14_v2-1-1.txt}{GAP\_PRODUCTS +ChangeLog (last produced on 2023-11-14) using gapindex v2.1.1}: A new +version of gapindex (v2.1.1) was used to produced these data. There was +a slight change to how subarea biomass totals are calculated. The +modified biomass records reflect this change. New 2022 otolith data were +available since the last iteration of the GAP\_PRODUCTS for Aleutian +Island Pacific ocean perch and northern rockifsh and Eastern Bering Sea +northern rock sole. Zero-filled CPUE records for four GOA species codes +(SPECIES\_CODE: 21210, 30010, 30360, 77102, 98101) were added due to how +the 1990 data were integrated in the last production run of +GAP\_PRODUCTS. Two Arctic cod (SPECIES\_CODE: 21725) and one plain +sculpin (SPECIES\_CODE: 21371) count records were modified in the NBS +data, which changes the numerical CPUE estimates for those hauls which +changes the estimated population abundance and size composition for +those species. + +-- +\href{C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-17.txt}{GAP\_PRODUCTS +ChangeLog (last produced on 2023-11-17) using gapindex v2.1.2}: A new +version of gapindex +(\href{https://github.com/afsc-gap-products/gapindex/releases/tag/v2.1.2}{v2.1.2}) +was used to produced these data. There was a slight change to how +subarea biomass totals are calculated that was not fully addressed in +v2.1.1. The modified biomass records reflect this change. \hypertarget{code-of-conduct}{% \chapter{Code of Conduct}\label{code-of-conduct}} @@ -4265,9 +4207,9 @@ \section*{Data SQL Query Examples:}\label{data-sql-query-examples}} \end{Highlighting} \end{Shaded} -\hypertarget{ex.-select-all-data-from-a-table}{% -\subsection{Ex. Select all data from a -table}\label{ex.-select-all-data-from-a-table}} +\hypertarget{ex.-select-all-data-from-tables}{% +\subsection{Ex. Select all data from +tables}\label{ex.-select-all-data-from-tables}} You can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the @@ -4300,6 +4242,130 @@ \subsection{Ex. Select all data from a \end{Highlighting} \end{Shaded} +\hypertarget{ex.-cpue-for-all-ebs-and-nbs-stations-with-associated-haul-cruise-and-species-information.}{% +\subsection{Ex. CPUE for all EBS and NBS stations with associated haul, +cruise, and species +information.}\label{ex.-cpue-for-all-ebs-and-nbs-stations-with-associated-haul-cruise-and-species-information.}} + +\begin{Shaded} +\begin{Highlighting}[] +\NormalTok{a }\OtherTok{\textless{}{-}}\NormalTok{ RODBC}\SpecialCharTok{::}\FunctionTok{sqlQuery}\NormalTok{(}\AttributeTok{channel =}\NormalTok{ channel, }\CommentTok{\# NOT RACEBASE.HAUL} + \AttributeTok{query =} \FunctionTok{paste0}\NormalTok{(} +\StringTok{"} +\StringTok{{-}{-} Select columns for output data} +\StringTok{SELECT} +\StringTok{cr.CRUISEJOIN,} +\StringTok{cr.CRUISE,} +\StringTok{cr.YEAR,} +\StringTok{cr.SURVEY\_DEFINITION\_ID,} +\StringTok{cr.SURVEY\_NAME,} +\StringTok{cr.VESSEL\_ID,} +\StringTok{cr.VESSEL\_NAME,} +\StringTok{cp.HAULJOIN,} +\StringTok{cp.SPECIES\_CODE,} +\StringTok{tt.SPECIES\_NAME,} +\StringTok{tt.COMMON\_NAME,} +\StringTok{cp.WEIGHT\_KG,} +\StringTok{cp.COUNT,} +\StringTok{cp.AREA\_SWEPT\_KM2,} +\StringTok{cp.CPUE\_KGKM2,} +\StringTok{cp.CPUE\_NOKM2,} +\StringTok{hh.HAUL,} +\StringTok{hh.STATION} + +\StringTok{{-}{-} Identify what tables to pull data from} +\StringTok{FROM GAP\_PRODUCTS.AKFIN\_HAUL hh} +\StringTok{LEFT JOIN GAP\_PRODUCTS.AKFIN\_CRUISE cr} +\StringTok{ON hh.CRUISEJOIN = cr.CRUISEJOIN} +\StringTok{LEFT JOIN GAP\_PRODUCTS.AKFIN\_CPUE cp} +\StringTok{ON hh.HAULJOIN = cp.HAULJOIN} +\StringTok{LEFT JOIN GAP\_PRODUCTS.TAXONOMIC\_CLASSIFICATION tt} +\StringTok{ON cp.SPECIES\_CODE = tt.SPECIES\_CODE} + +\StringTok{{-}{-} Filter for EBS and NBS observations} +\StringTok{WHERE SURVEY\_DEFINITION\_ID IN (143, 98) {-}{-} 143 NBS, 98 EBS} +\StringTok{AND tt.SURVEY\_SPECIES = 1} + +\StringTok{{-}{-} Only return the first 3 rows because otherwise this would be a huge table!} +\StringTok{FETCH FIRST 3 ROWS ONLY;"}\NormalTok{)) } + +\NormalTok{flextable}\SpecialCharTok{::}\FunctionTok{flextable}\NormalTok{(}\FunctionTok{head}\NormalTok{(a)) }\SpecialCharTok{\%\textgreater{}\%} \FunctionTok{theme\_zebra}\NormalTok{()} +\end{Highlighting} +\end{Shaded} + +\global\setlength{\Oldarrayrulewidth}{\arrayrulewidth} + +\global\setlength{\Oldtabcolsep}{\tabcolsep} + +\setlength{\tabcolsep}{0pt} + +\renewcommand*{\arraystretch}{1.5} + + + +\providecommand{\ascline}[3]{\noalign{\global\arrayrulewidth #1}\arrayrulecolor[HTML]{#2}\cline{#3}} + +\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}} +\caption{Ex.: CPUE for all EBS and NBS stations with associated haul, cruise, and +species information.}\tabularnewline + + + + +\hhline{>{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}-} + +\multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CRUISEJOIN}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CRUISE}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{YEAR}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SURVEY\_DEFINITION\_ID}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SURVEY\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{VESSEL\_ID}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{VESSEL\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{HAULJOIN}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SPECIES\_CODE}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SPECIES\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{COMMON\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{WEIGHT\_KG}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{COUNT}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{AREA\_SWEPT\_KM2}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CPUE\_KGKM2}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CPUE\_NOKM2}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{HAUL}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{STATION}}}} \\ + +\noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} + +\endfirsthead + +\hhline{>{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}-} + +\multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CRUISEJOIN}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CRUISE}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{YEAR}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SURVEY\_DEFINITION\_ID}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SURVEY\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{VESSEL\_ID}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{VESSEL\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{HAULJOIN}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SPECIES\_CODE}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{SPECIES\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{COMMON\_NAME}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{WEIGHT\_KG}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{COUNT}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{AREA\_SWEPT\_KM2}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CPUE\_KGKM2}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{CPUE\_NOKM2}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{HAUL}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{STATION}}}} \\ + +\noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} + +\endhead + + + +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{80}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{198,203}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,982}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{98}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Eastern\ Bering\ Sea\ Crab/Groundfish\ Bottom\ Trawl\ Survey}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{CHAPMAN}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{877}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{fish\ egg\ unid.}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.042021}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{G-10}}} \\ + +\noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} + + + + + +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{80}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{198,203}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,982}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{98}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Eastern\ Bering\ Sea\ Crab/Groundfish\ Bottom\ Trawl\ Survey}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{CHAPMAN}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{877}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{fish\ larvae\ unid.}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.042021}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{G-10}}} \\ + +\noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} + + + + + +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{80}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{198,203}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,982}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{98}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Eastern\ Bering\ Sea\ Crab/Groundfish\ Bottom\ Trawl\ Survey}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{CHAPMAN}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{877}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{3}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{fish\ unid.}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.042021}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{G-10}}} \\ + +\noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} + + + + + +\end{longtable} + + + +\arrayrulecolor[HTML]{000000} + +\global\setlength{\arrayrulewidth}{\Oldarrayrulewidth} + +\global\setlength{\tabcolsep}{\Oldtabcolsep} + +\renewcommand*{\arraystretch}{1} + \hypertarget{ex.-cpue-for-all-stations-contained-in-the-inpfc-shumagin-region-area_id-919-for-pacific-cod.}{% \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA\_ID = 919) for Pacific @@ -4388,7 +4454,7 @@ \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,239}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{12}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{55.43748}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-160.1269}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{717.63085}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.5}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,270}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{55.11515}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-159.3512}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{209.28994}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.3}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4396,7 +4462,7 @@ \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,215}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.58732}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-161.1945}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{76.90763}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.3}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,250}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{55.05143}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-159.9679}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{8,700.92017}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{5.1}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4404,7 +4470,7 @@ \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,168}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{11}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.45823}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-163.0872}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2,004.49628}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.9}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,238}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{55.11365}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-159.4264}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{363.17325}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.4}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4412,7 +4478,7 @@ \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,204}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{110}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.51804}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-160.7493}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.7}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,214}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.78608}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-160.0008}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{63.71506}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.6}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4420,7 +4486,7 @@ \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,188}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{210}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.38733}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-159.6986}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{5.5}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,202}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{111}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.48341}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-159.7261}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{618.72120}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.7}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4428,7 +4494,7 @@ \subsection{Ex. CPUE for all stations contained in the INPFC Shumagin -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,183}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{210}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{54.09314}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-161.6996}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{5.3}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-22,247}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{112}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21720}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{55.59093}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-160.0740}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{114.73042}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4.0}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4531,7 +4597,7 @@ \subsection{\texorpdfstring{Ex. EBS Pacific Ocean perch CPUE and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.0000000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{58.75863}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-174.9285}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60.67043}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-178.0946}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4539,7 +4605,7 @@ \subsection{\texorpdfstring{Ex. EBS Pacific Ocean perch CPUE and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.2813533}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{57.32545}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-173.3217}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000000}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60.31361}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-176.0138}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4547,7 +4613,7 @@ \subsection{\texorpdfstring{Ex. EBS Pacific Ocean perch CPUE and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.0000000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{57.64161}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-172.7963}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60.35098}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-175.3850}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4555,7 +4621,7 @@ \subsection{\texorpdfstring{Ex. EBS Pacific Ocean perch CPUE and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.0000000}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{59.67831}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-172.5754}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000000}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60.99712}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-177.6638}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4563,7 +4629,7 @@ \subsection{\texorpdfstring{Ex. EBS Pacific Ocean perch CPUE and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.0000000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60.96936}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-174.8760}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.00000000}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60.96495}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-176.2634}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4571,7 +4637,7 @@ \subsection{\texorpdfstring{Ex. EBS Pacific Ocean perch CPUE and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.0000000}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{58.64012}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-173.5922}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{0.02416379}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{58.97844}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-175.7204}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4648,7 +4714,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and \StringTok{{-}{-} Manipulate data to join to} \StringTok{WITH FILTERED\_STRATA AS (} \StringTok{SELECT AREA\_ID, DESCRIPTION FROM GAP\_PRODUCTS.AKFIN\_AREA} -\StringTok{WHERE TYPE in (\textquotesingle{}REGULATORY\_AREA\textquotesingle{}, \textquotesingle{}REGION\textquotesingle{}) } +\StringTok{WHERE AREA\_TYPE in (\textquotesingle{}REGULATORY\_AREA\textquotesingle{}, \textquotesingle{}REGION\textquotesingle{}) } \StringTok{AND SURVEY\_DEFINITION\_ID = 47)} \StringTok{{-}{-} Select columns for output data} @@ -4728,7 +4794,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483,622.6}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{833,902,161}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1993}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{157,295.1}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{317,129,408}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1990}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4736,7 +4802,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483,622.6}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{833,902,161}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1993}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{157,295.1}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{317,129,408}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1990}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4744,7 +4810,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771,412.8}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,252,616,603}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1996}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483,622.6}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{833,902,161}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1993}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4752,7 +4818,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771,412.8}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,252,616,603}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1996}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483,622.6}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{833,902,161}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1993}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4760,7 +4826,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{727,063.5}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,212,034,913}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1999}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771,412.8}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,252,616,603}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1996}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4768,7 +4834,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{727,063.5}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,212,034,913}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1999}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771,412.8}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,252,616,603}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1996}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{GOA\ Region:\ All\ Strata}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4837,11 +4903,11 @@ \subsection{Ex. AI rock sole size compositions and ridge \StringTok{WITH FILTERED\_STRATA AS (} \StringTok{SELECT } \StringTok{AREA\_ID, } -\StringTok{DESCRIPTION } +\StringTok{DESCRIPTION} \StringTok{{-}{-} Identify what tables to pull data from} \StringTok{FROM GAP\_PRODUCTS.AKFIN\_AREA} -\StringTok{WHERE TYPE = \textquotesingle{}REGION\textquotesingle{} } +\StringTok{WHERE AREA\_TYPE = \textquotesingle{}REGION\textquotesingle{} } \StringTok{AND SURVEY\_DEFINITION\_ID = 52)} \StringTok{{-}{-} Select columns for output data} @@ -4862,10 +4928,12 @@ \subsection{Ex. AI rock sole size compositions and ridge \begin{Highlighting}[] \NormalTok{dat0 }\OtherTok{\textless{}{-}}\NormalTok{ dat }\SpecialCharTok{\%\textgreater{}\%} \NormalTok{ janitor}\SpecialCharTok{::}\FunctionTok{clean\_names}\NormalTok{() }\SpecialCharTok{\%\textgreater{}\%} -\NormalTok{ dplyr}\SpecialCharTok{::}\FunctionTok{mutate}\NormalTok{(}\AttributeTok{length\_cm =}\NormalTok{ length\_mm}\SpecialCharTok{/}\DecValTok{10}\NormalTok{)} -\NormalTok{flextable}\SpecialCharTok{::}\FunctionTok{flextable}\NormalTok{(}\FunctionTok{head}\NormalTok{(dat)) }\SpecialCharTok{\%\textgreater{}\%} - \FunctionTok{theme\_zebra}\NormalTok{() }\SpecialCharTok{\%\textgreater{}\%} -\NormalTok{ flextable}\SpecialCharTok{::}\FunctionTok{colformat\_num}\NormalTok{(}\AttributeTok{x =}\NormalTok{ ., }\AttributeTok{j =} \StringTok{"YEAR"}\NormalTok{, }\AttributeTok{big.mark =} \StringTok{""}\NormalTok{)} +\NormalTok{ dplyr}\SpecialCharTok{::}\FunctionTok{mutate}\NormalTok{(}\AttributeTok{length\_cm =}\NormalTok{ length\_mm}\SpecialCharTok{/}\DecValTok{10}\NormalTok{) }\SpecialCharTok{\%\textgreater{}\%} + \FunctionTok{head}\NormalTok{() }\SpecialCharTok{\%\textgreater{}\%} +\NormalTok{ flextable}\SpecialCharTok{::}\FunctionTok{flextable}\NormalTok{() }\SpecialCharTok{\%\textgreater{}\%} +\NormalTok{ flextable}\SpecialCharTok{::}\FunctionTok{theme\_zebra}\NormalTok{() }\SpecialCharTok{\%\textgreater{}\%} +\NormalTok{ flextable}\SpecialCharTok{::}\FunctionTok{colformat\_num}\NormalTok{(}\AttributeTok{x =}\NormalTok{ ., }\AttributeTok{j =} \StringTok{"year"}\NormalTok{, }\AttributeTok{big.mark =} \StringTok{""}\NormalTok{)} +\NormalTok{dat0} \end{Highlighting} \end{Shaded} @@ -4881,23 +4949,23 @@ \subsection{Ex. AI rock sole size compositions and ridge \providecommand{\ascline}[3]{\noalign{\global\arrayrulewidth #1}\arrayrulecolor[HTML]{#2}\cline{#3}} -\begin{longtable}[c]{|p{0.75in}|p{0.75in}} +\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}} \caption{Ex. 2: AI Rock sole size compositions and ridge plot.}\tabularnewline -\hhline{>{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}-} +\hhline{>{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}-} -\multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{LENGTH\_MM}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{YEAR}}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{length\_mm}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{year}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{length\_cm}}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} \endfirsthead -\hhline{>{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}-} +\hhline{>{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}->{\arrayrulecolor[HTML]{000000}\global\arrayrulewidth=0pt}-} -\multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{LENGTH\_MM}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{YEAR}}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{length\_mm}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{year}}}} & \multicolumn{1}{>{\cellcolor[HTML]{CFCFCF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{\textbf{length\_cm}}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4905,7 +4973,7 @@ \subsection{Ex. AI rock sole size compositions and ridge -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{180}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2014}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{110}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1997}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{11}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4913,7 +4981,7 @@ \subsection{Ex. AI rock sole size compositions and ridge -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{190}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2014}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{130}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1997}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4921,7 +4989,7 @@ \subsection{Ex. AI rock sole size compositions and ridge -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{200}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2014}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{140}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1997}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{14}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4929,7 +4997,7 @@ \subsection{Ex. AI rock sole size compositions and ridge -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{210}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2014}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{150}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1997}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{15}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4937,7 +5005,7 @@ \subsection{Ex. AI rock sole size compositions and ridge -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{220}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2014}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{160}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1997}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{16}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4945,7 +5013,7 @@ \subsection{Ex. AI rock sole size compositions and ridge -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{230}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2014}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{170}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1997}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{17}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -4971,8 +5039,8 @@ \subsection{Ex. AI rock sole size compositions and ridge \FunctionTok{library}\NormalTok{(ggridges)} \NormalTok{figure }\OtherTok{\textless{}{-}} \NormalTok{ ggplot2}\SpecialCharTok{::}\FunctionTok{ggplot}\NormalTok{(} - \AttributeTok{data =}\NormalTok{ dat0, } - \AttributeTok{mapping =} \FunctionTok{aes}\NormalTok{(}\AttributeTok{x =}\NormalTok{ length\_cm, }\AttributeTok{y =} \FunctionTok{as.factor}\NormalTok{(year), }\AttributeTok{fill =} \FunctionTok{stat}\NormalTok{(x))) }\SpecialCharTok{+} + \AttributeTok{data =}\NormalTok{ dat, } + \AttributeTok{mapping =} \FunctionTok{aes}\NormalTok{(}\AttributeTok{x =}\NormalTok{ LENGTH\_MM, }\AttributeTok{y =} \FunctionTok{as.factor}\NormalTok{(YEAR), }\AttributeTok{fill =} \FunctionTok{stat}\NormalTok{(x))) }\SpecialCharTok{+} \NormalTok{ ggridges}\SpecialCharTok{::}\FunctionTok{theme\_ridges}\NormalTok{(}\AttributeTok{center\_axis\_labels =} \ConstantTok{TRUE}\NormalTok{) }\SpecialCharTok{+} \NormalTok{ ggridges}\SpecialCharTok{::}\FunctionTok{geom\_density\_ridges\_gradient}\NormalTok{(}\AttributeTok{scale =} \DecValTok{4}\NormalTok{, }\AttributeTok{show.legend =} \ConstantTok{FALSE}\NormalTok{) }\SpecialCharTok{+} \NormalTok{ ggplot2}\SpecialCharTok{::}\FunctionTok{scale\_y\_discrete}\NormalTok{(}\AttributeTok{name =} \StringTok{"Year"}\NormalTok{, }\AttributeTok{expand =} \FunctionTok{c}\NormalTok{(}\FloatTok{0.01}\NormalTok{, }\DecValTok{0}\NormalTok{)) }\SpecialCharTok{+} @@ -5012,7 +5080,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age \StringTok{AREA\_ID, } \StringTok{DESCRIPTION } \StringTok{FROM GAP\_PRODUCTS.AKFIN\_AREA} -\StringTok{WHERE TYPE = \textquotesingle{}REGION\textquotesingle{} AND } +\StringTok{WHERE AREA\_TYPE = \textquotesingle{}REGION\textquotesingle{} AND } \StringTok{SURVEY\_DEFINITION\_ID = 98)} \StringTok{{-}{-} Select columns for output data} @@ -5082,7 +5150,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{9}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{39,371}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{3}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{11}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{48,791,451}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5090,7 +5158,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{10}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{32,156}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{3}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{12}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{120,673,580}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5098,7 +5166,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{11}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{15,200}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{3}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{42,580,054}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5106,7 +5174,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{12}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{9,976}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{3}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{14}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47,229,378}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5114,7 +5182,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{13}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,957}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{3}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{15}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{25,140,523}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5122,7 +5190,7 @@ \subsection{Ex. EBS Walleye Pollock Age Compositions and Age -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{131,950,343}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{16}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{19,473,255}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5191,7 +5259,7 @@ \subsection{Ex. NBS Pacific cod biomass and \StringTok{AREA\_NAME, } \StringTok{DESCRIPTION } \StringTok{FROM GAP\_PRODUCTS.AKFIN\_AREA} -\StringTok{WHERE TYPE in (\textquotesingle{}STRATUM\textquotesingle{}) AND } +\StringTok{WHERE AREA\_TYPE in (\textquotesingle{}STRATUM\textquotesingle{}) AND } \StringTok{SURVEY\_DEFINITION\_ID = 143) } \StringTok{{-}{-} Select columns for output data} @@ -5266,7 +5334,7 @@ \subsection{Ex. NBS Pacific cod biomass and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{95,849.983}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{68,767,498}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2021}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{7,462.559}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4,724,153}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2010}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5274,7 +5342,7 @@ \subsection{Ex. NBS Pacific cod biomass and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{107,096.730}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{102,734,142}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2019}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{7,462.559}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4,724,153}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2010}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5282,7 +5350,7 @@ \subsection{Ex. NBS Pacific cod biomass and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{76,708.433}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{39,605,860}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2023}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{7,462.559}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4,724,153}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2010}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5290,7 +5358,7 @@ \subsection{Ex. NBS Pacific cod biomass and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{132,490.152}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{66,187,245}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2017}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{7,462.559}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4,724,153}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2010}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5298,7 +5366,7 @@ \subsection{Ex. NBS Pacific cod biomass and -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{96,500.697}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{60,433,135}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2022}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{7,462.559}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4,724,153}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2010}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5306,7 +5374,7 @@ \subsection{Ex. NBS Pacific cod biomass and -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{7,462.559}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{4,724,153}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2010}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{95,849.983}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{68,767,498}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2021}}} & \multicolumn{1}{>{\raggedright}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{Inner\ Domain}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5435,7 +5503,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and line -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483,622.6}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{11,803,384,787}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1993}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483.6226}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{700.9093}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{266.33581}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{157,295.1}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2,221,176,968}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1990}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{157.2951}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{251.5538}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{63.03638}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5443,7 +5511,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and line -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771,412.8}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{41,434,152,202}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1996}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771.4128}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,178.5204}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{364.30515}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483,622.6}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{11,803,384,787}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1993}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{483.6226}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{700.9093}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{266.33581}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5451,7 +5519,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and line -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{727,063.5}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{150,983,542,178}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1999}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{727.0635}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,504.1955}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-50.06854}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771,412.8}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{41,434,152,202}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1996}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{771.4128}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,178.5204}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{364.30515}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5459,7 +5527,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and line -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{673,155.1}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{49,285,342,922}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2001}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{673.1551}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,117.1611}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{229.14901}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{727,063.5}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{150,983,542,178}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1999}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{727.0635}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,504.1955}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{-50.06854}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5467,7 +5535,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and line -\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{457,421.6}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{5,186,126,529}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2003}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{457.4216}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{601.4511}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{313.39204}}} \\ +\multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{673,155.1}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{49,285,342,922}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2001}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{673.1551}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,117.1611}}} & \multicolumn{1}{>{\cellcolor[HTML]{EFEFEF}\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{229.14901}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -5475,7 +5543,7 @@ \subsection{Ex. GOA Pacific Ocean perch biomass and line -\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{764,901.4}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{21,499,807,010}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2005}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{764.9014}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{1,058.1577}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{471.64517}}} \\ +\multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{47}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{457,421.6}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{5,186,126,529}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{2003}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{457.4216}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{601.4511}}} & \multicolumn{1}{>{\raggedleft}m{\dimexpr 0.75in+0\tabcolsep}}{\textcolor[HTML]{000000}{\fontsize{11}{11}\selectfont{313.39204}}} \\ \noalign{\global\arrayrulewidth 0pt}\arrayrulecolor[HTML]{000000} @@ -7740,8 +7808,8 @@ \section{Ex. 7: Visualize CPUE data in distribution \AttributeTok{set.breaks =} \StringTok{"jenks"}\NormalTok{, }\CommentTok{\# Gets Jenks breaks from classint::classIntervals()} \AttributeTok{in.crs =} \StringTok{"+proj=longlat"}\NormalTok{, }\CommentTok{\# Set input coordinate reference system} \AttributeTok{out.crs =} \StringTok{"EPSG:3338"}\NormalTok{, }\CommentTok{\# Set output coordinate reference system} - \AttributeTok{grid.cell =} \FunctionTok{c}\NormalTok{(}\DecValTok{20000}\NormalTok{, }\DecValTok{20000}\NormalTok{), }\CommentTok{\# 20x20km grid} - \AttributeTok{key.title =} \StringTok{"Pacific Ocean perch"}\NormalTok{) }\CommentTok{\# Include in the legend title} + \AttributeTok{grid.cell =} \FunctionTok{c}\NormalTok{(}\DecValTok{20000}\NormalTok{, }\DecValTok{20000}\NormalTok{))}\SpecialCharTok{$}\NormalTok{plot }\SpecialCharTok{+} \CommentTok{\# 20x20km grid} +\NormalTok{ ggplot2}\SpecialCharTok{::}\FunctionTok{guides}\NormalTok{(}\AttributeTok{fill=}\FunctionTok{guide\_legend}\NormalTok{(}\AttributeTok{title =} \StringTok{"Pacific cod}\SpecialCharTok{\textbackslash{}n}\StringTok{CPUE (kg/km2)"}\NormalTok{))} \end{Highlighting} \end{Shaded} @@ -7750,23 +7818,6 @@ \section{Ex. 7: Visualize CPUE data in distribution [inverse distance weighted interpolation] \end{verbatim} -\begin{Shaded} -\begin{Highlighting}[] -\NormalTok{figure}\SpecialCharTok{$}\NormalTok{plot }\SpecialCharTok{+} -\NormalTok{ ggplot2}\SpecialCharTok{::}\FunctionTok{guides}\NormalTok{(}\AttributeTok{fill=}\FunctionTok{guide\_legend}\NormalTok{(}\AttributeTok{title =} \StringTok{"Pacific cod}\SpecialCharTok{\textbackslash{}n}\StringTok{CPUE (kg/km2)"}\NormalTok{))} -\end{Highlighting} -\end{Shaded} - -\begin{figure}[H] - -{\centering \includegraphics{content/foss-api-r_files/figure-pdf/test-7-fig-1.pdf} - -} - -\caption{Ex. 7: Visualize CPUE data in distribution map.} - -\end{figure} - \hypertarget{access-via-api-and-python}{% \chapter{Access via API and Python}\label{access-via-api-and-python}} diff --git a/_freeze/content/akfin-oracle-sql-r/execute-results/docx.json b/_freeze/content/akfin-oracle-sql-r/execute-results/docx.json index 9c8efbb..6d87513 100644 --- a/_freeze/content/akfin-oracle-sql-r/execute-results/docx.json +++ b/_freeze/content/akfin-oracle-sql-r/execute-results/docx.json @@ -1,7 +1,7 @@ { - "hash": "6ca4dec388d9bb5ed42dd65c29ee5da6", + "hash": "e95dda4032f9d6c0c84201c12b9852cc", "result": { - "markdown": "---\ntitle: Access data\nnumber-sections: true\nnumber-depth: 3\n---\n\n\n\n\n\n\n## Access data via Oracle (AFSC only) {.unnumbered}\n\nAFSC `Oracle` users can access the database via `SQL developer` to view and pull the production data directly from the `GAP_PRODUCTS` `Oracle` schema. The user can also use `SQL developer` to view and pull the GAP Products data directly from the `GAP_PRODUCTS` `Oracle` schema. \n\n### Connect to Oracle from R\n\nMany users will want to access the data from `Oracle` using `R`. The user will need to install the `RODBC` `R` package and ask OFIS (IT) connect `R` to `Oracle`. Then, use the following code in `R` to establish a connection from `R` to `Oracle`: \n\nHere, the user can establish the oracle connection by entering their username and password in the `channel <- gapindex::oracle_connect()` function. Never save usernames or passwords in scripts that may be intentionally or unintentionally shared with others. If no username and password is entered in the function, pop-ups will appear on the screen asking for the username and password. \n\nAfter you connect to VPN, you'll be able to log into Oracle. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(RODBC)\nchannel <- gapindex::get_connected()\n```\n:::\n\n\n\n\n## Data SQL Query Examples: {.unnumbered}\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n```\n:::\n\n\n\n\n### Ex. Select all data from a table\n\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n```\n:::\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n:::\n\n::: {.cell tbl-cap='Ex. 7: Summary table of Number hauls where species were observed (N_HAULS) and number of length measurements that were colelcted for this species (N_LENGTHS) for EBS and NBS, for arrowtooth flounder (10110), Bering flounder (10140), and Alaska skate (435). '}\n\n:::\n\n\n\n\n### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 8: CPUE for all stations contained in the Shumagin region (AREA_ID = 919). '}\n\n```{.r .cell-code}\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1HAULJOINSTRATUMSPECIES_CODELATITUDE_DD_STARTLONGITUDE_DD_STARTCPUE_KGKM2GEAR_TEMPERATURE_Cbody1-22,239122172055.43748-160.1269717.630854.5body2-22,215132172054.58732-161.194576.907634.3body3-22,168112172054.45823-163.08722,004.496284.9body4-22,2041102172054.51804-160.74930.000004.7body5-22,1882102172054.38733-159.69860.000005.5body6-22,1832102172054.09314-161.69960.000005.3\n``````\n:::\n:::\n\n\n\n\n### Ex. EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map \n\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from `GAP_PRODUCTS.AKFIN_CPUE` and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). Here, we'll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their `RACEBASE` analogs. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1CPUE_KGHALATITUDELONGITUDEbody10.000000058.75863-174.9285body20.281353357.32545-173.3217body30.000000057.64161-172.7963body40.000000059.67831-172.5754body50.000000060.96936-174.8760body60.000000058.64012-173.5922\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n```\n\n::: {.cell-output-display}\n![Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. ](akfin-oracle-sql-r_files/figure-docx/test-6-fig-1.png)\n:::\n:::\n\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and abundance\n\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 1: GOA Pacific Ocean perch biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1BIOMASS_MTPOPULATION_COUNTYEARDESCRIPTIONbody1483,622.6833,902,1611993GOA Region: All Stratabody2483,622.6833,902,1611993GOA Region: All Stratabody3771,412.81,252,616,6031996GOA Region: All Stratabody4771,412.81,252,616,6031996GOA Region: All Stratabody5727,063.51,212,034,9131999GOA Region: All Stratabody6727,063.51,212,034,9131999GOA Region: All Strata\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 1: GOA Pacific Ocean perch biomass and abundance. ](akfin-oracle-sql-r_files/figure-docx/test-1-plot-1.png)\n:::\n:::\n\n\n\n\n### Ex. AI rock sole size compositions and ridge plot\n\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from [`ggridges`](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html).\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 2: AI Rock sole size compositions and ridge plot. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10)\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1LENGTH_MMYEARbody11802014body21902014body32002014body42102014body52202014body62302014\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat0, \n mapping = aes(x = length_cm, y = as.factor(year), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 2: AI Rock sole size compositions and ridge plot. ](akfin-oracle-sql-r_files/figure-docx/test-2-plot-1.png)\n:::\n:::\n\n\n\n\n### Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\n\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1AGEPOPULATION_COUNTSEXbody1939,3713body21032,1563body31115,2003body4129,9763body5131,9573body61131,950,3431\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. ](akfin-oracle-sql-r_files/figure-docx/test-3-plot-1.png)\n:::\n:::\n\n\n\n\n### Ex. NBS Pacific cod biomass and abundance\n\nPacific cod biomass and abundance data for the NBS by stratum. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 4: NBS Pacific cod biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1BIOMASS_MTPOPULATION_COUNTYEARAREA_NAMEbody195,849.98368,767,4982021Inner Domainbody2107,096.730102,734,1422019Inner Domainbody376,708.43339,605,8602023Inner Domainbody4132,490.15266,187,2452017Inner Domainbody596,500.69760,433,1352022Inner Domainbody67,462.5594,724,1532010Inner Domain\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 4: NBS Pacific cod biomass and abundance. ](akfin-oracle-sql-r_files/figure-docx/test-4-fig-1.png)\n:::\n:::\n\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and line plot\n\nPacific Ocean perch biomass totals for GOA between 1984-2021 from `GAP_PRODUCTS.AKFIN_BIOMASS`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n```\n:::\n\n::: {.cell tbl-cap='Ex. 5: GOA Pacific Ocean perch biomass and line plot. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1survey_definition_idbiomass_mtbiomass_varyearbiomass_kmtbiomass_kci_upbiomass_kci_dwbody147483,622.611,803,384,7871993483.6226700.9093266.33581body247771,412.841,434,152,2021996771.41281,178.5204364.30515body347727,063.5150,983,542,1781999727.06351,504.1955-50.06854body447673,155.149,285,342,9222001673.15511,117.1611229.14901body547457,421.65,186,126,5292003457.4216601.4511313.39204body647764,901.421,499,807,0102005764.90141,058.1577471.64517\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 5: GOA Pacific Ocean perch biomass and line plot. ](akfin-oracle-sql-r_files/figure-docx/test-5-fig-1.png)\n:::\n:::\n\n::: {.cell}\n\n:::\n", + "markdown": "---\ntitle: Access data\nnumber-sections: true\nnumber-depth: 3\n---\n\n\n\n\n\n\n## Access data via Oracle (AFSC only) {.unnumbered}\n\nAFSC `Oracle` users can access the database via `SQL developer` to view and pull the production data directly from the `GAP_PRODUCTS` `Oracle` schema. The user can also use `SQL developer` to view and pull the GAP Products data directly from the `GAP_PRODUCTS` `Oracle` schema. \n\n### Connect to Oracle from R\n\nMany users will want to access the data from `Oracle` using `R`. The user will need to install the `RODBC` `R` package and ask OFIS (IT) connect `R` to `Oracle`. Then, use the following code in `R` to establish a connection from `R` to `Oracle`: \n\nHere, the user can establish the oracle connection by entering their username and password in the `channel <- gapindex::oracle_connect()` function. Never save usernames or passwords in scripts that may be intentionally or unintentionally shared with others. If no username and password is entered in the function, pop-ups will appear on the screen asking for the username and password. \n\nAfter you connect to VPN, you'll be able to log into Oracle. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(RODBC)\nchannel <- gapindex::get_connected()\n```\n:::\n\n\n\n\n## Data SQL Query Examples: {.unnumbered}\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n```\n:::\n\n\n\n\n### Ex. Select all data from tables\n\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n```\n:::\n\n\n\n\n### Ex. CPUE for all EBS and NBS stations with associated haul, cruise, and species information.\n\n\n\n\n::: {.cell tbl-cap='Ex.: CPUE for all EBS and NBS stations with associated haul, cruise, and species information. '}\n\n```{.r .cell-code}\na <- RODBC::sqlQuery(channel = channel, # NOT RACEBASE.HAUL\n query = paste0(\n\"\n-- Select columns for output data\nSELECT\ncr.CRUISEJOIN,\ncr.CRUISE,\ncr.YEAR,\ncr.SURVEY_DEFINITION_ID,\ncr.SURVEY_NAME,\ncr.VESSEL_ID,\ncr.VESSEL_NAME,\ncp.HAULJOIN,\ncp.SPECIES_CODE,\ntt.SPECIES_NAME,\ntt.COMMON_NAME,\ncp.WEIGHT_KG,\ncp.COUNT,\ncp.AREA_SWEPT_KM2,\ncp.CPUE_KGKM2,\ncp.CPUE_NOKM2,\nhh.HAUL,\nhh.STATION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_HAUL hh\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cr\nON hh.CRUISEJOIN = cr.CRUISEJOIN\nLEFT JOIN GAP_PRODUCTS.AKFIN_CPUE cp\nON hh.HAULJOIN = cp.HAULJOIN\nLEFT JOIN GAP_PRODUCTS.TAXONOMIC_CLASSIFICATION tt\nON cp.SPECIES_CODE = tt.SPECIES_CODE\n\n-- Filter for EBS and NBS observations\nWHERE SURVEY_DEFINITION_ID IN (143, 98) -- 143 NBS, 98 EBS\nAND tt.SURVEY_SPECIES = 1\n\n-- Only return the first 3 rows because otherwise this would be a huge table!\nFETCH FIRST 3 ROWS ONLY;\")) \n\nflextable::flextable(head(a)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1CRUISEJOINCRUISEYEARSURVEY_DEFINITION_IDSURVEY_NAMEVESSEL_IDVESSEL_NAMEHAULJOINSPECIES_CODESPECIES_NAMECOMMON_NAMEWEIGHT_KGCOUNTAREA_SWEPT_KM2CPUE_KGKM2CPUE_NOKM2HAULSTATIONbody180198,2031,98298Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey1CHAPMAN8771fish egg unid.000.0420210021G-10body280198,2031,98298Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey1CHAPMAN8772fish larvae unid.000.0420210021G-10body380198,2031,98298Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey1CHAPMAN8773fish unid.000.0420210021G-10\n``````\n:::\n:::\n\n\n\n\n### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 8: CPUE for all stations contained in the Shumagin region (AREA_ID = 919). '}\n\n```{.r .cell-code}\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1HAULJOINSTRATUMSPECIES_CODELATITUDE_DD_STARTLONGITUDE_DD_STARTCPUE_KGKM2GEAR_TEMPERATURE_Cbody1-22,270132172055.11515-159.3512209.289944.3body2-22,250132172055.05143-159.96798,700.920175.1body3-22,238132172055.11365-159.4264363.173254.4body4-22,214132172054.78608-160.000863.715064.6body5-22,2021112172054.48341-159.7261618.721204.7body6-22,2471122172055.59093-160.0740114.730424.0\n``````\n:::\n:::\n\n\n\n\n### Ex. EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map \n\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from `GAP_PRODUCTS.AKFIN_CPUE` and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). Here, we'll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their `RACEBASE` analogs. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1CPUE_KGHALATITUDELONGITUDEbody10.0000000060.67043-178.0946body20.0000000060.31361-176.0138body30.0000000060.35098-175.3850body40.0000000060.99712-177.6638body50.0000000060.96495-176.2634body60.0241637958.97844-175.7204\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n```\n\n::: {.cell-output-display}\n![Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. ](akfin-oracle-sql-r_files/figure-docx/test-6-fig-1.png)\n:::\n:::\n\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and abundance\n\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 1: GOA Pacific Ocean perch biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1BIOMASS_MTPOPULATION_COUNTYEARDESCRIPTIONbody1157,295.1317,129,4081990GOA Region: All Stratabody2157,295.1317,129,4081990GOA Region: All Stratabody3483,622.6833,902,1611993GOA Region: All Stratabody4483,622.6833,902,1611993GOA Region: All Stratabody5771,412.81,252,616,6031996GOA Region: All Stratabody6771,412.81,252,616,6031996GOA Region: All Strata\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 1: GOA Pacific Ocean perch biomass and abundance. ](akfin-oracle-sql-r_files/figure-docx/test-1-plot-1.png)\n:::\n:::\n\n\n\n\n### Ex. AI rock sole size compositions and ridge plot\n\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from [`ggridges`](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html).\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 2: AI Rock sole size compositions and ridge plot. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10) %>% \n head() %>% \n flextable::flextable() %>% \n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\ndat0\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1length_mmyearlength_cmbody1110199711body2130199713body3140199714body4150199715body5160199716body6170199717\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat, \n mapping = aes(x = LENGTH_MM, y = as.factor(YEAR), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 2: AI Rock sole size compositions and ridge plot. ](akfin-oracle-sql-r_files/figure-docx/test-2-plot-1.png)\n:::\n:::\n\n\n\n\n### Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\n\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1AGEPOPULATION_COUNTSEXbody11148,791,4512body212120,673,5802body31342,580,0542body41447,229,3782body51525,140,5232body61619,473,2552\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. ](akfin-oracle-sql-r_files/figure-docx/test-3-plot-1.png)\n:::\n:::\n\n\n\n\n### Ex. NBS Pacific cod biomass and abundance\n\nPacific cod biomass and abundance data for the NBS by stratum. \n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 4: NBS Pacific cod biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1BIOMASS_MTPOPULATION_COUNTYEARAREA_NAMEbody17,462.5594,724,1532010Inner Domainbody295,849.98368,767,4982021Inner Domainbody3107,096.730102,734,1422019Inner Domainbody476,708.43339,605,8602023Inner Domainbody5132,490.15266,187,2452017Inner Domainbody696,500.69760,433,1352022Inner Domain\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 4: NBS Pacific cod biomass and abundance. ](akfin-oracle-sql-r_files/figure-docx/test-4-fig-1.png)\n:::\n:::\n\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and line plot\n\nPacific Ocean perch biomass totals for GOA between 1984-2021 from `GAP_PRODUCTS.AKFIN_BIOMASS`\n\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n```\n:::\n\n::: {.cell tbl-cap='Ex. 5: GOA Pacific Ocean perch biomass and line plot. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1survey_definition_idbiomass_mtbiomass_varyearbiomass_kmtbiomass_kci_upbiomass_kci_dwbody147157,295.12,221,176,9681990157.2951251.553863.03638body247483,622.611,803,384,7871993483.6226700.9093266.33581body347771,412.841,434,152,2021996771.41281,178.5204364.30515body447727,063.5150,983,542,1781999727.06351,504.1955-50.06854body547673,155.149,285,342,9222001673.15511,117.1611229.14901body647457,421.65,186,126,5292003457.4216601.4511313.39204\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 5: GOA Pacific Ocean perch biomass and line plot. ](akfin-oracle-sql-r_files/figure-docx/test-5-fig-1.png)\n:::\n:::\n\n::: {.cell}\n\n:::\n", "supporting": [ "akfin-oracle-sql-r_files\\figure-docx" ], diff --git a/_freeze/content/akfin-oracle-sql-r/execute-results/html.json b/_freeze/content/akfin-oracle-sql-r/execute-results/html.json index a682d86..7eeef9f 100644 --- a/_freeze/content/akfin-oracle-sql-r/execute-results/html.json +++ b/_freeze/content/akfin-oracle-sql-r/execute-results/html.json @@ -1,7 +1,7 @@ { - "hash": "6ca4dec388d9bb5ed42dd65c29ee5da6", + "hash": "e95dda4032f9d6c0c84201c12b9852cc", "result": { - "markdown": "---\ntitle: Access data\nnumber-sections: true\nnumber-depth: 3\n---\n\n\n\n\n## Access data via Oracle (AFSC only) {.unnumbered}\n\nAFSC `Oracle` users can access the database via `SQL developer` to view and pull the production data directly from the `GAP_PRODUCTS` `Oracle` schema. The user can also use `SQL developer` to view and pull the GAP Products data directly from the `GAP_PRODUCTS` `Oracle` schema. \n\n### Connect to Oracle from R\n\nMany users will want to access the data from `Oracle` using `R`. The user will need to install the `RODBC` `R` package and ask OFIS (IT) connect `R` to `Oracle`. Then, use the following code in `R` to establish a connection from `R` to `Oracle`: \n\nHere, the user can establish the oracle connection by entering their username and password in the `channel <- gapindex::oracle_connect()` function. Never save usernames or passwords in scripts that may be intentionally or unintentionally shared with others. If no username and password is entered in the function, pop-ups will appear on the screen asking for the username and password. \n\nAfter you connect to VPN, you'll be able to log into Oracle. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(RODBC)\nchannel <- gapindex::get_connected()\n```\n:::\n\n\n## Data SQL Query Examples: {.unnumbered}\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n```\n:::\n\n\n### Ex. Select all data from a table\n\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n```\n:::\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n:::\n\n::: {.cell tbl-cap='Ex. 7: Summary table of Number hauls where species were observed (N_HAULS) and number of length measurements that were colelcted for this species (N_LENGTHS) for EBS and NBS, for arrowtooth flounder (10110), Bering flounder (10140), and Alaska skate (435). '}\n\n:::\n\n\n### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 8: CPUE for all stations contained in the Shumagin region (AREA_ID = 919). '}\n\n```{.r .cell-code}\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

HAULJOIN

STRATUM

SPECIES_CODE

LATITUDE_DD_START

LONGITUDE_DD_START

CPUE_KGKM2

GEAR_TEMPERATURE_C

-22,239

12

21720

55.43748

-160.1269

717.63085

4.5

-22,215

13

21720

54.58732

-161.1945

76.90763

4.3

-22,168

11

21720

54.45823

-163.0872

2,004.49628

4.9

-22,204

110

21720

54.51804

-160.7493

0.00000

4.7

-22,188

210

21720

54.38733

-159.6986

0.00000

5.5

-22,183

210

21720

54.09314

-161.6996

0.00000

5.3

\n```\n:::\n:::\n\n\n### Ex. EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map \n\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from `GAP_PRODUCTS.AKFIN_CPUE` and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). Here, we'll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their `RACEBASE` analogs. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

CPUE_KGHA

LATITUDE

LONGITUDE

0.0000000

58.75863

-174.9285

0.2813533

57.32545

-173.3217

0.0000000

57.64161

-172.7963

0.0000000

59.67831

-172.5754

0.0000000

60.96936

-174.8760

0.0000000

58.64012

-173.5922

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n```\n\n::: {.cell-output-display}\n![Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. ](akfin-oracle-sql-r_files/figure-html/test-6-fig-1.png){width=672}\n:::\n:::\n\n\n### Ex. GOA Pacific Ocean perch biomass and abundance\n\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 1: GOA Pacific Ocean perch biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

BIOMASS_MT

POPULATION_COUNT

YEAR

DESCRIPTION

483,622.6

833,902,161

1993

GOA Region: All Strata

483,622.6

833,902,161

1993

GOA Region: All Strata

771,412.8

1,252,616,603

1996

GOA Region: All Strata

771,412.8

1,252,616,603

1996

GOA Region: All Strata

727,063.5

1,212,034,913

1999

GOA Region: All Strata

727,063.5

1,212,034,913

1999

GOA Region: All Strata

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 1: GOA Pacific Ocean perch biomass and abundance. ](akfin-oracle-sql-r_files/figure-html/test-1-plot-1.png){width=672}\n:::\n:::\n\n\n### Ex. AI rock sole size compositions and ridge plot\n\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from [`ggridges`](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html).\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 2: AI Rock sole size compositions and ridge plot. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10)\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

LENGTH_MM

YEAR

180

2014

190

2014

200

2014

210

2014

220

2014

230

2014

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat0, \n mapping = aes(x = length_cm, y = as.factor(year), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 2: AI Rock sole size compositions and ridge plot. ](akfin-oracle-sql-r_files/figure-html/test-2-plot-1.png){width=672}\n:::\n:::\n\n\n### Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\n\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

AGE

POPULATION_COUNT

SEX

9

39,371

3

10

32,156

3

11

15,200

3

12

9,976

3

13

1,957

3

1

131,950,343

1

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. ](akfin-oracle-sql-r_files/figure-html/test-3-plot-1.png){width=672}\n:::\n:::\n\n\n### Ex. NBS Pacific cod biomass and abundance\n\nPacific cod biomass and abundance data for the NBS by stratum. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 4: NBS Pacific cod biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

BIOMASS_MT

POPULATION_COUNT

YEAR

AREA_NAME

95,849.983

68,767,498

2021

Inner Domain

107,096.730

102,734,142

2019

Inner Domain

76,708.433

39,605,860

2023

Inner Domain

132,490.152

66,187,245

2017

Inner Domain

96,500.697

60,433,135

2022

Inner Domain

7,462.559

4,724,153

2010

Inner Domain

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 4: NBS Pacific cod biomass and abundance. ](akfin-oracle-sql-r_files/figure-html/test-4-fig-1.png){width=672}\n:::\n:::\n\n\n### Ex. GOA Pacific Ocean perch biomass and line plot\n\nPacific Ocean perch biomass totals for GOA between 1984-2021 from `GAP_PRODUCTS.AKFIN_BIOMASS`\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n```\n:::\n\n::: {.cell tbl-cap='Ex. 5: GOA Pacific Ocean perch biomass and line plot. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

survey_definition_id

biomass_mt

biomass_var

year

biomass_kmt

biomass_kci_up

biomass_kci_dw

47

483,622.6

11,803,384,787

1993

483.6226

700.9093

266.33581

47

771,412.8

41,434,152,202

1996

771.4128

1,178.5204

364.30515

47

727,063.5

150,983,542,178

1999

727.0635

1,504.1955

-50.06854

47

673,155.1

49,285,342,922

2001

673.1551

1,117.1611

229.14901

47

457,421.6

5,186,126,529

2003

457.4216

601.4511

313.39204

47

764,901.4

21,499,807,010

2005

764.9014

1,058.1577

471.64517

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 5: GOA Pacific Ocean perch biomass and line plot. ](akfin-oracle-sql-r_files/figure-html/test-5-fig-1.png){width=672}\n:::\n:::\n\n::: {.cell}\n\n:::\n", + "markdown": "---\ntitle: Access data\nnumber-sections: true\nnumber-depth: 3\n---\n\n\n\n\n## Access data via Oracle (AFSC only) {.unnumbered}\n\nAFSC `Oracle` users can access the database via `SQL developer` to view and pull the production data directly from the `GAP_PRODUCTS` `Oracle` schema. The user can also use `SQL developer` to view and pull the GAP Products data directly from the `GAP_PRODUCTS` `Oracle` schema. \n\n### Connect to Oracle from R\n\nMany users will want to access the data from `Oracle` using `R`. The user will need to install the `RODBC` `R` package and ask OFIS (IT) connect `R` to `Oracle`. Then, use the following code in `R` to establish a connection from `R` to `Oracle`: \n\nHere, the user can establish the oracle connection by entering their username and password in the `channel <- gapindex::oracle_connect()` function. Never save usernames or passwords in scripts that may be intentionally or unintentionally shared with others. If no username and password is entered in the function, pop-ups will appear on the screen asking for the username and password. \n\nAfter you connect to VPN, you'll be able to log into Oracle. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(RODBC)\nchannel <- gapindex::get_connected()\n```\n:::\n\n\n## Data SQL Query Examples: {.unnumbered}\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n```\n:::\n\n\n### Ex. Select all data from tables\n\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. \n\n\n::: {.cell}\n\n```{.r .cell-code}\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n```\n:::\n\n\n### Ex. CPUE for all EBS and NBS stations with associated haul, cruise, and species information.\n\n\n::: {.cell tbl-cap='Ex.: CPUE for all EBS and NBS stations with associated haul, cruise, and species information. '}\n\n```{.r .cell-code}\na <- RODBC::sqlQuery(channel = channel, # NOT RACEBASE.HAUL\n query = paste0(\n\"\n-- Select columns for output data\nSELECT\ncr.CRUISEJOIN,\ncr.CRUISE,\ncr.YEAR,\ncr.SURVEY_DEFINITION_ID,\ncr.SURVEY_NAME,\ncr.VESSEL_ID,\ncr.VESSEL_NAME,\ncp.HAULJOIN,\ncp.SPECIES_CODE,\ntt.SPECIES_NAME,\ntt.COMMON_NAME,\ncp.WEIGHT_KG,\ncp.COUNT,\ncp.AREA_SWEPT_KM2,\ncp.CPUE_KGKM2,\ncp.CPUE_NOKM2,\nhh.HAUL,\nhh.STATION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_HAUL hh\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cr\nON hh.CRUISEJOIN = cr.CRUISEJOIN\nLEFT JOIN GAP_PRODUCTS.AKFIN_CPUE cp\nON hh.HAULJOIN = cp.HAULJOIN\nLEFT JOIN GAP_PRODUCTS.TAXONOMIC_CLASSIFICATION tt\nON cp.SPECIES_CODE = tt.SPECIES_CODE\n\n-- Filter for EBS and NBS observations\nWHERE SURVEY_DEFINITION_ID IN (143, 98) -- 143 NBS, 98 EBS\nAND tt.SURVEY_SPECIES = 1\n\n-- Only return the first 3 rows because otherwise this would be a huge table!\nFETCH FIRST 3 ROWS ONLY;\")) \n\nflextable::flextable(head(a)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

CRUISEJOIN

CRUISE

YEAR

SURVEY_DEFINITION_ID

SURVEY_NAME

VESSEL_ID

VESSEL_NAME

HAULJOIN

SPECIES_CODE

SPECIES_NAME

COMMON_NAME

WEIGHT_KG

COUNT

AREA_SWEPT_KM2

CPUE_KGKM2

CPUE_NOKM2

HAUL

STATION

80

198,203

1,982

98

Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey

1

CHAPMAN

877

1

fish egg unid.

0

0

0.042021

0

0

21

G-10

80

198,203

1,982

98

Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey

1

CHAPMAN

877

2

fish larvae unid.

0

0

0.042021

0

0

21

G-10

80

198,203

1,982

98

Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey

1

CHAPMAN

877

3

fish unid.

0

0

0.042021

0

0

21

G-10

\n```\n:::\n:::\n\n\n### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 8: CPUE for all stations contained in the Shumagin region (AREA_ID = 919). '}\n\n```{.r .cell-code}\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

HAULJOIN

STRATUM

SPECIES_CODE

LATITUDE_DD_START

LONGITUDE_DD_START

CPUE_KGKM2

GEAR_TEMPERATURE_C

-22,270

13

21720

55.11515

-159.3512

209.28994

4.3

-22,250

13

21720

55.05143

-159.9679

8,700.92017

5.1

-22,238

13

21720

55.11365

-159.4264

363.17325

4.4

-22,214

13

21720

54.78608

-160.0008

63.71506

4.6

-22,202

111

21720

54.48341

-159.7261

618.72120

4.7

-22,247

112

21720

55.59093

-160.0740

114.73042

4.0

\n```\n:::\n:::\n\n\n### Ex. EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map \n\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from `GAP_PRODUCTS.AKFIN_CPUE` and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). Here, we'll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their `RACEBASE` analogs. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

CPUE_KGHA

LATITUDE

LONGITUDE

0.00000000

60.67043

-178.0946

0.00000000

60.31361

-176.0138

0.00000000

60.35098

-175.3850

0.00000000

60.99712

-177.6638

0.00000000

60.96495

-176.2634

0.02416379

58.97844

-175.7204

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n```\n\n::: {.cell-output-display}\n![Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. ](akfin-oracle-sql-r_files/figure-html/test-6-fig-1.png){width=672}\n:::\n:::\n\n\n### Ex. GOA Pacific Ocean perch biomass and abundance\n\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 1: GOA Pacific Ocean perch biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

BIOMASS_MT

POPULATION_COUNT

YEAR

DESCRIPTION

157,295.1

317,129,408

1990

GOA Region: All Strata

157,295.1

317,129,408

1990

GOA Region: All Strata

483,622.6

833,902,161

1993

GOA Region: All Strata

483,622.6

833,902,161

1993

GOA Region: All Strata

771,412.8

1,252,616,603

1996

GOA Region: All Strata

771,412.8

1,252,616,603

1996

GOA Region: All Strata

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 1: GOA Pacific Ocean perch biomass and abundance. ](akfin-oracle-sql-r_files/figure-html/test-1-plot-1.png){width=672}\n:::\n:::\n\n\n### Ex. AI rock sole size compositions and ridge plot\n\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from [`ggridges`](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html).\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 2: AI Rock sole size compositions and ridge plot. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10) %>% \n head() %>% \n flextable::flextable() %>% \n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\ndat0\n```\n\n::: {.cell-output-display}\n```{=html}\n

length_mm

year

length_cm

110

1997

11

130

1997

13

140

1997

14

150

1997

15

160

1997

16

170

1997

17

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat, \n mapping = aes(x = LENGTH_MM, y = as.factor(YEAR), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 2: AI Rock sole size compositions and ridge plot. ](akfin-oracle-sql-r_files/figure-html/test-2-plot-1.png){width=672}\n:::\n:::\n\n\n### Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\n\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=html}\n

AGE

POPULATION_COUNT

SEX

11

48,791,451

2

12

120,673,580

2

13

42,580,054

2

14

47,229,378

2

15

25,140,523

2

16

19,473,255

2

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. ](akfin-oracle-sql-r_files/figure-html/test-3-plot-1.png){width=672}\n:::\n:::\n\n\n### Ex. NBS Pacific cod biomass and abundance\n\nPacific cod biomass and abundance data for the NBS by stratum. \n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 4: NBS Pacific cod biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

BIOMASS_MT

POPULATION_COUNT

YEAR

AREA_NAME

7,462.559

4,724,153

2010

Inner Domain

95,849.983

68,767,498

2021

Inner Domain

107,096.730

102,734,142

2019

Inner Domain

76,708.433

39,605,860

2023

Inner Domain

132,490.152

66,187,245

2017

Inner Domain

96,500.697

60,433,135

2022

Inner Domain

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 4: NBS Pacific cod biomass and abundance. ](akfin-oracle-sql-r_files/figure-html/test-4-fig-1.png){width=672}\n:::\n:::\n\n\n### Ex. GOA Pacific Ocean perch biomass and line plot\n\nPacific Ocean perch biomass totals for GOA between 1984-2021 from `GAP_PRODUCTS.AKFIN_BIOMASS`\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n```\n:::\n\n::: {.cell tbl-cap='Ex. 5: GOA Pacific Ocean perch biomass and line plot. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

survey_definition_id

biomass_mt

biomass_var

year

biomass_kmt

biomass_kci_up

biomass_kci_dw

47

157,295.1

2,221,176,968

1990

157.2951

251.5538

63.03638

47

483,622.6

11,803,384,787

1993

483.6226

700.9093

266.33581

47

771,412.8

41,434,152,202

1996

771.4128

1,178.5204

364.30515

47

727,063.5

150,983,542,178

1999

727.0635

1,504.1955

-50.06854

47

673,155.1

49,285,342,922

2001

673.1551

1,117.1611

229.14901

47

457,421.6

5,186,126,529

2003

457.4216

601.4511

313.39204

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 5: GOA Pacific Ocean perch biomass and line plot. ](akfin-oracle-sql-r_files/figure-html/test-5-fig-1.png){width=672}\n:::\n:::\n\n::: {.cell}\n\n:::\n", "supporting": [ "akfin-oracle-sql-r_files\\figure-html" ], diff --git a/_freeze/content/akfin-oracle-sql-r/execute-results/tex.json b/_freeze/content/akfin-oracle-sql-r/execute-results/tex.json index 97ee5c6..b29e5b5 100644 --- a/_freeze/content/akfin-oracle-sql-r/execute-results/tex.json +++ b/_freeze/content/akfin-oracle-sql-r/execute-results/tex.json @@ -1,7 +1,7 @@ { - "hash": "6ca4dec388d9bb5ed42dd65c29ee5da6", + "hash": "e95dda4032f9d6c0c84201c12b9852cc", "result": { - "markdown": "---\ntitle: Access data\nnumber-sections: true\nnumber-depth: 3\n---\n\n\n\n\n\n## Access data via Oracle (AFSC only) {.unnumbered}\n\nAFSC `Oracle` users can access the database via `SQL developer` to view and pull the production data directly from the `GAP_PRODUCTS` `Oracle` schema. The user can also use `SQL developer` to view and pull the GAP Products data directly from the `GAP_PRODUCTS` `Oracle` schema. \n\n### Connect to Oracle from R\n\nMany users will want to access the data from `Oracle` using `R`. The user will need to install the `RODBC` `R` package and ask OFIS (IT) connect `R` to `Oracle`. Then, use the following code in `R` to establish a connection from `R` to `Oracle`: \n\nHere, the user can establish the oracle connection by entering their username and password in the `channel <- gapindex::oracle_connect()` function. Never save usernames or passwords in scripts that may be intentionally or unintentionally shared with others. If no username and password is entered in the function, pop-ups will appear on the screen asking for the username and password. \n\nAfter you connect to VPN, you'll be able to log into Oracle. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(RODBC)\nchannel <- gapindex::get_connected()\n```\n:::\n\n\n\n## Data SQL Query Examples: {.unnumbered}\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n```\n:::\n\n\n\n### Ex. Select all data from a table\n\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n```\n:::\n\n::: {.cell}\n\n:::\n\n::: {.cell}\n\n:::\n\n::: {.cell tbl-cap='Ex. 7: Summary table of Number hauls where species were observed (N_HAULS) and number of length measurements that were colelcted for this species (N_LENGTHS) for EBS and NBS, for arrowtooth flounder (10110), Bering flounder (10140), and Alaska skate (435). '}\n\n:::\n\n\n\n### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 8: CPUE for all stations contained in the Shumagin region (AREA_ID = 919). '}\n\n```{.r .cell-code}\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAULJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{STRATUM}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_CODE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{GEAR\\_TEMPERATURE\\_C}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAULJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{STRATUM}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_CODE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{GEAR\\_TEMPERATURE\\_C}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,239}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{12}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{55.43748}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-160.1269}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{717.63085}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.5}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,215}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.58732}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-161.1945}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{76.90763}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,168}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{11}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.45823}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-163.0872}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2,004.49628}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.9}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,204}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{110}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.51804}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-160.7493}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.7}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,188}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{210}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.38733}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-159.6986}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.5}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,183}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{210}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.09314}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-161.6996}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n### Ex. EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map \n\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from `GAP_PRODUCTS.AKFIN_CPUE` and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). Here, we'll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their `RACEBASE` analogs. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGHA}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGHA}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.0000000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{58.75863}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-174.9285}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.2813533}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{57.32545}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-173.3217}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.0000000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{57.64161}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-172.7963}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.0000000}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{59.67831}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-172.5754}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.0000000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60.96936}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-174.8760}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.0000000}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{58.64012}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-173.5922}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n```\n\n::: {.cell-output-display}\n![Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. ](akfin-oracle-sql-r_files/figure-pdf/test-6-fig-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and abundance\n\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 1: GOA Pacific Ocean perch biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{DESCRIPTION}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{DESCRIPTION}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483,622.6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{833,902,161}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1993}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483,622.6}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{833,902,161}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1993}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771,412.8}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,252,616,603}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1996}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771,412.8}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,252,616,603}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1996}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{727,063.5}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,212,034,913}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1999}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{727,063.5}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,212,034,913}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1999}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 1: GOA Pacific Ocean perch biomass and abundance. ](akfin-oracle-sql-r_files/figure-pdf/test-1-plot-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. AI rock sole size compositions and ridge plot\n\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from [`ggridges`](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html).\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 2: AI Rock sole size compositions and ridge plot. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10)\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LENGTH\\_MM}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LENGTH\\_MM}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{180}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2014}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{190}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2014}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2014}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{210}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2014}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{220}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2014}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{230}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2014}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat0, \n mapping = aes(x = length_cm, y = as.factor(year), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 2: AI Rock sole size compositions and ridge plot. ](akfin-oracle-sql-r_files/figure-pdf/test-2-plot-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\n\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AGE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SEX}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AGE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SEX}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{9}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{39,371}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{32,156}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{11}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{15,200}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{12}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{9,976}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,957}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{131,950,343}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. ](akfin-oracle-sql-r_files/figure-pdf/test-3-plot-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. NBS Pacific cod biomass and abundance\n\nPacific cod biomass and abundance data for the NBS by stratum. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 4: NBS Pacific cod biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AREA\\_NAME}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AREA\\_NAME}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{95,849.983}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{68,767,498}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2021}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{107,096.730}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{102,734,142}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2019}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{76,708.433}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{39,605,860}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2023}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{132,490.152}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{66,187,245}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2017}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{96,500.697}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60,433,135}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,462.559}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4,724,153}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2010}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 4: NBS Pacific cod biomass and abundance. ](akfin-oracle-sql-r_files/figure-pdf/test-4-fig-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and line plot\n\nPacific Ocean perch biomass totals for GOA between 1984-2021 from `GAP_PRODUCTS.AKFIN_BIOMASS`\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n```\n:::\n\n::: {.cell tbl-cap='Ex. 5: GOA Pacific Ocean perch biomass and line plot. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_definition\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_mt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_var}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kmt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_up}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_dw}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_definition\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_mt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_var}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kmt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_up}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_dw}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483,622.6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{11,803,384,787}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1993}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483.6226}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{700.9093}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{266.33581}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771,412.8}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{41,434,152,202}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1996}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771.4128}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,178.5204}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{364.30515}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{727,063.5}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{150,983,542,178}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1999}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{727.0635}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,504.1955}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-50.06854}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{673,155.1}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{49,285,342,922}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2001}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{673.1551}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,117.1611}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{229.14901}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{457,421.6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5,186,126,529}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2003}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{457.4216}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{601.4511}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{313.39204}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{764,901.4}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21,499,807,010}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2005}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{764.9014}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,058.1577}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{471.64517}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 5: GOA Pacific Ocean perch biomass and line plot. ](akfin-oracle-sql-r_files/figure-pdf/test-5-fig-1.pdf){fig-pos='H'}\n:::\n:::\n\n::: {.cell}\n\n:::\n", + "markdown": "---\ntitle: Access data\nnumber-sections: true\nnumber-depth: 3\n---\n\n\n\n\n\n## Access data via Oracle (AFSC only) {.unnumbered}\n\nAFSC `Oracle` users can access the database via `SQL developer` to view and pull the production data directly from the `GAP_PRODUCTS` `Oracle` schema. The user can also use `SQL developer` to view and pull the GAP Products data directly from the `GAP_PRODUCTS` `Oracle` schema. \n\n### Connect to Oracle from R\n\nMany users will want to access the data from `Oracle` using `R`. The user will need to install the `RODBC` `R` package and ask OFIS (IT) connect `R` to `Oracle`. Then, use the following code in `R` to establish a connection from `R` to `Oracle`: \n\nHere, the user can establish the oracle connection by entering their username and password in the `channel <- gapindex::oracle_connect()` function. Never save usernames or passwords in scripts that may be intentionally or unintentionally shared with others. If no username and password is entered in the function, pop-ups will appear on the screen asking for the username and password. \n\nAfter you connect to VPN, you'll be able to log into Oracle. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(RODBC)\nchannel <- gapindex::get_connected()\n```\n:::\n\n\n\n## Data SQL Query Examples: {.unnumbered}\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n```\n:::\n\n\n\n### Ex. Select all data from tables\n\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n```\n:::\n\n\n\n### Ex. CPUE for all EBS and NBS stations with associated haul, cruise, and species information.\n\n\n\n::: {.cell tbl-cap='Ex.: CPUE for all EBS and NBS stations with associated haul, cruise, and species information. '}\n\n```{.r .cell-code}\na <- RODBC::sqlQuery(channel = channel, # NOT RACEBASE.HAUL\n query = paste0(\n\"\n-- Select columns for output data\nSELECT\ncr.CRUISEJOIN,\ncr.CRUISE,\ncr.YEAR,\ncr.SURVEY_DEFINITION_ID,\ncr.SURVEY_NAME,\ncr.VESSEL_ID,\ncr.VESSEL_NAME,\ncp.HAULJOIN,\ncp.SPECIES_CODE,\ntt.SPECIES_NAME,\ntt.COMMON_NAME,\ncp.WEIGHT_KG,\ncp.COUNT,\ncp.AREA_SWEPT_KM2,\ncp.CPUE_KGKM2,\ncp.CPUE_NOKM2,\nhh.HAUL,\nhh.STATION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_HAUL hh\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cr\nON hh.CRUISEJOIN = cr.CRUISEJOIN\nLEFT JOIN GAP_PRODUCTS.AKFIN_CPUE cp\nON hh.HAULJOIN = cp.HAULJOIN\nLEFT JOIN GAP_PRODUCTS.TAXONOMIC_CLASSIFICATION tt\nON cp.SPECIES_CODE = tt.SPECIES_CODE\n\n-- Filter for EBS and NBS observations\nWHERE SURVEY_DEFINITION_ID IN (143, 98) -- 143 NBS, 98 EBS\nAND tt.SURVEY_SPECIES = 1\n\n-- Only return the first 3 rows because otherwise this would be a huge table!\nFETCH FIRST 3 ROWS ONLY;\")) \n\nflextable::flextable(head(a)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CRUISEJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CRUISE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SURVEY\\_DEFINITION\\_ID}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SURVEY\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{VESSEL\\_ID}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{VESSEL\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAULJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_CODE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{COMMON\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{WEIGHT\\_KG}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AREA\\_SWEPT\\_KM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_NOKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAUL}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{STATION}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CRUISEJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CRUISE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SURVEY\\_DEFINITION\\_ID}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SURVEY\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{VESSEL\\_ID}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{VESSEL\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAULJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_CODE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{COMMON\\_NAME}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{WEIGHT\\_KG}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AREA\\_SWEPT\\_KM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_NOKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAUL}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{STATION}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{80}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{198,203}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,982}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{98}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Eastern\\ Bering\\ Sea\\ Crab/Groundfish\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{CHAPMAN}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{877}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{fish\\ egg\\ unid.}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.042021}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{G-10}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{80}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{198,203}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,982}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{98}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Eastern\\ Bering\\ Sea\\ Crab/Groundfish\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{CHAPMAN}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{877}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{fish\\ larvae\\ unid.}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.042021}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{G-10}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{80}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{198,203}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,982}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{98}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Eastern\\ Bering\\ Sea\\ Crab/Groundfish\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{CHAPMAN}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{877}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{fish\\ unid.}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.042021}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{G-10}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 8: CPUE for all stations contained in the Shumagin region (AREA_ID = 919). '}\n\n```{.r .cell-code}\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAULJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{STRATUM}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_CODE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{GEAR\\_TEMPERATURE\\_C}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{HAULJOIN}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{STRATUM}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SPECIES\\_CODE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE\\_DD\\_START}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGKM2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{GEAR\\_TEMPERATURE\\_C}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,270}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{55.11515}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-159.3512}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{209.28994}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.3}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,250}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{55.05143}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-159.9679}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{8,700.92017}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.1}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,238}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{55.11365}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-159.4264}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{363.17325}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.4}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,214}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.78608}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-160.0008}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{63.71506}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.6}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,202}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{111}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{54.48341}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-159.7261}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{618.72120}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.7}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-22,247}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{112}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21720}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{55.59093}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-160.0740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{114.73042}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.0}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n### Ex. EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map \n\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from `GAP_PRODUCTS.AKFIN_CPUE` and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). Here, we'll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their `RACEBASE` analogs. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGHA}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{CPUE\\_KGHA}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LATITUDE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{LONGITUDE}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60.67043}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-178.0946}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000000}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60.31361}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-176.0138}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60.35098}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-175.3850}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000000}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60.99712}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-177.6638}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.00000000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{60.96495}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-176.2634}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.02416379}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{58.97844}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-175.7204}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n```\n\n::: {.cell-output-display}\n![Ex. 6: EBS Pacific Ocean perch CPUE and [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps) map. ](akfin-oracle-sql-r_files/figure-pdf/test-6-fig-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and abundance\n\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 1: GOA Pacific Ocean perch biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{DESCRIPTION}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{DESCRIPTION}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{157,295.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{317,129,408}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1990}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{157,295.1}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{317,129,408}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1990}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483,622.6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{833,902,161}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1993}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483,622.6}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{833,902,161}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1993}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771,412.8}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,252,616,603}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1996}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771,412.8}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,252,616,603}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1996}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{GOA\\ Region:\\ All\\ Strata}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 1: GOA Pacific Ocean perch biomass and abundance. ](akfin-oracle-sql-r_files/figure-pdf/test-1-plot-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. AI rock sole size compositions and ridge plot\n\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from [`ggridges`](https://cran.r-project.org/web/packages/ggridges/vignettes/introduction.html).\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 2: AI Rock sole size compositions and ridge plot. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10) %>% \n head() %>% \n flextable::flextable() %>% \n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\ndat0\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{length\\_mm}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{length\\_cm}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{length\\_mm}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{length\\_cm}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{110}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1997}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{11}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{130}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1997}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{140}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1997}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{14}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{150}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1997}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{15}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{160}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1997}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{170}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1997}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{17}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat, \n mapping = aes(x = LENGTH_MM, y = as.factor(YEAR), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 2: AI Rock sole size compositions and ridge plot. ](akfin-oracle-sql-r_files/figure-pdf/test-2-plot-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\n\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AGE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SEX}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AGE}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{SEX}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{11}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{48,791,451}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{12}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{120,673,580}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{13}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{42,580,054}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{14}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47,229,378}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{15}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{25,140,523}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{19,473,255}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid. ](akfin-oracle-sql-r_files/figure-pdf/test-3-plot-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. NBS Pacific cod biomass and abundance\n\nPacific cod biomass and abundance data for the NBS by stratum. \n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n```\n:::\n\n::: {.cell tbl-cap='Ex. 4: NBS Pacific cod biomass and abundance. '}\n\n```{.r .cell-code}\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AREA\\_NAME}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{BIOMASS\\_MT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{POPULATION\\_COUNT}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{YEAR}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{AREA\\_NAME}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,462.559}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4,724,153}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2010}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,462.559}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4,724,153}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2010}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,462.559}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4,724,153}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2010}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,462.559}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4,724,153}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2010}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,462.559}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4,724,153}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2010}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{95,849.983}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{68,767,498}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2021}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Inner\\ Domain}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 4: NBS Pacific cod biomass and abundance. ](akfin-oracle-sql-r_files/figure-pdf/test-4-fig-1.pdf){fig-pos='H'}\n:::\n:::\n\n\n\n### Ex. GOA Pacific Ocean perch biomass and line plot\n\nPacific Ocean perch biomass totals for GOA between 1984-2021 from `GAP_PRODUCTS.AKFIN_BIOMASS`\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n```\n:::\n\n::: {.cell tbl-cap='Ex. 5: GOA Pacific Ocean perch biomass and line plot. '}\n\n```{.r .cell-code}\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_definition\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_mt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_var}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kmt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_up}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_dw}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_definition\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_mt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_var}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kmt}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_up}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{biomass\\_kci\\_dw}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{157,295.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2,221,176,968}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1990}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{157.2951}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{251.5538}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{63.03638}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483,622.6}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{11,803,384,787}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1993}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{483.6226}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{700.9093}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{266.33581}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771,412.8}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{41,434,152,202}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1996}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{771.4128}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,178.5204}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{364.30515}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{727,063.5}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{150,983,542,178}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1999}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{727.0635}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,504.1955}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-50.06854}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{673,155.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{49,285,342,922}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2001}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{673.1551}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,117.1611}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{229.14901}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{47}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{457,421.6}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5,186,126,529}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2003}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{457.4216}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{601.4511}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{313.39204}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n```\n\n::: {.cell-output-display}\n![Ex. 5: GOA Pacific Ocean perch biomass and line plot. ](akfin-oracle-sql-r_files/figure-pdf/test-5-fig-1.pdf){fig-pos='H'}\n:::\n:::\n\n::: {.cell}\n\n:::\n", "supporting": [ "akfin-oracle-sql-r_files\\figure-pdf" ], @@ -11,7 +11,7 @@ "includes": {}, "engineDependencies": { "knitr": [ - "{\"type\":\"list\",\"attributes\":{\"knit_meta_id\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\"]}},\"value\":[{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"booktabs\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"pdflscape\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"tabu\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"threeparttable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"threeparttablex\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"ulem\"]},{\"type\":\"character\",\"attributes\":{},\"value\":[\"normalem\"]},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"makecell\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"xcolor\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]}]}" + "{\"type\":\"list\",\"attributes\":{\"knit_meta_id\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-7\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-8-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-6-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-1-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-2-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-3-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-4-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\",\"test-5-tbl\"]}},\"value\":[{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"booktabs\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"pdflscape\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"tabu\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"threeparttable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"threeparttablex\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"ulem\"]},{\"type\":\"character\",\"attributes\":{},\"value\":[\"normalem\"]},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"makecell\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"xcolor\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"fontspec\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multirow\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"multicol\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"colortbl\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hhline\"]},{\"type\":\"NULL\"},{\"type\":\"character\",\"attributes\":{},\"value\":[\"\\\\newlength\\\\Oldarrayrulewidth\",\"\\\\newlength\\\\Oldtabcolsep\"]}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"longtable\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"array\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"hyperref\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"float\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]},{\"type\":\"list\",\"attributes\":{\"names\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"name\",\"options\",\"extra_lines\"]},\"class\":{\"type\":\"character\",\"attributes\":{},\"value\":[\"latex_dependency\"]}},\"value\":[{\"type\":\"character\",\"attributes\":{},\"value\":[\"wrapfig\"]},{\"type\":\"NULL\"},{\"type\":\"NULL\"}]}]}" ] }, "preserve": null, diff --git a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-1-plot-1.png b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-1-plot-1.png index 1036fb0..07e390d 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-1-plot-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-1-plot-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-2-plot-1.png b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-2-plot-1.png index 613138d..3e36dc5 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-2-plot-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-2-plot-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-3-plot-1.png b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-3-plot-1.png index b1d4477..4bd0b69 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-3-plot-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-3-plot-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-4-fig-1.png b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-4-fig-1.png index e01b292..b5e3d17 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-4-fig-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-4-fig-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-5-fig-1.png b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-5-fig-1.png index 38f7a00..05b33ba 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-docx/test-5-fig-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-docx/test-5-fig-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-html/test-1-plot-1.png b/_freeze/content/akfin-oracle-sql-r/figure-html/test-1-plot-1.png index 4b5f98a..90e4e90 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-html/test-1-plot-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-html/test-1-plot-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-html/test-2-plot-1.png b/_freeze/content/akfin-oracle-sql-r/figure-html/test-2-plot-1.png index 5ed3d99..f7407a7 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-html/test-2-plot-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-html/test-2-plot-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-html/test-3-plot-1.png b/_freeze/content/akfin-oracle-sql-r/figure-html/test-3-plot-1.png index 979c8cc..12edd76 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-html/test-3-plot-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-html/test-3-plot-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-html/test-4-fig-1.png b/_freeze/content/akfin-oracle-sql-r/figure-html/test-4-fig-1.png index e220d08..e1a455b 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-html/test-4-fig-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-html/test-4-fig-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-html/test-5-fig-1.png b/_freeze/content/akfin-oracle-sql-r/figure-html/test-5-fig-1.png index caded95..bcb96c9 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-html/test-5-fig-1.png and b/_freeze/content/akfin-oracle-sql-r/figure-html/test-5-fig-1.png differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-1-plot-1.pdf b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-1-plot-1.pdf index 784351a..5587735 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-1-plot-1.pdf and b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-1-plot-1.pdf differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-2-plot-1.pdf b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-2-plot-1.pdf index d5edc11..ef82bfd 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-2-plot-1.pdf and b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-2-plot-1.pdf differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-3-plot-1.pdf b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-3-plot-1.pdf index 26794a6..1dfe52e 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-3-plot-1.pdf and b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-3-plot-1.pdf differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-4-fig-1.pdf b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-4-fig-1.pdf index 9d8cc0d..1ecb192 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-4-fig-1.pdf and b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-4-fig-1.pdf differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-5-fig-1.pdf b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-5-fig-1.pdf index 66c9279..1e87c4c 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-5-fig-1.pdf and b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-5-fig-1.pdf differ diff --git a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-6-fig-1.pdf b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-6-fig-1.pdf index 0a2934d..0b8f4c6 100644 Binary files a/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-6-fig-1.pdf and b/_freeze/content/akfin-oracle-sql-r/figure-pdf/test-6-fig-1.pdf differ diff --git a/_freeze/content/foss-api-r/execute-results/docx.json b/_freeze/content/foss-api-r/execute-results/docx.json index 18cc299..db244b0 100644 --- a/_freeze/content/foss-api-r/execute-results/docx.json +++ b/_freeze/content/foss-api-r/execute-results/docx.json @@ -1,7 +1,7 @@ { - "hash": "2eb6f941b64730743e5c01ae71e268dd", + "hash": "9b419c3eb2cb72acb9b71d1fec7c1dac", "result": { - "markdown": "---\ntitle: Access via API and R\n---\n\n\n\n\n\n\nAn application programming interface (API) is a way for two or more computer programs to communicate with each other.\n\nMore information about how to amend API links can be found [here](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/22.3/books.html#AELIG90103/). Useful introductions to using APIs in `R` can be found [here](https://www.dataquest.io/blog/r-api-tutorial/). \n\n## Ex. 1: Load the first 25 rows (default) of data\n\n\n\n\n::: {.cell tbl-cap='Ex. 1: Load the first 25 rows (default) of data. '}\n\n```{.r .cell-code}\n # install.packages(c(\"httr\", \"jsonlite\"))\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(dplyr)\n\n # link to the API\napi_link <- \"https://apps-st.fisheries.noaa.gov/ods/foss/afsc_groundfish_survey/\"\n\nres <- httr::GET(url = api_link)\n # res # Test connection\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n # names(data)\ntibble::as_tibble(data$items) %>% \n dplyr::mutate_if(is.character, type.convert, as.is = TRUE) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n head(3) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"cruise\", \"species_code\", \"tsn\", \"ak_survey_id\"), big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvysurveysurvey_idcruisehaulstratumstationvessel_namevessel_iddate_timelatitude_ddlongitude_ddspecies_codecommon_namescientific_nametaxon_confidencecpue_kghacpue_kgkm2cpue_kg1000km2cpue_nohacpue_nokm2cpue_no1000km2weight_kgcountbottom_temperature_csurface_temperature_cdepth_mdistance_fished_kmnet_width_mnet_height_marea_swept_haduration_hrtsnak_survey_idlinksbody12002AIAleutian Islands Bottom Trawl Survey522002016722307-63Vesteraalen9405/17/2002 18:56:5853.737-167.01695020feathery bryozoanEucratea loricataLow0.0171.7491,749.4450.04404.15.31871.56116.1127.252.5150.281558091917453[[data.frame]]body22002AIAleutian Islands Bottom Trawl Survey522002016722307-63Vesteraalen9405/17/2002 18:56:5853.737-167.01679000squid unid.DecapodiformesHigh0.0222.2272,226.5673.181318.081318,080.930.05684.15.31871.56116.1127.252.5150.281917454[[data.frame]]body32002AIAleutian Islands Bottom Trawl Survey522002016722307-63Vesteraalen9405/17/2002 18:56:5853.737-167.01624191shortfin eelpoutLycodes brevipesHigh0.0363.5783,578.4100.79579.52079,520.230.09024.15.31871.56116.1127.252.5150.281652581917455[[data.frame]]\n``````\n:::\n:::\n\n\n\n\n## Ex. 2: Load the first 10000 rows of data\n\n\n\n\n::: {.cell tbl-cap='Ex. 2: Load the first 10000 rows of data. '}\n\n```{.r .cell-code}\n# Not run because too big:\nres <- httr::GET(url = paste0(api_link, \"?offset=0&limit=10000\"))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\nprint(paste0(\"rows: \", dim(data$items)[1], \"; cols: \", dim(data$items)[2]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] \"rows: 10000; cols: 36\"\n```\n:::\n:::\n\n\n\n\n## Ex. 3: Filter by Year\n\nShow all the data greater than the year 2020. \n\n\n\n\n::: {.cell tbl-cap='Ex. 3: Filter by Year. '}\n\n```{.r .cell-code}\nres <- httr::GET(url = paste0(api_link, '?q={\"year\":{\"$gt\":2020}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body12022AI793805400.361body22022AI7934010.903body32022AI793200061.661\n``````\n:::\n:::\n\n\n\n\n## Ex. 4: Filter by species name\n\nShow all the data where the product name contains pollock Please note that here the word pollock is case sensitive.\n\nThe notation for finding a string is to use % around it. Since % is a reserved character in a URL, you have to replace `%` with `%25`. \n\n\n\n\n::: {.cell tbl-cap='Ex. 4: Filter by species name. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body12002AI72221740775.322body22002AI7222174010,685.806body32002AI721217400.640\n``````\n:::\n:::\n\n\n\n\n## Ex. 5: Combination of year and name filters\n\nShow all the data where years > 2020 and the product name contains pollock\n\n\n\n\n::: {.cell tbl-cap='Ex. 5: Combination of year and name filters. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, \n '?q={\"year\":{\"$gt\":2020},\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body12022AI793217407,853.632body22022AI721217407,235.010body32022AI7222174022,754.334\n``````\n:::\n:::\n\n\n\n\n## Ex. 6: Combination of year, srvy, stratum\n\nShow all the data where year = 1989, srvy = \"EBS\", and stratum is not equal to 81\n\n\n\n\n::: {.cell tbl-cap='Ex. 6: Combination of year, srvy, stratum. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":1989,\"srvy\":\"EBS\",\"stratum\":{\"$ne\":\"81\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body11989EBS10665481.164body21989EBS10693221.164body31989EBS10430002.353\n``````\n:::\n:::\n\n\n\n\n## Ex. 7: Visualize CPUE data in distribution map\n\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). \n\n\n\n\n::: {.cell tbl-cap='Ex. 7: Visualize CPUE data in distribution map. '}\n\n```{.r .cell-code}\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1stratumstationlatitude_ddlongitude_ddcpue_kgkm2body18161.66434-172.26552,895.258body28162.33740-173.17021,235.545body37062.03713-171.65280.000\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n```\n\n::: {.cell-output-display}\n![Ex. 7: Visualize CPUE data in distribution map. ](foss-api-r_files/figure-docx/test-7-fig-1.png)\n:::\n:::\n", + "markdown": "---\ntitle: Access via API and R\n---\n\n\n\n\n\n\nAn application programming interface (API) is a way for two or more computer programs to communicate with each other.\n\nMore information about how to amend API links can be found [here](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/22.3/books.html#AELIG90103/). Useful introductions to using APIs in `R` can be found [here](https://www.dataquest.io/blog/r-api-tutorial/). \n\n## Ex. 1: Load the first 25 rows (default) of data\n\n\n\n\n::: {.cell tbl-cap='Ex. 1: Load the first 25 rows (default) of data. '}\n\n```{.r .cell-code}\n # install.packages(c(\"httr\", \"jsonlite\"))\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(dplyr)\n\n # link to the API\napi_link <- \"https://apps-st.fisheries.noaa.gov/ods/foss/afsc_groundfish_survey/\"\n\nres <- httr::GET(url = api_link)\n # res # Test connection\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n # names(data)\ntibble::as_tibble(data$items) %>% \n dplyr::mutate_if(is.character, type.convert, as.is = TRUE) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n head(3) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"cruise\", \"species_code\", \"tsn\", \"ak_survey_id\"), big.mark = \"\")\n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvysurveysurvey_idcruisehaulstratumstationvessel_namevessel_iddate_timelatitude_ddlongitude_ddspecies_codecommon_namescientific_nametaxon_confidencecpue_kghacpue_kgkm2cpue_kg1000km2cpue_nohacpue_nokm2cpue_no1000km2weight_kgcountbottom_temperature_csurface_temperature_cdepth_mdistance_fished_kmnet_width_mnet_height_marea_swept_haduration_hrtsnak_survey_idlinksbody12002AIAleutian Islands Bottom Trawl Survey522002016722307-63Vesteraalen9405/17/2002 18:56:5853.737-167.01695020feathery bryozoanEucratea loricataLow0.0171.7491,749.4450.04404.15.31871.56116.1127.252.5150.281558091917453[[data.frame]]body22002AIAleutian Islands Bottom Trawl Survey522002016722307-63Vesteraalen9405/17/2002 18:56:5853.737-167.01679000squid unid.DecapodiformesHigh0.0222.2272,226.5673.181318.081318,080.930.05684.15.31871.56116.1127.252.5150.281917454[[data.frame]]body32002AIAleutian Islands Bottom Trawl Survey522002016722307-63Vesteraalen9405/17/2002 18:56:5853.737-167.01624191shortfin eelpoutLycodes brevipesHigh0.0363.5783,578.4100.79579.52079,520.230.09024.15.31871.56116.1127.252.5150.281652581917455[[data.frame]]\n``````\n:::\n:::\n\n\n\n\n## Ex. 2: Load the first 10000 rows of data\n\n\n\n\n::: {.cell tbl-cap='Ex. 2: Load the first 10000 rows of data. '}\n\n```{.r .cell-code}\n# Not run because too big:\nres <- httr::GET(url = paste0(api_link, \"?offset=0&limit=10000\"))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\nprint(paste0(\"rows: \", dim(data$items)[1], \"; cols: \", dim(data$items)[2]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] \"rows: 10000; cols: 36\"\n```\n:::\n:::\n\n\n\n\n## Ex. 3: Filter by Year\n\nShow all the data greater than the year 2020. \n\n\n\n\n::: {.cell tbl-cap='Ex. 3: Filter by Year. '}\n\n```{.r .cell-code}\nres <- httr::GET(url = paste0(api_link, '?q={\"year\":{\"$gt\":2020}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body12022AI793805400.361body22022AI7934010.903body32022AI793200061.661\n``````\n:::\n:::\n\n\n\n\n## Ex. 4: Filter by species name\n\nShow all the data where the product name contains pollock Please note that here the word pollock is case sensitive.\n\nThe notation for finding a string is to use % around it. Since % is a reserved character in a URL, you have to replace `%` with `%25`. \n\n\n\n\n::: {.cell tbl-cap='Ex. 4: Filter by species name. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body12002AI72221740775.322body22002AI7222174010,685.806body32002AI721217400.640\n``````\n:::\n:::\n\n\n\n\n## Ex. 5: Combination of year and name filters\n\nShow all the data where years > 2020 and the product name contains pollock\n\n\n\n\n::: {.cell tbl-cap='Ex. 5: Combination of year and name filters. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, \n '?q={\"year\":{\"$gt\":2020},\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body12022AI793217407,853.632body22022AI721217407,235.010body32022AI7222174022,754.334\n``````\n:::\n:::\n\n\n\n\n## Ex. 6: Combination of year, srvy, stratum\n\nShow all the data where year = 1989, srvy = \"EBS\", and stratum is not equal to 81\n\n\n\n\n::: {.cell tbl-cap='Ex. 6: Combination of year, srvy, stratum. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":1989,\"srvy\":\"EBS\",\"stratum\":{\"$ne\":\"81\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1yearsrvystratumspecies_codecpue_kgkm2body11989EBS10665481.164body21989EBS10693221.164body31989EBS10430002.353\n``````\n:::\n:::\n\n\n\n\n## Ex. 7: Visualize CPUE data in distribution map\n\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). \n\n\n\n\n::: {.cell tbl-cap='Ex. 7: Visualize CPUE data in distribution map. '}\n\n```{.r .cell-code}\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n```\n\n::: {.cell-output-display}\n``````{=openxml}\n\nheader1stratumstationlatitude_ddlongitude_ddcpue_kgkm2body18161.66434-172.26552,895.258body28162.33740-173.17021,235.545body37062.03713-171.65280.000\n``````\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000))$plot + # 20x20km grid\n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n:::\n", "supporting": [ "foss-api-r_files\\figure-docx" ], diff --git a/_freeze/content/foss-api-r/execute-results/html.json b/_freeze/content/foss-api-r/execute-results/html.json index 2e11071..947838a 100644 --- a/_freeze/content/foss-api-r/execute-results/html.json +++ b/_freeze/content/foss-api-r/execute-results/html.json @@ -1,9 +1,9 @@ { - "hash": "2eb6f941b64730743e5c01ae71e268dd", + "hash": "9b419c3eb2cb72acb9b71d1fec7c1dac", "result": { - "markdown": "---\ntitle: Access via API and R\n---\n\n\n\n\nAn application programming interface (API) is a way for two or more computer programs to communicate with each other.\n\nMore information about how to amend API links can be found [here](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/22.3/books.html#AELIG90103/). Useful introductions to using APIs in `R` can be found [here](https://www.dataquest.io/blog/r-api-tutorial/). \n\n## Ex. 1: Load the first 25 rows (default) of data\n\n\n::: {.cell tbl-cap='Ex. 1: Load the first 25 rows (default) of data. '}\n\n```{.r .cell-code}\n # install.packages(c(\"httr\", \"jsonlite\"))\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(dplyr)\n\n # link to the API\napi_link <- \"https://apps-st.fisheries.noaa.gov/ods/foss/afsc_groundfish_survey/\"\n\nres <- httr::GET(url = api_link)\n # res # Test connection\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n # names(data)\ntibble::as_tibble(data$items) %>% \n dplyr::mutate_if(is.character, type.convert, as.is = TRUE) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n head(3) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"cruise\", \"species_code\", \"tsn\", \"ak_survey_id\"), big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

survey

survey_id

cruise

haul

stratum

station

vessel_name

vessel_id

date_time

latitude_dd

longitude_dd

species_code

common_name

scientific_name

taxon_confidence

cpue_kgha

cpue_kgkm2

cpue_kg1000km2

cpue_noha

cpue_nokm2

cpue_no1000km2

weight_kg

count

bottom_temperature_c

surface_temperature_c

depth_m

distance_fished_km

net_width_m

net_height_m

area_swept_ha

duration_hr

tsn

ak_survey_id

links

2002

AI

Aleutian Islands Bottom Trawl Survey

52

200201

6

722

307-63

Vesteraalen

94

05/17/2002 18:56:58

53.737

-167.016

95020

feathery bryozoan

Eucratea loricata

Low

0.017

1.749

1,749.445

0.044

0

4.1

5.3

187

1.561

16.112

7.25

2.515

0.28

155809

1917453

[[data.frame]]

2002

AI

Aleutian Islands Bottom Trawl Survey

52

200201

6

722

307-63

Vesteraalen

94

05/17/2002 18:56:58

53.737

-167.016

79000

squid unid.

Decapodiformes

High

0.022

2.227

2,226.567

3.181

318.081

318,080.93

0.056

8

4.1

5.3

187

1.561

16.112

7.25

2.515

0.28

1917454

[[data.frame]]

2002

AI

Aleutian Islands Bottom Trawl Survey

52

200201

6

722

307-63

Vesteraalen

94

05/17/2002 18:56:58

53.737

-167.016

24191

shortfin eelpout

Lycodes brevipes

High

0.036

3.578

3,578.410

0.795

79.520

79,520.23

0.090

2

4.1

5.3

187

1.561

16.112

7.25

2.515

0.28

165258

1917455

[[data.frame]]

\n```\n:::\n:::\n\n\n## Ex. 2: Load the first 10000 rows of data\n\n\n::: {.cell tbl-cap='Ex. 2: Load the first 10000 rows of data. '}\n\n```{.r .cell-code}\n# Not run because too big:\nres <- httr::GET(url = paste0(api_link, \"?offset=0&limit=10000\"))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\nprint(paste0(\"rows: \", dim(data$items)[1], \"; cols: \", dim(data$items)[2]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] \"rows: 10000; cols: 36\"\n```\n:::\n:::\n\n\n## Ex. 3: Filter by Year\n\nShow all the data greater than the year 2020. \n\n\n::: {.cell tbl-cap='Ex. 3: Filter by Year. '}\n\n```{.r .cell-code}\nres <- httr::GET(url = paste0(api_link, '?q={\"year\":{\"$gt\":2020}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

2022

AI

793

80540

0.361

2022

AI

793

401

0.903

2022

AI

793

20006

1.661

\n```\n:::\n:::\n\n\n## Ex. 4: Filter by species name\n\nShow all the data where the product name contains pollock Please note that here the word pollock is case sensitive.\n\nThe notation for finding a string is to use % around it. Since % is a reserved character in a URL, you have to replace `%` with `%25`. \n\n\n::: {.cell tbl-cap='Ex. 4: Filter by species name. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

2002

AI

722

21740

775.322

2002

AI

722

21740

10,685.806

2002

AI

721

21740

0.640

\n```\n:::\n:::\n\n\n## Ex. 5: Combination of year and name filters\n\nShow all the data where years > 2020 and the product name contains pollock\n\n\n::: {.cell tbl-cap='Ex. 5: Combination of year and name filters. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, \n '?q={\"year\":{\"$gt\":2020},\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

2022

AI

793

21740

7,853.632

2022

AI

721

21740

7,235.010

2022

AI

722

21740

22,754.334

\n```\n:::\n:::\n\n\n## Ex. 6: Combination of year, srvy, stratum\n\nShow all the data where year = 1989, srvy = \"EBS\", and stratum is not equal to 81\n\n\n::: {.cell tbl-cap='Ex. 6: Combination of year, srvy, stratum. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":1989,\"srvy\":\"EBS\",\"stratum\":{\"$ne\":\"81\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

1989

EBS

10

66548

1.164

1989

EBS

10

69322

1.164

1989

EBS

10

43000

2.353

\n```\n:::\n:::\n\n\n## Ex. 7: Visualize CPUE data in distribution map\n\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). \n\n\n::: {.cell tbl-cap='Ex. 7: Visualize CPUE data in distribution map. '}\n\n```{.r .cell-code}\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n```\n\n::: {.cell-output-display}\n```{=html}\n

stratum

station

latitude_dd

longitude_dd

cpue_kgkm2

81

61.66434

-172.2655

2,895.258

81

62.33740

-173.1702

1,235.545

70

62.03713

-171.6528

0.000

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n```\n\n::: {.cell-output-display}\n![Ex. 7: Visualize CPUE data in distribution map. ](foss-api-r_files/figure-html/test-7-fig-1.png){width=672}\n:::\n:::\n", + "markdown": "---\ntitle: Access via API and R\n---\n\n\n\n\nAn application programming interface (API) is a way for two or more computer programs to communicate with each other.\n\nMore information about how to amend API links can be found [here](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/22.3/books.html#AELIG90103/). Useful introductions to using APIs in `R` can be found [here](https://www.dataquest.io/blog/r-api-tutorial/). \n\n## Ex. 1: Load the first 25 rows (default) of data\n\n\n::: {.cell tbl-cap='Ex. 1: Load the first 25 rows (default) of data. '}\n\n```{.r .cell-code}\n # install.packages(c(\"httr\", \"jsonlite\"))\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(dplyr)\n\n # link to the API\napi_link <- \"https://apps-st.fisheries.noaa.gov/ods/foss/afsc_groundfish_survey/\"\n\nres <- httr::GET(url = api_link)\n # res # Test connection\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n # names(data)\ntibble::as_tibble(data$items) %>% \n dplyr::mutate_if(is.character, type.convert, as.is = TRUE) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n head(3) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"cruise\", \"species_code\", \"tsn\", \"ak_survey_id\"), big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

survey

survey_id

cruise

haul

stratum

station

vessel_name

vessel_id

date_time

latitude_dd

longitude_dd

species_code

common_name

scientific_name

taxon_confidence

cpue_kgha

cpue_kgkm2

cpue_kg1000km2

cpue_noha

cpue_nokm2

cpue_no1000km2

weight_kg

count

bottom_temperature_c

surface_temperature_c

depth_m

distance_fished_km

net_width_m

net_height_m

area_swept_ha

duration_hr

tsn

ak_survey_id

links

2002

AI

Aleutian Islands Bottom Trawl Survey

52

200201

6

722

307-63

Vesteraalen

94

05/17/2002 18:56:58

53.737

-167.016

95020

feathery bryozoan

Eucratea loricata

Low

0.017

1.749

1,749.445

0.044

0

4.1

5.3

187

1.561

16.112

7.25

2.515

0.28

155809

1917453

[[data.frame]]

2002

AI

Aleutian Islands Bottom Trawl Survey

52

200201

6

722

307-63

Vesteraalen

94

05/17/2002 18:56:58

53.737

-167.016

79000

squid unid.

Decapodiformes

High

0.022

2.227

2,226.567

3.181

318.081

318,080.93

0.056

8

4.1

5.3

187

1.561

16.112

7.25

2.515

0.28

1917454

[[data.frame]]

2002

AI

Aleutian Islands Bottom Trawl Survey

52

200201

6

722

307-63

Vesteraalen

94

05/17/2002 18:56:58

53.737

-167.016

24191

shortfin eelpout

Lycodes brevipes

High

0.036

3.578

3,578.410

0.795

79.520

79,520.23

0.090

2

4.1

5.3

187

1.561

16.112

7.25

2.515

0.28

165258

1917455

[[data.frame]]

\n```\n:::\n:::\n\n\n## Ex. 2: Load the first 10000 rows of data\n\n\n::: {.cell tbl-cap='Ex. 2: Load the first 10000 rows of data. '}\n\n```{.r .cell-code}\n# Not run because too big:\nres <- httr::GET(url = paste0(api_link, \"?offset=0&limit=10000\"))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\nprint(paste0(\"rows: \", dim(data$items)[1], \"; cols: \", dim(data$items)[2]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] \"rows: 10000; cols: 36\"\n```\n:::\n:::\n\n\n## Ex. 3: Filter by Year\n\nShow all the data greater than the year 2020. \n\n\n::: {.cell tbl-cap='Ex. 3: Filter by Year. '}\n\n```{.r .cell-code}\nres <- httr::GET(url = paste0(api_link, '?q={\"year\":{\"$gt\":2020}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

2022

AI

793

80540

0.361

2022

AI

793

401

0.903

2022

AI

793

20006

1.661

\n```\n:::\n:::\n\n\n## Ex. 4: Filter by species name\n\nShow all the data where the product name contains pollock Please note that here the word pollock is case sensitive.\n\nThe notation for finding a string is to use % around it. Since % is a reserved character in a URL, you have to replace `%` with `%25`. \n\n\n::: {.cell tbl-cap='Ex. 4: Filter by species name. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

2002

AI

722

21740

775.322

2002

AI

722

21740

10,685.806

2002

AI

721

21740

0.640

\n```\n:::\n:::\n\n\n## Ex. 5: Combination of year and name filters\n\nShow all the data where years > 2020 and the product name contains pollock\n\n\n::: {.cell tbl-cap='Ex. 5: Combination of year and name filters. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, \n '?q={\"year\":{\"$gt\":2020},\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

2022

AI

793

21740

7,853.632

2022

AI

721

21740

7,235.010

2022

AI

722

21740

22,754.334

\n```\n:::\n:::\n\n\n## Ex. 6: Combination of year, srvy, stratum\n\nShow all the data where year = 1989, srvy = \"EBS\", and stratum is not equal to 81\n\n\n::: {.cell tbl-cap='Ex. 6: Combination of year, srvy, stratum. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":1989,\"srvy\":\"EBS\",\"stratum\":{\"$ne\":\"81\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=html}\n

year

srvy

stratum

species_code

cpue_kgkm2

1989

EBS

10

66548

1.164

1989

EBS

10

69322

1.164

1989

EBS

10

43000

2.353

\n```\n:::\n:::\n\n\n## Ex. 7: Visualize CPUE data in distribution map\n\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). \n\n\n::: {.cell tbl-cap='Ex. 7: Visualize CPUE data in distribution map. '}\n\n```{.r .cell-code}\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n```\n\n::: {.cell-output-display}\n```{=html}\n

stratum

station

latitude_dd

longitude_dd

cpue_kgkm2

81

61.66434

-172.2655

2,895.258

81

62.33740

-173.1702

1,235.545

70

62.03713

-171.6528

0.000

\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000))$plot + # 20x20km grid\n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n:::\n", "supporting": [ - "foss-api-r_files" + "foss-api-r_files\\figure-html" ], "filters": [ "rmarkdown/pagebreak.lua" diff --git a/_freeze/content/foss-api-r/execute-results/tex.json b/_freeze/content/foss-api-r/execute-results/tex.json index b55b560..7218577 100644 --- a/_freeze/content/foss-api-r/execute-results/tex.json +++ b/_freeze/content/foss-api-r/execute-results/tex.json @@ -1,7 +1,7 @@ { - "hash": "2eb6f941b64730743e5c01ae71e268dd", + "hash": "9b419c3eb2cb72acb9b71d1fec7c1dac", "result": { - "markdown": "---\ntitle: Access via API and R\n---\n\n\n\n\n\nAn application programming interface (API) is a way for two or more computer programs to communicate with each other.\n\nMore information about how to amend API links can be found [here](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/22.3/books.html#AELIG90103/). Useful introductions to using APIs in `R` can be found [here](https://www.dataquest.io/blog/r-api-tutorial/). \n\n## Ex. 1: Load the first 25 rows (default) of data\n\n\n\n::: {.cell tbl-cap='Ex. 1: Load the first 25 rows (default) of data. '}\n\n```{.r .cell-code}\n # install.packages(c(\"httr\", \"jsonlite\"))\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(dplyr)\n\n # link to the API\napi_link <- \"https://apps-st.fisheries.noaa.gov/ods/foss/afsc_groundfish_survey/\"\n\nres <- httr::GET(url = api_link)\n # res # Test connection\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n # names(data)\ntibble::as_tibble(data$items) %>% \n dplyr::mutate_if(is.character, type.convert, as.is = TRUE) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n head(3) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"cruise\", \"species_code\", \"tsn\", \"ak_survey_id\"), big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cruise}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{haul}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{date\\_time}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{common\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{scientific\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{taxon\\_confidence}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kg1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_noha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_nokm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_no1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{weight\\_kg}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{count}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{bottom\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{surface\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{depth\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{distance\\_fished\\_km}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_width\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_height\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{area\\_swept\\_ha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{duration\\_hr}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{tsn}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{ak\\_survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{links}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cruise}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{haul}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{date\\_time}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{common\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{scientific\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{taxon\\_confidence}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kg1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_noha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_nokm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_no1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{weight\\_kg}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{count}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{bottom\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{surface\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{depth\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{distance\\_fished\\_km}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_width\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_height\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{area\\_swept\\_ha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{duration\\_hr}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{tsn}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{ak\\_survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{links}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Aleutian\\ Islands\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{52}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200201}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{307-63}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Vesteraalen}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{94}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{05/17/2002\\ 18:56:58}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{53.737}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-167.016}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{95020}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{feathery\\ bryozoan}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Eucratea\\ loricata}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Low}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.017}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.749}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,749.445}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.044}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{187}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.561}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16.112}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7.25}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.515}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.28}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{155809}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1917453}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{[[data.frame]]}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Aleutian\\ Islands\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{52}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200201}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{6}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{307-63}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Vesteraalen}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{94}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{05/17/2002\\ 18:56:58}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{53.737}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-167.016}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{79000}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{squid\\ unid.}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Decapodiformes}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{High}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.022}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.227}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2,226.567}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3.181}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{318.081}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{318,080.93}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.056}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{8}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.1}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{187}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.561}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16.112}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7.25}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.515}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.28}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1917454}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{[[data.frame]]}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Aleutian\\ Islands\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{52}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200201}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{307-63}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Vesteraalen}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{94}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{05/17/2002\\ 18:56:58}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{53.737}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-167.016}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{24191}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{shortfin\\ eelpout}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Lycodes\\ brevipes}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{High}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.036}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3.578}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3,578.410}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.795}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{79.520}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{79,520.23}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.090}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{187}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.561}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16.112}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7.25}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.515}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.28}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{165258}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1917455}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{[[data.frame]]}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 2: Load the first 10000 rows of data\n\n\n\n::: {.cell tbl-cap='Ex. 2: Load the first 10000 rows of data. '}\n\n```{.r .cell-code}\n# Not run because too big:\nres <- httr::GET(url = paste0(api_link, \"?offset=0&limit=10000\"))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\nprint(paste0(\"rows: \", dim(data$items)[1], \"; cols: \", dim(data$items)[2]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] \"rows: 10000; cols: 36\"\n```\n:::\n:::\n\n\n\n## Ex. 3: Filter by Year\n\nShow all the data greater than the year 2020. \n\n\n\n::: {.cell tbl-cap='Ex. 3: Filter by Year. '}\n\n```{.r .cell-code}\nres <- httr::GET(url = paste0(api_link, '?q={\"year\":{\"$gt\":2020}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{80540}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.361}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{401}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.903}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{20006}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.661}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 4: Filter by species name\n\nShow all the data where the product name contains pollock Please note that here the word pollock is case sensitive.\n\nThe notation for finding a string is to use % around it. Since % is a reserved character in a URL, you have to replace `%` with `%25`. \n\n\n\n::: {.cell tbl-cap='Ex. 4: Filter by species name. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{775.322}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10,685.806}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{721}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.640}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 5: Combination of year and name filters\n\nShow all the data where years > 2020 and the product name contains pollock\n\n\n\n::: {.cell tbl-cap='Ex. 5: Combination of year and name filters. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, \n '?q={\"year\":{\"$gt\":2020},\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,853.632}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{721}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,235.010}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{22,754.334}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 6: Combination of year, srvy, stratum\n\nShow all the data where year = 1989, srvy = \"EBS\", and stratum is not equal to 81\n\n\n\n::: {.cell tbl-cap='Ex. 6: Combination of year, srvy, stratum. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":1989,\"srvy\":\"EBS\",\"stratum\":{\"$ne\":\"81\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1989}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{EBS}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{66548}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.164}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1989}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{EBS}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{69322}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.164}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1989}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{EBS}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{43000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.353}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 7: Visualize CPUE data in distribution map\n\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). \n\n\n\n::: {.cell tbl-cap='Ex. 7: Visualize CPUE data in distribution map. '}\n\n```{.r .cell-code}\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{81}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{61.66434}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-172.2655}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2,895.258}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{81}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{62.33740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-173.1702}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,235.545}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{70}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{62.03713}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-171.6528}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.000}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n\n```{.r .cell-code}\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n```\n\n::: {.cell-output-display}\n![Ex. 7: Visualize CPUE data in distribution map. ](foss-api-r_files/figure-pdf/test-7-fig-1.pdf){fig-pos='H'}\n:::\n:::\n", + "markdown": "---\ntitle: Access via API and R\n---\n\n\n\n\n\nAn application programming interface (API) is a way for two or more computer programs to communicate with each other.\n\nMore information about how to amend API links can be found [here](https://docs.oracle.com/en/database/oracle/oracle-rest-data-services/22.3/books.html#AELIG90103/). Useful introductions to using APIs in `R` can be found [here](https://www.dataquest.io/blog/r-api-tutorial/). \n\n## Ex. 1: Load the first 25 rows (default) of data\n\n\n\n::: {.cell tbl-cap='Ex. 1: Load the first 25 rows (default) of data. '}\n\n```{.r .cell-code}\n # install.packages(c(\"httr\", \"jsonlite\"))\nlibrary(httr)\nlibrary(jsonlite)\nlibrary(dplyr)\n\n # link to the API\napi_link <- \"https://apps-st.fisheries.noaa.gov/ods/foss/afsc_groundfish_survey/\"\n\nres <- httr::GET(url = api_link)\n # res # Test connection\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n # names(data)\ntibble::as_tibble(data$items) %>% \n dplyr::mutate_if(is.character, type.convert, as.is = TRUE) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n head(3) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"cruise\", \"species_code\", \"tsn\", \"ak_survey_id\"), big.mark = \"\")\n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cruise}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{haul}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{date\\_time}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{common\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{scientific\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{taxon\\_confidence}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kg1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_noha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_nokm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_no1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{weight\\_kg}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{count}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{bottom\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{surface\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{depth\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{distance\\_fished\\_km}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_width\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_height\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{area\\_swept\\_ha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{duration\\_hr}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{tsn}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{ak\\_survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{links}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cruise}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{haul}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{vessel\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{date\\_time}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{common\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{scientific\\_name}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{taxon\\_confidence}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kg1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_noha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_nokm2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_no1000km2}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{weight\\_kg}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{count}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{bottom\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{surface\\_temperature\\_c}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{depth\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{distance\\_fished\\_km}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_width\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{net\\_height\\_m}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{area\\_swept\\_ha}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{duration\\_hr}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{tsn}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{ak\\_survey\\_id}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{links}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Aleutian\\ Islands\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{52}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200201}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{307-63}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Vesteraalen}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{94}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{05/17/2002\\ 18:56:58}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{53.737}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-167.016}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{95020}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{feathery\\ bryozoan}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Eucratea\\ loricata}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Low}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.017}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.749}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,749.445}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.044}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{187}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.561}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16.112}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7.25}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.515}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.28}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{155809}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1917453}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{[[data.frame]]}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Aleutian\\ Islands\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{52}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200201}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{6}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{307-63}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Vesteraalen}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{94}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{05/17/2002\\ 18:56:58}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{53.737}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-167.016}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{79000}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{squid\\ unid.}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Decapodiformes}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{High}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.022}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.227}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2,226.567}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3.181}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{318.081}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{318,080.93}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.056}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{8}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.1}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{187}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.561}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16.112}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7.25}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.515}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.28}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1917454}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{[[data.frame]]}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Aleutian\\ Islands\\ Bottom\\ Trawl\\ Survey}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{52}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{200201}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{6}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{307-63}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Vesteraalen}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{94}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{05/17/2002\\ 18:56:58}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{53.737}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-167.016}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{24191}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{shortfin\\ eelpout}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{Lycodes\\ brevipes}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{High}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.036}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3.578}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{3,578.410}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.795}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{79.520}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{79,520.23}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.090}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{4.1}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{5.3}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{187}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.561}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{16.112}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7.25}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.515}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.28}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{165258}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1917455}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{[[data.frame]]}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 2: Load the first 10000 rows of data\n\n\n\n::: {.cell tbl-cap='Ex. 2: Load the first 10000 rows of data. '}\n\n```{.r .cell-code}\n# Not run because too big:\nres <- httr::GET(url = paste0(api_link, \"?offset=0&limit=10000\"))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\nprint(paste0(\"rows: \", dim(data$items)[1], \"; cols: \", dim(data$items)[2]))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[1] \"rows: 10000; cols: 36\"\n```\n:::\n:::\n\n\n\n## Ex. 3: Filter by Year\n\nShow all the data greater than the year 2020. \n\n\n\n::: {.cell tbl-cap='Ex. 3: Filter by Year. '}\n\n```{.r .cell-code}\nres <- httr::GET(url = paste0(api_link, '?q={\"year\":{\"$gt\":2020}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{80540}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.361}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{401}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.903}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{20006}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.661}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 4: Filter by species name\n\nShow all the data where the product name contains pollock Please note that here the word pollock is case sensitive.\n\nThe notation for finding a string is to use % around it. Since % is a reserved character in a URL, you have to replace `%` with `%25`. \n\n\n\n::: {.cell tbl-cap='Ex. 4: Filter by species name. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{775.322}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10,685.806}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2002}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{721}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.640}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 5: Combination of year and name filters\n\nShow all the data where years > 2020 and the product name contains pollock\n\n\n\n::: {.cell tbl-cap='Ex. 5: Combination of year and name filters. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, \n '?q={\"year\":{\"$gt\":2020},\"common_name\":{\"$like\":\"%25pollock%25\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{793}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,853.632}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{721}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{7,235.010}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2022}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{AI}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{722}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{21740}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{22,754.334}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 6: Combination of year, srvy, stratum\n\nShow all the data where year = 1989, srvy = \"EBS\", and stratum is not equal to 81\n\n\n\n::: {.cell tbl-cap='Ex. 6: Combination of year, srvy, stratum. '}\n\n```{.r .cell-code}\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":1989,\"srvy\":\"EBS\",\"stratum\":{\"$ne\":\"81\"}}'))\ndata <- jsonlite::fromJSON(base::rawToChar(res$content))\n\nas_tibble(data$items) %>% \n mutate_if(is.character, type.convert, as.is = TRUE) %>%\n head(3) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>%\n dplyr::select(year, srvy, stratum, species_code, cpue_kgkm2) %>%\nflextable::flextable() %>%\n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = c(\"year\", \"species_code\"), big.mark = \"\") \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{year}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{srvy}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{species\\_code}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1989}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{EBS}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{66548}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.164}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1989}}} & \\multicolumn{1}{>{\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{EBS}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{69322}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1.164}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1989}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedright}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{EBS}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{10}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{43000}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2.353}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n\n\n## Ex. 7: Visualize CPUE data in distribution map\n\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using [`akgfmaps`](https://github.com/afsc-gap-products/akgfmaps). \n\n\n\n::: {.cell tbl-cap='Ex. 7: Visualize CPUE data in distribution map. '}\n\n```{.r .cell-code}\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n```\n\n::: {.cell-output-display}\n```{=latex}\n\\global\\setlength{\\Oldarrayrulewidth}{\\arrayrulewidth}\n\n\\global\\setlength{\\Oldtabcolsep}{\\tabcolsep}\n\n\\setlength{\\tabcolsep}{0pt}\n\n\\renewcommand*{\\arraystretch}{1.5}\n\n\n\n\\providecommand{\\ascline}[3]{\\noalign{\\global\\arrayrulewidth #1}\\arrayrulecolor[HTML]{#2}\\cline{#3}}\n\n\\begin{longtable}[c]{|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}|p{0.75in}}\n\n\n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endfirsthead \n\n\\hhline{>{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}->{\\arrayrulecolor[HTML]{000000}\\global\\arrayrulewidth=0pt}-}\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{stratum}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{station}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{latitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{longitude\\_dd}}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{CFCFCF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{\\textbf{cpue\\_kgkm2}}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\\endhead\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{81}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{61.66434}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-172.2655}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{2,895.258}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{81}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{62.33740}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-173.1702}}} & \\multicolumn{1}{>{\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{1,235.545}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{70}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{62.03713}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{-171.6528}}} & \\multicolumn{1}{>{\\cellcolor[HTML]{EFEFEF}\\raggedleft}m{\\dimexpr 0.75in+0\\tabcolsep}}{\\textcolor[HTML]{000000}{\\fontsize{11}{11}\\selectfont{0.000}}} \\\\\n\n\\noalign{\\global\\arrayrulewidth 0pt}\\arrayrulecolor[HTML]{000000}\n\n\n\n\n\n\\end{longtable}\n\n\n\n\\arrayrulecolor[HTML]{000000}\n\n\\global\\setlength{\\arrayrulewidth}{\\Oldarrayrulewidth}\n\n\\global\\setlength{\\tabcolsep}{\\Oldtabcolsep}\n\n\\renewcommand*{\\arraystretch}{1}\n```\n:::\n:::\n\n::: {.cell}\n\n```{.r .cell-code}\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000))$plot + # 20x20km grid\n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n```\n:::\n:::\n", "supporting": [ "foss-api-r_files\\figure-pdf" ], diff --git a/_freeze/content/intro-news/execute-results/docx.json b/_freeze/content/intro-news/execute-results/docx.json new file mode 100644 index 0000000..424c9a3 --- /dev/null +++ b/_freeze/content/intro-news/execute-results/docx.json @@ -0,0 +1,20 @@ +{ + "hash": "0aca6a944b7528c3b0940be2bddef95f", + "result": { + "markdown": "---\ntitle: News\n---\n\n\n\n\n## News/change logs\n\n\n\n\n::: {.cell}\n\n:::\n\n\n\n\n -- [Run 2023-06-01 gapindex v2.1.0](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-06-01_v2-1-0.txt): Initial compiling and planning notes\n\n -- [GAP_PRODUCTS ChangeLog (last produced on 2023-11-14) using gapindex v2.1.1](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-14_v2-1-1.txt): A new version of gapindex (v2.1.1) was used to produced these data. There was a slight change to how subarea biomass totals are calculated. The modified biomass records reflect this change. New 2022 otolith data were available since the last iteration of the GAP_PRODUCTS for Aleutian Island Pacific ocean perch and northern rockifsh and Eastern Bering Sea northern rock sole. Zero-filled CPUE records for four GOA species codes (SPECIES_CODE: 21210, 30010, 30360, 77102, 98101) were added due to how the 1990 data were integrated in the last production run of GAP_PRODUCTS. Two Arctic cod (SPECIES_CODE: 21725) and one plain sculpin (SPECIES_CODE: 21371) count records were modified in the NBS data, which changes the numerical CPUE estimates for those hauls which changes the estimated population abundance and size composition for those species.\n\n -- [GAP_PRODUCTS ChangeLog (last produced on 2023-11-17) using gapindex v2.1.2](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-17.txt): A new version of gapindex ([v2.1.2](https://github.com/afsc-gap-products/gapindex/releases/tag/v2.1.2)) was used to produced these data. There was a slight change to how subarea biomass totals are calculated that was not fully addressed in v2.1.1. The modified biomass records reflect this change.\n\n", + "supporting": [ + "intro-news_files" + ], + "filters": [ + "rmarkdown/pagebreak.lua" + ], + "includes": {}, + "engineDependencies": { + "knitr": [ + "{\"type\":\"list\",\"attributes\":{},\"value\":[]}" + ] + }, + "preserve": null, + "postProcess": false + } +} \ No newline at end of file diff --git a/_freeze/content/intro-news/execute-results/html.json b/_freeze/content/intro-news/execute-results/html.json new file mode 100644 index 0000000..55ce5af --- /dev/null +++ b/_freeze/content/intro-news/execute-results/html.json @@ -0,0 +1,16 @@ +{ + "hash": "0aca6a944b7528c3b0940be2bddef95f", + "result": { + "markdown": "---\ntitle: News\n---\n\n\n## News/change logs\n\n\n::: {.cell}\n\n:::\n\n\n -- [Run 2023-06-01 gapindex v2.1.0](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-06-01_v2-1-0.txt): Initial compiling and planning notes\n\n -- [GAP_PRODUCTS ChangeLog (last produced on 2023-11-14) using gapindex v2.1.1](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-14_v2-1-1.txt): A new version of gapindex (v2.1.1) was used to produced these data. There was a slight change to how subarea biomass totals are calculated. The modified biomass records reflect this change. New 2022 otolith data were available since the last iteration of the GAP_PRODUCTS for Aleutian Island Pacific ocean perch and northern rockifsh and Eastern Bering Sea northern rock sole. Zero-filled CPUE records for four GOA species codes (SPECIES_CODE: 21210, 30010, 30360, 77102, 98101) were added due to how the 1990 data were integrated in the last production run of GAP_PRODUCTS. Two Arctic cod (SPECIES_CODE: 21725) and one plain sculpin (SPECIES_CODE: 21371) count records were modified in the NBS data, which changes the numerical CPUE estimates for those hauls which changes the estimated population abundance and size composition for those species.\n\n -- [GAP_PRODUCTS ChangeLog (last produced on 2023-11-17) using gapindex v2.1.2](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-17.txt): A new version of gapindex ([v2.1.2](https://github.com/afsc-gap-products/gapindex/releases/tag/v2.1.2)) was used to produced these data. There was a slight change to how subarea biomass totals are calculated that was not fully addressed in v2.1.1. The modified biomass records reflect this change.\n\n", + "supporting": [ + "intro-news_files" + ], + "filters": [ + "rmarkdown/pagebreak.lua" + ], + "includes": {}, + "engineDependencies": {}, + "preserve": {}, + "postProcess": true + } +} \ No newline at end of file diff --git a/_freeze/content/intro-news/execute-results/tex.json b/_freeze/content/intro-news/execute-results/tex.json new file mode 100644 index 0000000..a5443d3 --- /dev/null +++ b/_freeze/content/intro-news/execute-results/tex.json @@ -0,0 +1,20 @@ +{ + "hash": "0aca6a944b7528c3b0940be2bddef95f", + "result": { + "markdown": "---\ntitle: News\n---\n\n\n\n## News/change logs\n\n\n\n::: {.cell}\n\n:::\n\n\n\n -- [Run 2023-06-01 gapindex v2.1.0](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-06-01_v2-1-0.txt): Initial compiling and planning notes\n\n -- [GAP_PRODUCTS ChangeLog (last produced on 2023-11-14) using gapindex v2.1.1](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-14_v2-1-1.txt): A new version of gapindex (v2.1.1) was used to produced these data. There was a slight change to how subarea biomass totals are calculated. The modified biomass records reflect this change. New 2022 otolith data were available since the last iteration of the GAP_PRODUCTS for Aleutian Island Pacific ocean perch and northern rockifsh and Eastern Bering Sea northern rock sole. Zero-filled CPUE records for four GOA species codes (SPECIES_CODE: 21210, 30010, 30360, 77102, 98101) were added due to how the 1990 data were integrated in the last production run of GAP_PRODUCTS. Two Arctic cod (SPECIES_CODE: 21725) and one plain sculpin (SPECIES_CODE: 21371) count records were modified in the NBS data, which changes the numerical CPUE estimates for those hauls which changes the estimated population abundance and size composition for those species.\n\n -- [GAP_PRODUCTS ChangeLog (last produced on 2023-11-17) using gapindex v2.1.2](C:/Users/emily.markowitz/Work/projects/gap_products/content/intro-news/2023-11-17.txt): A new version of gapindex ([v2.1.2](https://github.com/afsc-gap-products/gapindex/releases/tag/v2.1.2)) was used to produced these data. There was a slight change to how subarea biomass totals are calculated that was not fully addressed in v2.1.1. The modified biomass records reflect this change.\n\n", + "supporting": [ + "intro-news_files" + ], + "filters": [ + "rmarkdown/pagebreak.lua" + ], + "includes": {}, + "engineDependencies": { + "knitr": [ + "{\"type\":\"list\",\"attributes\":{},\"value\":[]}" + ] + }, + "preserve": null, + "postProcess": false + } +} \ No newline at end of file diff --git a/content/akfin-oracle-sql-r.qmd b/content/akfin-oracle-sql-r.qmd index f08d8da..e2a856f 100644 --- a/content/akfin-oracle-sql-r.qmd +++ b/content/akfin-oracle-sql-r.qmd @@ -37,7 +37,7 @@ library(magrittr) library(dplyr) ``` -### Ex. Select all data from a table +### Ex. Select all data from tables You can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the `R` environment. @@ -72,101 +72,57 @@ for (i in 1:length(locations)) { } ``` +### Ex. CPUE for all EBS and NBS stations with associated haul, cruise, and species information. + ```{r} #| label: test-7 #| message: false #| warning: false -#| echo: false -#| eval: false - -# ### Ex. Summary table for EBS and NBS arrowtooth flounder (10110), Bering flounder (10140), and Bering skate (435) -# -# - Number hauls where species were observed (N_HAULS) -# - Number of length measurements that were colelcted for this species (N_LENGTHS) -# -# +#| echo: true +#| tbl-cap: "Ex.: CPUE for all EBS and NBS stations with associated haul, cruise, and species information. " -dat <- RODBC::sqlQuery(channel = channel, - query = +a <- RODBC::sqlQuery(channel = channel, # NOT RACEBASE.HAUL + query = paste0( " -- Select columns for output data SELECT -bb.SPECIES_CODE, -bb.YEAR, -bb.SURVEY_DEFINITION_ID, -bb.AREA_ID, -SUM(bb.N_HAUL) AS N_HAULS, -- Number hauls where species were observed -SUM(bb.N_LENGTH) AS N_LENGTHS -- Number of length measurements that were colelcted for this species +cr.CRUISEJOIN, +cr.CRUISE, +cr.YEAR, +cr.SURVEY_DEFINITION_ID, +cr.SURVEY_NAME, +cr.VESSEL_ID, +cr.VESSEL_NAME, +cp.HAULJOIN, +cp.SPECIES_CODE, +tt.SPECIES_NAME, +tt.COMMON_NAME, +cp.WEIGHT_KG, +cp.COUNT, +cp.AREA_SWEPT_KM2, +cp.CPUE_KGKM2, +cp.CPUE_NOKM2, +hh.HAUL, +hh.STATION -- Identify what tables to pull data from -FROM GAP_PRODUCTS.AKFIN_BIOMASS bb - --- Filter data results -WHERE bb.SPECIES_CODE IN (10110, 435, 10140) -AND bb.YEAR IN (2022, 2023) -AND bb.AREA_ID IN (99900, 99902) -GROUP BY bb.SPECIES_CODE, bb.YEAR, bb.SURVEY_DEFINITION_ID, bb.AREA_ID -ORDER BY bb.SURVEY_DEFINITION_ID, bb.YEAR, bb.SPECIES_CODE;") -``` - -```{r} -#| label: test-7-workspace -#| message: false -#| warning: false -#| echo: false -#| eval: false +FROM GAP_PRODUCTS.AKFIN_HAUL hh +LEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cr +ON hh.CRUISEJOIN = cr.CRUISEJOIN +LEFT JOIN GAP_PRODUCTS.AKFIN_CPUE cp +ON hh.HAULJOIN = cp.HAULJOIN +LEFT JOIN GAP_PRODUCTS.TAXONOMIC_CLASSIFICATION tt +ON cp.SPECIES_CODE = tt.SPECIES_CODE -# Workspace - -# --COUNT(N_LENGTH) AS N_HAULS_W_LENGTH, -- Number of hauls where lengths for this species were collected -# --HAULS_W_OTOLITHS, -- Number of hauls where otoliths were collected for this species were collected -# --HAULS_W_AGES, -- Number of hauls where otoliths were collected for this species were collected -# --NUM_OTOLITHS, -# -- NUM_AGES - -# dat_specimen <- RODBC::sqlQuery(channel = channel, -# query = -# "SELECT -# ss.SPECIES_CODE, -# cc.YEAR, -# cc.SURVEY_DEFINITION_ID, -# aa.AREA_ID, -# COUNT(ss.AGE_YEARS) AS N_AGES -- The number of age specimens collected -# FROM GAP_PRODUCTS.AKFIN_SPECIMEN ss -# LEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh -# ON ss.HAULJOIN = hh.HAULJOIN -# LEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc -# ON hh.CRUISEJOIN = cc.CRUISEJOIN -# LEFT JOIN GAP_PRODUCTS.AKFIN_STRATUM_GROUPS aa -# ON hh.STRATUM = aa.STRATUM -# AND cc.SURVEY_DEFINITION_ID = aa.SURVEY_DEFINITION_ID -# WHERE ss.specimen_sample_type = 1 -# AND ss.SPECIES_CODE IN (10110, 435, 10140) -# AND cc.YEAR IN (2022, 2023) -# AND bb.AREA_ID IN (99900, 99902) -# GROUP BY ss.SPECIES_CODE, cc.YEAR, cc.SURVEY_DEFINITION_ID, aa.AREA_ID -# ORDER BY cc.SURVEY_DEFINITION_ID, cc.YEAR, ss.SPECIES_CODE;") -# -# dat <- dplyr::full_join(dat_specimen, dat_haul) +-- Filter for EBS and NBS observations +WHERE SURVEY_DEFINITION_ID IN (143, 98) -- 143 NBS, 98 EBS +AND tt.SURVEY_SPECIES = 1 -``` +-- Only return the first 3 rows because otherwise this would be a huge table! +FETCH FIRST 3 ROWS ONLY;")) -```{r} -#| label: test-7-tbl -#| tbl-cap: "Ex. 7: Summary table of Number hauls where species were observed (N_HAULS) and number of length measurements that were colelcted for this species (N_LENGTHS) for EBS and NBS, for arrowtooth flounder (10110), Bering flounder (10140), and Alaska skate (435). " -#| message: false -#| warning: false -#| echo: false -#| eval: false - -dat <- dat %>% - dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), - YEAR = as.character(YEAR), - AREA_ID = as.character(AREA_ID)) %>% - dplyr::relocate(SURVEY_DEFINITION_ID, YEAR, SPECIES_CODE) %>% - dplyr::arrange(SPECIES_CODE) +flextable::flextable(head(a)) %>% theme_zebra() -flextable::flextable(dat) %>% theme_zebra() ``` ### Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod. @@ -309,7 +265,7 @@ dat <- RODBC::sqlQuery(channel = channel, -- Manipulate data to join to WITH FILTERED_STRATA AS ( SELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA -WHERE TYPE in ('REGULATORY_AREA', 'REGION') +WHERE AREA_TYPE in ('REGULATORY_AREA', 'REGION') AND SURVEY_DEFINITION_ID = 47) -- Select columns for output data @@ -399,11 +355,11 @@ dat <- RODBC::sqlQuery(channel = channel, WITH FILTERED_STRATA AS ( SELECT AREA_ID, -DESCRIPTION +DESCRIPTION -- Identify what tables to pull data from FROM GAP_PRODUCTS.AKFIN_AREA -WHERE TYPE = 'REGION' +WHERE AREA_TYPE = 'REGION' AND SURVEY_DEFINITION_ID = 52) -- Select columns for output data @@ -428,11 +384,12 @@ AND SIZECOMP.SPECIES_CODE IN (10261, 10262)") dat0 <- dat %>% janitor::clean_names() %>% - dplyr::mutate(length_cm = length_mm/10) -flextable::flextable(head(dat)) %>% - theme_zebra() %>% - flextable::colformat_num(x = ., j = "YEAR", big.mark = "") - + dplyr::mutate(length_cm = length_mm/10) %>% + head() %>% + flextable::flextable() %>% + flextable::theme_zebra() %>% + flextable::colformat_num(x = ., j = "year", big.mark = "") +dat0 ``` @@ -447,8 +404,8 @@ flextable::flextable(head(dat)) %>% library(ggridges) figure <- ggplot2::ggplot( - data = dat0, - mapping = aes(x = length_cm, y = as.factor(year), fill = stat(x))) + + data = dat, + mapping = aes(x = LENGTH_MM, y = as.factor(YEAR), fill = stat(x))) + ggridges::theme_ridges(center_axis_labels = TRUE) + ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + ggplot2::scale_y_discrete(name = "Year", expand = c(0.01, 0)) + @@ -478,7 +435,7 @@ SELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA -WHERE TYPE = 'REGION' AND +WHERE AREA_TYPE = 'REGION' AND SURVEY_DEFINITION_ID = 98) -- Select columns for output data @@ -561,7 +518,7 @@ AREA_ID, AREA_NAME, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA -WHERE TYPE in ('STRATUM') AND +WHERE AREA_TYPE in ('STRATUM') AND SURVEY_DEFINITION_ID = 143) -- Select columns for output data diff --git a/content/functions.R b/content/functions.R index 7fa7f68..5992bca 100644 --- a/content/functions.R +++ b/content/functions.R @@ -51,14 +51,14 @@ fix_metadata_table <- function(metadata_table0, name0, dir_out) { metadata_table0 <- gsub(pattern = "\n", replacement = " ", x = metadata_table0) metadata_table0 <- gsub(pattern = " ", replacement = " ", x = metadata_table0) metadata_table0 <- gsub(pattern = " ", replacement = " ", x = metadata_table0) - + readr::write_lines( x = metadata_table0, file = paste0(dir_out, name0, "_comment.txt") ) # readr::write_lines(x = metadata_table, # file = paste0(dir_out, a_name, "_metadata_table.txt", collapse="\n")) - + return(metadata_table0) } @@ -73,7 +73,7 @@ update_metadata <- function( update_metadata = TRUE, share_with_all_users = TRUE) { cat("Updating Metadata ...\n") - + ## Add column metadata if (nrow(x = metadata_column) > 0) { for (i in 1:nrow(x = metadata_column)) { @@ -89,7 +89,7 @@ update_metadata <- function( x = metadata_column$colname[i], fixed = TRUE ) - + RODBC::sqlQuery( channel = channel, query = paste0( @@ -114,8 +114,8 @@ update_metadata <- function( table_metadata, "';" ) ) - - + + ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ## Grant select access to all users ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +125,7 @@ update_metadata <- function( channel = channel, query = paste0("SELECT * FROM all_users;") ) - + for (iname in sort(all_schemas$USERNAME)) { RODBC::sqlQuery( channel = channel, @@ -144,20 +144,20 @@ print_table_metadata <- function(channel, locations) { b <- dplyr::bind_rows( # tables RODBC::sqlQuery( - channel = channel, - query = "SELECT table_name, comments + channel = channel, + query = "SELECT table_name, comments FROM all_tab_comments WHERE owner = 'GAP_PRODUCTS' ORDER BY table_name") %>% - data.frame(), + data.frame(), # materialized view - RODBC::sqlQuery( - channel = channel, - query = "SELECT *FROM user_mview_comments") %>% - data.frame() %>% - dplyr::rename(TABLE_NAME = MVIEW_NAME) + RODBC::sqlQuery( + channel = channel, + query = "SELECT *FROM user_mview_comments") %>% + data.frame() %>% + dplyr::rename(TABLE_NAME = MVIEW_NAME) ) - + # Collect all column metadata for all table locations str00 <- c() for (i in 1:length(locations)) { @@ -168,18 +168,18 @@ ORDER BY table_name") %>% # strsplit(x = locations[i], split = ".", fixed = TRUE)[[1]]] if (grepl(pattern = "This table was created by", x = metadata_table)) { - metadata_table <- str_extract(metadata_table, "^.+(?= This table was created by)") + metadata_table <- str_extract(metadata_table, "^.+(?= This table was created by)") } - # Putting universal metadata language at top of page + # Putting universal metadata language at top of page if (i == 1) { if (!is.na(metadata_table) && length(metadata_table) != 0) { data_usage <- str_extract(metadata_table, "This table was created by .+$") if(!is.na(data_usage)){ - str00 <- paste0( - "## Data usage \n\n", data_usage, - "\n\n", "## Data tables", "\n\n") %>% - str_replace("This table was", "These tables were") %>% - str_replace("survey code books \\(https", "[survey code books]\\(https") + str00 <- paste0( + "## Data usage \n\n", data_usage, + "\n\n", "## Data tables", "\n\n") %>% + str_replace("This table was", "These tables were") %>% + str_replace("survey code books \\(https", "[survey code books]\\(https") } } @@ -187,18 +187,18 @@ ORDER BY table_name") %>% str00 <- paste0("## Data tables", "\n\n") } } - + metadata_table <- ifelse(is.na(metadata_table) | length(metadata_table) == 0, - "[There is currently no description for this table.]", - metadata_table + "[There is currently no description for this table.]", + metadata_table ) - + # temp <- file.size(here::here("data", paste0(locations[i], ".csv"))) temp_rows <- RODBC::sqlQuery( channel = channel, query = paste0("SELECT COUNT(*) FROM GAP_PRODUCTS.", locations[i], ";") ) - + # temp_data <- RODBC::sqlQuery(channel = channel, # query = paste0("SELECT * # FROM ", locations[i], " @@ -206,17 +206,17 @@ ORDER BY table_name") %>% # # temp_cols <- temp_data %>% # ncol() - + temp_colnames <- RODBC::sqlQuery( channel = channel, query = paste0("SELECT owner, column_name - FROM all_tab_columns - WHERE table_name = '", locations[i], "' - AND owner = 'GAP_PRODUCTS';") +FROM all_tab_columns +WHERE table_name = '", locations[i], "' +AND owner = 'GAP_PRODUCTS';") ) - + temp_cols <- nrow(temp_colnames) - + # get metadata temp_data <- RODBC::sqlQuery( channel = channel, @@ -232,7 +232,7 @@ ORDER BY table_name") %>% "Oracle data type" = metadata_datatype, "Column description" = metadata_colname_desc ) - + str00 <- paste0( str00, "### ", locations[i], "\n\n", @@ -297,20 +297,20 @@ theme_flextable_nmfstm <- function(x, if (!inherits(x, "flextable")) { stop("theme_flextable_nmfstm supports only flextable objects.") } - + FitFlextableToPage <- function(x, pgwidth = 6) { # https://stackoverflow.com/questions/57175351/flextable-autofit-in-a-rmarkdown-to-word-doc-causes-table-to-go-outside-page-mar ft_out <- x %>% flextable::autofit() - + ft_out <- flextable::width(ft_out, width = dim(ft_out)$widths * pgwidth / (flextable::flextable_dim(ft_out)$widths)) return(ft_out) } - + std_b <- officer::fp_border(width = 2, color = "grey10") thin_b <- officer::fp_border(width = 0.5, color = "grey10") - + x <- flextable::border_remove(x) - + if (row_lines == TRUE) { x <- flextable::hline(x = x, border = thin_b, part = "body") } @@ -330,8 +330,8 @@ theme_flextable_nmfstm <- function(x, # unit = "in") x <- FitFlextableToPage(x = x, pgwidth = pgwidth) # x <- flextable::line_spacing(x = x, space = spacing, part = "all") - + x <- flextable::fix_border_issues(x = x) - + return(x) } diff --git a/content/intro-news.qmd b/content/intro-news.qmd index 8682e59..96d05da 100644 --- a/content/intro-news.qmd +++ b/content/intro-news.qmd @@ -2,10 +2,6 @@ title: News --- -## Future plans - -[insert text if section is appropriate] - ## News/change logs ```{r news-source-pull} diff --git a/docs/GAP-Production-Data-Documentation.docx b/docs/GAP-Production-Data-Documentation.docx index 694a82d..bbb1180 100644 Binary files a/docs/GAP-Production-Data-Documentation.docx and b/docs/GAP-Production-Data-Documentation.docx differ diff --git a/docs/GAP-Production-Data-Documentation.pdf b/docs/GAP-Production-Data-Documentation.pdf index 5caf569..fa3472e 100644 Binary files a/docs/GAP-Production-Data-Documentation.pdf and b/docs/GAP-Production-Data-Documentation.pdf differ diff --git a/docs/content/akfin-oracle-sql-r.html b/docs/content/akfin-oracle-sql-r.html index 5a9f302..96c6e45 100644 --- a/docs/content/akfin-oracle-sql-r.html +++ b/docs/content/akfin-oracle-sql-r.html @@ -326,14 +326,15 @@

Table of contents

  • Data SQL Query Examples:
  • @@ -391,8 +392,8 @@

    Data SQ library(magrittr) library(dplyr) -
    -

    7.0.2 Ex. Select all data from a table

    +
    +

    7.0.2 Ex. Select all data from tables

    You can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the R environment.

    locations <- c(
    @@ -419,108 +420,159 @@ 

    }

    -
    -

    7.0.3 Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod.

    +
    +

    7.0.3 Ex. CPUE for all EBS and NBS stations with associated haul, cruise, and species information.

    -
    dat <- RODBC::sqlQuery(channel = channel,
    -                       query =
    +
    a <- RODBC::sqlQuery(channel = channel, # NOT RACEBASE.HAUL
    +                     query = paste0(
     "
     -- Select columns for output data
    -SELECT 
    -HAULJOIN, 
    -SPECIES_CODE, 
    -STRATUM, 
    -LATITUDE_DD_START, 
    -LONGITUDE_DD_START,
    -CPUE_KGKM2, 
    -GEAR_TEMPERATURE_C
    -
    --- Identify what tables to pull data from
    -FROM GAP_PRODUCTS.AKFIN_CPUE cpue
    -LEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul
    -USING (HAULJOIN) 
    -
    --- Filter for P. Cod observations
    -WHERE SPECIES_CODE IN (21720)
    -
    --- Select all stratum within the area_id 919 (INPFC Shumagin region)
    -AND haul.STRATUM IN
    -(
    -SELECT 
    -STRATUM
    -FROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS 
    -WHERE AREA_ID = 919
    -);")
    +SELECT +cr.CRUISEJOIN, +cr.CRUISE, +cr.YEAR, +cr.SURVEY_DEFINITION_ID, +cr.SURVEY_NAME, +cr.VESSEL_ID, +cr.VESSEL_NAME, +cp.HAULJOIN, +cp.SPECIES_CODE, +tt.SPECIES_NAME, +tt.COMMON_NAME, +cp.WEIGHT_KG, +cp.COUNT, +cp.AREA_SWEPT_KM2, +cp.CPUE_KGKM2, +cp.CPUE_NOKM2, +hh.HAUL, +hh.STATION + +-- Identify what tables to pull data from +FROM GAP_PRODUCTS.AKFIN_HAUL hh +LEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cr +ON hh.CRUISEJOIN = cr.CRUISEJOIN +LEFT JOIN GAP_PRODUCTS.AKFIN_CPUE cp +ON hh.HAULJOIN = cp.HAULJOIN +LEFT JOIN GAP_PRODUCTS.TAXONOMIC_CLASSIFICATION tt +ON cp.SPECIES_CODE = tt.SPECIES_CODE + +-- Filter for EBS and NBS observations +WHERE SURVEY_DEFINITION_ID IN (143, 98) -- 143 NBS, 98 EBS +AND tt.SURVEY_SPECIES = 1 + +-- Only return the first 3 rows because otherwise this would be a huge table! +FETCH FIRST 3 ROWS ONLY;")) + +flextable::flextable(head(a)) %>% theme_zebra()
    +
    + +

    Ex.: CPUE for all EBS and NBS stations with associated haul, cruise, +and species information.

    CRUISEJOIN

    CRUISE

    YEAR

    SURVEY_DEFINITION_ID

    SURVEY_NAME

    VESSEL_ID

    VESSEL_NAME

    HAULJOIN

    SPECIES_CODE

    SPECIES_NAME

    COMMON_NAME

    WEIGHT_KG

    COUNT

    AREA_SWEPT_KM2

    CPUE_KGKM2

    CPUE_NOKM2

    HAUL

    STATION

    80

    198,203

    1,982

    98

    Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey

    1

    CHAPMAN

    877

    1

    fish egg unid.

    0

    0

    0.042021

    0

    0

    21

    G-10

    80

    198,203

    1,982

    98

    Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey

    1

    CHAPMAN

    877

    2

    fish larvae unid.

    0

    0

    0.042021

    0

    0

    21

    G-10

    80

    198,203

    1,982

    98

    Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey

    1

    CHAPMAN

    877

    3

    fish unid.

    0

    0

    0.042021

    0

    0

    21

    G-10

    +
    +
    +
    +
    +

    7.0.4 Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod.

    +
    +
    dat <- RODBC::sqlQuery(channel = channel,
    +                       query =
    +"
    +-- Select columns for output data
    +SELECT 
    +HAULJOIN, 
    +SPECIES_CODE, 
    +STRATUM, 
    +LATITUDE_DD_START, 
    +LONGITUDE_DD_START,
    +CPUE_KGKM2, 
    +GEAR_TEMPERATURE_C
    +
    +-- Identify what tables to pull data from
    +FROM GAP_PRODUCTS.AKFIN_CPUE cpue
    +LEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul
    +USING (HAULJOIN) 
    +
    +-- Filter for P. Cod observations
    +WHERE SPECIES_CODE IN (21720)
    +
    +-- Select all stratum within the area_id 919 (INPFC Shumagin region)
    +AND haul.STRATUM IN
    +(
    +SELECT 
    +STRATUM
    +FROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS 
    +WHERE AREA_ID = 919
    +);")
    -
    dat <- dat %>% 
    -  dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% 
    -  dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), 
    -                STRATUM = as.character(STRATUM)) %>% 
    -  dplyr::arrange(SPECIES_CODE)
    -
    -flextable::flextable(head(dat)) %>% theme_zebra()
    +
    dat <- dat %>% 
    +  dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% 
    +  dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), 
    +                STRATUM = as.character(STRATUM)) %>% 
    +  dplyr::arrange(SPECIES_CODE)
    +
    +flextable::flextable(head(dat)) %>% theme_zebra()
    -

    Ex. 8: CPUE for all stations contained in the Shumagin region -(AREA_ID = 919).

    HAULJOIN

    STRATUM

    SPECIES_CODE

    LATITUDE_DD_START

    LONGITUDE_DD_START

    CPUE_KGKM2

    GEAR_TEMPERATURE_C

    -22,239

    12

    21720

    55.43748

    -160.1269

    717.63085

    4.5

    -22,215

    13

    21720

    54.58732

    -161.1945

    76.90763

    4.3

    -22,168

    11

    21720

    54.45823

    -163.0872

    2,004.49628

    4.9

    -22,204

    110

    21720

    54.51804

    -160.7493

    0.00000

    4.7

    -22,188

    210

    21720

    54.38733

    -159.6986

    0.00000

    5.5

    -22,183

    210

    21720

    54.09314

    -161.6996

    0.00000

    5.3

    +

    Ex. 8: CPUE for all stations contained in the Shumagin region +(AREA_ID = 919).

    HAULJOIN

    STRATUM

    SPECIES_CODE

    LATITUDE_DD_START

    LONGITUDE_DD_START

    CPUE_KGKM2

    GEAR_TEMPERATURE_C

    -22,270

    13

    21720

    55.11515

    -159.3512

    209.28994

    4.3

    -22,250

    13

    21720

    55.05143

    -159.9679

    8,700.92017

    5.1

    -22,238

    13

    21720

    55.11365

    -159.4264

    363.17325

    4.4

    -22,214

    13

    21720

    54.78608

    -160.0008

    63.71506

    4.6

    -22,202

    111

    21720

    54.48341

    -159.7261

    618.72120

    4.7

    -22,247

    112

    21720

    55.59093

    -160.0740

    114.73042

    4.0

    -
    -

    7.0.4 Ex. EBS Pacific Ocean perch CPUE and akgfmaps map

    +
    +

    7.0.5 Ex. EBS Pacific Ocean perch CPUE and akgfmaps map

    Pacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from GAP_PRODUCTS.AKFIN_CPUE and map constructed using akgfmaps. Here, we’ll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their RACEBASE analogs.

    -
    dat <- RODBC::sqlQuery(channel = channel, 
    -                       query = 
    -"
    --- Select columns for output data
    -SELECT 
    -(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares
    -hh.LATITUDE_DD_START LATITUDE,
    -hh.LONGITUDE_DD_START LONGITUDE
    -
    --- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin
    -FROM GAP_PRODUCTS.AKFIN_CPUE cp
    -LEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh
    -ON cp.HAULJOIN = hh.HAULJOIN
    -
    --- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID
    -LEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc
    -ON hh.CRUISEJOIN = cc.CRUISEJOIN
    -
    --- Filter data
    -WHERE cp.SPECIES_CODE = 30060 
    -AND cc.SURVEY_DEFINITION_ID = 98 
    -AND cc.YEAR = 2021;")
    +
    dat <- RODBC::sqlQuery(channel = channel, 
    +                       query = 
    +"
    +-- Select columns for output data
    +SELECT 
    +(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares
    +hh.LATITUDE_DD_START LATITUDE,
    +hh.LONGITUDE_DD_START LONGITUDE
    +
    +-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin
    +FROM GAP_PRODUCTS.AKFIN_CPUE cp
    +LEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh
    +ON cp.HAULJOIN = hh.HAULJOIN
    +
    +-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID
    +LEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc
    +ON hh.CRUISEJOIN = cc.CRUISEJOIN
    +
    +-- Filter data
    +WHERE cp.SPECIES_CODE = 30060 
    +AND cc.SURVEY_DEFINITION_ID = 98 
    +AND cc.YEAR = 2021;")
    -
    flextable::flextable(head(dat)) %>% theme_zebra()
    +
    flextable::flextable(head(dat)) %>% theme_zebra()
    -

    Ex. 6: EBS Pacific Ocean perch CPUE and akgfmaps -map.

    CPUE_KGHA

    LATITUDE

    LONGITUDE

    0.0000000

    58.75863

    -174.9285

    0.2813533

    57.32545

    -173.3217

    0.0000000

    57.64161

    -172.7963

    0.0000000

    59.67831

    -172.5754

    0.0000000

    60.96936

    -174.8760

    0.0000000

    58.64012

    -173.5922

    +

    Ex. 6: EBS Pacific Ocean perch CPUE and akgfmaps +map.

    CPUE_KGHA

    LATITUDE

    LONGITUDE

    0.00000000

    60.67043

    -178.0946

    0.00000000

    60.31361

    -176.0138

    0.00000000

    60.35098

    -175.3850

    0.00000000

    60.99712

    -177.6638

    0.00000000

    60.96495

    -176.2634

    0.02416379

    58.97844

    -175.7204

    -
    # devtools::install_github("afsc-gap-products/akgfmaps", build_vignettes = TRUE)
    -library(akgfmaps)
    -
    -figure <- akgfmaps::make_idw_map(
    -  x = dat, # Pass data as a data frame
    -  region = "bs.south", # Predefined EBS area
    -  set.breaks = "jenks", # Gets Jenks breaks from classint::classIntervals()
    -  in.crs = "+proj=longlat", # Set input coordinate reference system
    -  out.crs = "EPSG:3338", # Set output coordinate reference system
    -  grid.cell = c(20000, 20000), # 20x20km grid
    -  key.title = "Pacific Ocean perch") # Include in the legend title
    +
    # devtools::install_github("afsc-gap-products/akgfmaps", build_vignettes = TRUE)
    +library(akgfmaps)
    +
    +figure <- akgfmaps::make_idw_map(
    +  x = dat, # Pass data as a data frame
    +  region = "bs.south", # Predefined EBS area
    +  set.breaks = "jenks", # Gets Jenks breaks from classint::classIntervals()
    +  in.crs = "+proj=longlat", # Set input coordinate reference system
    +  out.crs = "EPSG:3338", # Set output coordinate reference system
    +  grid.cell = c(20000, 20000), # 20x20km grid
    +  key.title = "Pacific Ocean perch") # Include in the legend title
    [inverse distance weighted interpolation]
     [inverse distance weighted interpolation]
    -
    figure$plot + 
    -  ggplot2::guides(fill=guide_legend(title = "Pacific Ocean perch\nCPUE (kg/km2)"))  |>   
    -  change_fill_color(new.scheme = "grey", show.plot = FALSE)
    +
    figure$plot + 
    +  ggplot2::guides(fill=guide_legend(title = "Pacific Ocean perch\nCPUE (kg/km2)"))  |>   
    +  change_fill_color(new.scheme = "grey", show.plot = FALSE)
    @@ -531,77 +583,77 @@

    -

    7.0.5 Ex. GOA Pacific Ocean perch biomass and abundance

    +
    +

    7.0.6 Ex. GOA Pacific Ocean perch biomass and abundance

    Biomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region.

    -
    dat <- RODBC::sqlQuery(channel = channel, 
    -                       query = 
    -"
    --- Manipulate data to join to
    -WITH FILTERED_STRATA AS (
    -SELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA
    -WHERE TYPE in ('REGULATORY_AREA', 'REGION') 
    -AND SURVEY_DEFINITION_ID = 47)
    -
    --- Select columns for output data
    -SELECT 
    -BIOMASS_MT,
    -POPULATION_COUNT, 
    -YEAR, 
    -DESCRIPTION
    -
    --- Identify what tables to pull data from
    -FROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS
    -JOIN FILTERED_STRATA STRATA 
    -ON STRATA.AREA_ID = BIOMASS.AREA_ID
    -
    --- Filter data results
    -WHERE BIOMASS.SPECIES_CODE = 30060")
    +
    dat <- RODBC::sqlQuery(channel = channel, 
    +                       query = 
    +"
    +-- Manipulate data to join to
    +WITH FILTERED_STRATA AS (
    +SELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA
    +WHERE AREA_TYPE in ('REGULATORY_AREA', 'REGION') 
    +AND SURVEY_DEFINITION_ID = 47)
    +
    +-- Select columns for output data
    +SELECT 
    +BIOMASS_MT,
    +POPULATION_COUNT, 
    +YEAR, 
    +DESCRIPTION
    +
    +-- Identify what tables to pull data from
    +FROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS
    +JOIN FILTERED_STRATA STRATA 
    +ON STRATA.AREA_ID = BIOMASS.AREA_ID
    +
    +-- Filter data results
    +WHERE BIOMASS.SPECIES_CODE = 30060")
    -
    dat0 <- dat %>% 
    -  janitor::clean_names() %>% 
    -  dplyr::select(biomass_mt, population_count, year, area = description) %>%
    -  pivot_longer(cols = c("biomass_mt", "population_count"), 
    -               names_to = "var", 
    -               values_to = "val") %>% 
    -  dplyr::mutate(
    -    val = ifelse(var == "biomass_mt", val/1e6, val/1e9), 
    -    var = ifelse(var == "biomass_mt", "Biomass (Mmt)", "Population (B)"), 
    -    area = gsub(x = area, pattern = " - ", replacement = "\n"), 
    -    area = gsub(x = area, pattern = ": ", replacement = "\n"), 
    -    type = sapply(X = strsplit(x = area, split = "\n", fixed = TRUE), `[[`, 2))  %>% 
    -  dplyr::arrange(type) %>% 
    -  dplyr::mutate(
    -    area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))
    -
    -flextable::flextable(head(dat)) %>% 
    -  theme_zebra() %>%
    -  flextable::colformat_num(x = ., j = "YEAR", big.mark = "")
    +
    dat0 <- dat %>% 
    +  janitor::clean_names() %>% 
    +  dplyr::select(biomass_mt, population_count, year, area = description) %>%
    +  pivot_longer(cols = c("biomass_mt", "population_count"), 
    +               names_to = "var", 
    +               values_to = "val") %>% 
    +  dplyr::mutate(
    +    val = ifelse(var == "biomass_mt", val/1e6, val/1e9), 
    +    var = ifelse(var == "biomass_mt", "Biomass (Mmt)", "Population (B)"), 
    +    area = gsub(x = area, pattern = " - ", replacement = "\n"), 
    +    area = gsub(x = area, pattern = ": ", replacement = "\n"), 
    +    type = sapply(X = strsplit(x = area, split = "\n", fixed = TRUE), `[[`, 2))  %>% 
    +  dplyr::arrange(type) %>% 
    +  dplyr::mutate(
    +    area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))
    +
    +flextable::flextable(head(dat)) %>% 
    +  theme_zebra() %>%
    +  flextable::colformat_num(x = ., j = "YEAR", big.mark = "")
    -

    Ex. 1: GOA Pacific Ocean perch biomass and abundance.

    BIOMASS_MT

    POPULATION_COUNT

    YEAR

    DESCRIPTION

    483,622.6

    833,902,161

    1993

    GOA Region: All Strata

    483,622.6

    833,902,161

    1993

    GOA Region: All Strata

    771,412.8

    1,252,616,603

    1996

    GOA Region: All Strata

    771,412.8

    1,252,616,603

    1996

    GOA Region: All Strata

    727,063.5

    1,212,034,913

    1999

    GOA Region: All Strata

    727,063.5

    1,212,034,913

    1999

    GOA Region: All Strata

    +

    Ex. 1: GOA Pacific Ocean perch biomass and abundance.

    BIOMASS_MT

    POPULATION_COUNT

    YEAR

    DESCRIPTION

    157,295.1

    317,129,408

    1990

    GOA Region: All Strata

    157,295.1

    317,129,408

    1990

    GOA Region: All Strata

    483,622.6

    833,902,161

    1993

    GOA Region: All Strata

    483,622.6

    833,902,161

    1993

    GOA Region: All Strata

    771,412.8

    1,252,616,603

    1996

    GOA Region: All Strata

    771,412.8

    1,252,616,603

    1996

    GOA Region: All Strata

    -
    # install.packages("scales")
    -library(scales)
    -figure <- ggplot2::ggplot(
    -  dat = dat0, 
    -  mapping = aes(x = year, y = val, color = type)) +
    -  ggplot2::geom_point(size = 3) + 
    -  ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = "free_y") + 
    -  ggplot2::scale_x_continuous(name = "Year", n.breaks = 3) +
    -  ggplot2::scale_y_continuous(name = "Estimate", labels = comma) +
    -  ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023')  + 
    -  ggplot2::guides(color=guide_legend(title = "Region Type"))+
    -  ggplot2::scale_color_grey() +
    -  ggplot2::theme_bw() +
    -  ggplot2::theme(legend.direction = "horizontal", 
    -                 legend.position = "bottom")
    -
    -figure
    +
    # install.packages("scales")
    +library(scales)
    +figure <- ggplot2::ggplot(
    +  dat = dat0, 
    +  mapping = aes(x = year, y = val, color = type)) +
    +  ggplot2::geom_point(size = 3) + 
    +  ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = "free_y") + 
    +  ggplot2::scale_x_continuous(name = "Year", n.breaks = 3) +
    +  ggplot2::scale_y_continuous(name = "Estimate", labels = comma) +
    +  ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023')  + 
    +  ggplot2::guides(color=guide_legend(title = "Region Type"))+
    +  ggplot2::scale_color_grey() +
    +  ggplot2::theme_bw() +
    +  ggplot2::theme(legend.direction = "horizontal", 
    +                 legend.position = "bottom")
    +
    +figure
    @@ -612,63 +664,65 @@

    -

    7.0.6 Ex. AI rock sole size compositions and ridge plot

    +
    +

    7.0.7 Ex. AI rock sole size compositions and ridge plot

    Northern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from ggridges.

    -
    dat <- RODBC::sqlQuery(channel = channel, 
    -                       query = 
    -"
    --- Manipulate data to join to
    -WITH FILTERED_STRATA AS (
    -SELECT 
    -AREA_ID, 
    -DESCRIPTION 
    -
    --- Identify what tables to pull data from
    -FROM GAP_PRODUCTS.AKFIN_AREA
    -WHERE TYPE = 'REGION' 
    -AND SURVEY_DEFINITION_ID = 52)
    -
    --- Select columns for output data
    -SELECT 
    -LENGTH_MM, 
    -YEAR
    -FROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP
    -JOIN FILTERED_STRATA STRATA 
    -ON STRATA.AREA_ID = SIZECOMP.AREA_ID
    -
    --- Filter data results
    -WHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 
    -AND SIZECOMP.SPECIES_CODE IN (10261, 10262)")
    +
    dat <- RODBC::sqlQuery(channel = channel, 
    +                       query = 
    +"
    +-- Manipulate data to join to
    +WITH FILTERED_STRATA AS (
    +SELECT 
    +AREA_ID, 
    +DESCRIPTION
    +
    +-- Identify what tables to pull data from
    +FROM GAP_PRODUCTS.AKFIN_AREA
    +WHERE AREA_TYPE = 'REGION' 
    +AND SURVEY_DEFINITION_ID = 52)
    +
    +-- Select columns for output data
    +SELECT 
    +LENGTH_MM, 
    +YEAR
    +FROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP
    +JOIN FILTERED_STRATA STRATA 
    +ON STRATA.AREA_ID = SIZECOMP.AREA_ID
    +
    +-- Filter data results
    +WHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 
    +AND SIZECOMP.SPECIES_CODE IN (10261, 10262)")
    -
    dat0 <- dat %>% 
    -  janitor::clean_names() %>% 
    -  dplyr::mutate(length_cm = length_mm/10)
    -flextable::flextable(head(dat)) %>% 
    -  theme_zebra() %>%
    -    flextable::colformat_num(x = ., j = "YEAR", big.mark = "")
    +
    dat0 <- dat %>% 
    +  janitor::clean_names() %>% 
    +  dplyr::mutate(length_cm = length_mm/10) %>% 
    +  head() %>% 
    +  flextable::flextable() %>% 
    +  flextable::theme_zebra() %>%
    +    flextable::colformat_num(x = ., j = "year", big.mark = "")
    +dat0
    -

    Ex. 2: AI Rock sole size compositions and ridge plot.

    LENGTH_MM

    YEAR

    180

    2014

    190

    2014

    200

    2014

    210

    2014

    220

    2014

    230

    2014

    +

    Ex. 2: AI Rock sole size compositions and ridge plot.

    length_mm

    year

    length_cm

    110

    1997

    11

    130

    1997

    13

    140

    1997

    14

    150

    1997

    15

    160

    1997

    16

    170

    1997

    17

    -
    # install.packages("ggridges")
    -library(ggridges)
    -figure <- 
    -  ggplot2::ggplot(
    -    data = dat0, 
    -    mapping = aes(x = length_cm, y = as.factor(year), fill = stat(x))) +
    -  ggridges::theme_ridges(center_axis_labels = TRUE) + 
    -  ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + 
    -  ggplot2::scale_y_discrete(name = "Year", expand = c(0.01, 0)) +
    -  ggplot2::scale_x_continuous(name = "Length (cm)", expand = c(0.01, 0)) +
    -  # ggplot2::scale_fill_grey() +
    -  ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') 
    -
    -figure
    +
    # install.packages("ggridges")
    +library(ggridges)
    +figure <- 
    +  ggplot2::ggplot(
    +    data = dat, 
    +    mapping = aes(x = LENGTH_MM, y = as.factor(YEAR), fill = stat(x))) +
    +  ggridges::theme_ridges(center_axis_labels = TRUE) + 
    +  ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + 
    +  ggplot2::scale_y_discrete(name = "Year", expand = c(0.01, 0)) +
    +  ggplot2::scale_x_continuous(name = "Length (cm)", expand = c(0.01, 0)) +
    +  # ggplot2::scale_fill_grey() +
    +  ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') 
    +
    +figure
    @@ -679,69 +733,69 @@

    -

    7.0.7 Ex. EBS Walleye Pollock Age Compositions and Age Pyramid

    +
    +

    7.0.8 Ex. EBS Walleye Pollock Age Compositions and Age Pyramid

    Walleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot.

    -
    dat <- RODBC::sqlQuery(channel = channel, 
    -                       query = 
    -"
    --- Manipulate data to join to
    -WITH FILTERED_STRATA AS (
    -SELECT 
    -AREA_ID, 
    -DESCRIPTION 
    -FROM GAP_PRODUCTS.AKFIN_AREA
    -WHERE TYPE = 'REGION' AND 
    -SURVEY_DEFINITION_ID = 98)
    -
    --- Select columns for output data
    -SELECT 
    -AGECOMP.AGE, 
    -AGECOMP.POPULATION_COUNT, 
    -AGECOMP.SEX
    -
    --- Identify what tables to pull data from
    -FROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP
    -JOIN FILTERED_STRATA STRATA 
    -ON STRATA.AREA_ID = AGECOMP.AREA_ID
    -
    --- Filter data results
    -WHERE SPECIES_CODE = 21740
    -AND AGE >= 0")
    +
    dat <- RODBC::sqlQuery(channel = channel, 
    +                       query = 
    +"
    +-- Manipulate data to join to
    +WITH FILTERED_STRATA AS (
    +SELECT 
    +AREA_ID, 
    +DESCRIPTION 
    +FROM GAP_PRODUCTS.AKFIN_AREA
    +WHERE AREA_TYPE = 'REGION' AND 
    +SURVEY_DEFINITION_ID = 98)
    +
    +-- Select columns for output data
    +SELECT 
    +AGECOMP.AGE, 
    +AGECOMP.POPULATION_COUNT, 
    +AGECOMP.SEX
    +
    +-- Identify what tables to pull data from
    +FROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP
    +JOIN FILTERED_STRATA STRATA 
    +ON STRATA.AREA_ID = AGECOMP.AREA_ID
    +
    +-- Filter data results
    +WHERE SPECIES_CODE = 21740
    +AND AGE >= 0")
    -
    dat0 <- dat %>% 
    -  janitor::clean_names() %>% 
    -  dplyr::filter(sex %in% c(1,2)) %>%
    -  dplyr::mutate(
    -    sex = ifelse(sex == 1, "M", "F"),
    -    population_count = # change male population to negative
    -      ifelse(sex=="M", population_count*(-1), population_count*1)/1e9) 
    -
    -flextable::flextable(head(dat)) %>% theme_zebra()
    +
    dat0 <- dat %>% 
    +  janitor::clean_names() %>% 
    +  dplyr::filter(sex %in% c(1,2)) %>%
    +  dplyr::mutate(
    +    sex = ifelse(sex == 1, "M", "F"),
    +    population_count = # change male population to negative
    +      ifelse(sex=="M", population_count*(-1), population_count*1)/1e9) 
    +
    +flextable::flextable(head(dat)) %>% theme_zebra()
    -

    Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid.

    AGE

    POPULATION_COUNT

    SEX

    9

    39,371

    3

    10

    32,156

    3

    11

    15,200

    3

    12

    9,976

    3

    13

    1,957

    3

    1

    131,950,343

    1

    +

    Ex. 3: EBS Walleye Pollock Age Compositions and Age Pyramid.

    AGE

    POPULATION_COUNT

    SEX

    11

    48,791,451

    2

    12

    120,673,580

    2

    13

    42,580,054

    2

    14

    47,229,378

    2

    15

    25,140,523

    2

    16

    19,473,255

    2

    -
    figure <- ggplot2::ggplot(
    -  data = dat0, 
    -  mapping = 
    -                 aes(x = age,
    -                     y = population_count, 
    -                     fill = sex)) +
    -  ggplot2::scale_fill_grey() +
    -  ggplot2::geom_bar(stat = "identity") +
    -  ggplot2::coord_flip() +
    -  ggplot2::scale_x_continuous(name = "Age") +
    -  ggplot2::scale_y_continuous(name = "Population (billions)", labels = abs) +
    -  ggplot2::ggtitle(label = "EBS Walleye Pollock Age Compositions 1982 – 2022")  + 
    -  ggplot2::guides(fill = guide_legend(title = "Sex"))+
    -  ggplot2::theme_bw()
    -
    -figure
    +
    figure <- ggplot2::ggplot(
    +  data = dat0, 
    +  mapping = 
    +                 aes(x = age,
    +                     y = population_count, 
    +                     fill = sex)) +
    +  ggplot2::scale_fill_grey() +
    +  ggplot2::geom_bar(stat = "identity") +
    +  ggplot2::coord_flip() +
    +  ggplot2::scale_x_continuous(name = "Age") +
    +  ggplot2::scale_y_continuous(name = "Population (billions)", labels = abs) +
    +  ggplot2::ggtitle(label = "EBS Walleye Pollock Age Compositions 1982 – 2022")  + 
    +  ggplot2::guides(fill = guide_legend(title = "Sex"))+
    +  ggplot2::theme_bw()
    +
    +figure
    @@ -752,74 +806,74 @@

    -

    7.0.8 Ex. NBS Pacific cod biomass and abundance

    +
    +

    7.0.9 Ex. NBS Pacific cod biomass and abundance

    Pacific cod biomass and abundance data for the NBS by stratum.

    -
    dat <- RODBC::sqlQuery(channel = channel, 
    -                       query = 
    -"
    --- Manipulate data to join to
    -WITH FILTERED_STRATA AS (
    -SELECT 
    -AREA_ID, 
    -AREA_NAME, 
    -DESCRIPTION 
    -FROM GAP_PRODUCTS.AKFIN_AREA
    -WHERE TYPE in ('STRATUM') AND 
    -SURVEY_DEFINITION_ID = 143) 
    -
    --- Select columns for output data
    -SELECT 
    -BIOMASS.BIOMASS_MT, 
    -BIOMASS.POPULATION_COUNT, 
    -BIOMASS.YEAR, 
    -STRATA.AREA_NAME
    -
    --- Identify what tables to pull data from
    -FROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS 
    -JOIN FILTERED_STRATA STRATA 
    -ON STRATA.AREA_ID = BIOMASS.AREA_ID
    -
    --- Filter data results
    -WHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 
    -AND BIOMASS.SPECIES_CODE = 21720")
    +
    dat <- RODBC::sqlQuery(channel = channel, 
    +                       query = 
    +"
    +-- Manipulate data to join to
    +WITH FILTERED_STRATA AS (
    +SELECT 
    +AREA_ID, 
    +AREA_NAME, 
    +DESCRIPTION 
    +FROM GAP_PRODUCTS.AKFIN_AREA
    +WHERE AREA_TYPE in ('STRATUM') AND 
    +SURVEY_DEFINITION_ID = 143) 
    +
    +-- Select columns for output data
    +SELECT 
    +BIOMASS.BIOMASS_MT, 
    +BIOMASS.POPULATION_COUNT, 
    +BIOMASS.YEAR, 
    +STRATA.AREA_NAME
    +
    +-- Identify what tables to pull data from
    +FROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS 
    +JOIN FILTERED_STRATA STRATA 
    +ON STRATA.AREA_ID = BIOMASS.AREA_ID
    +
    +-- Filter data results
    +WHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 
    +AND BIOMASS.SPECIES_CODE = 21720")
    -
    dat0 <- dat %>% 
    -  janitor::clean_names() %>% 
    -  dplyr::select(biomass_mt, population_count, year, area = area_name) %>%
    -  pivot_longer(cols = c("biomass_mt", "population_count"), 
    -               names_to = "var", 
    -               values_to = "val") %>% 
    -  dplyr::mutate(
    -    val = ifelse(var == "biomass_mt", val/1e6, val/1e9), 
    -    var = ifelse(var == "biomass_mt", "Biomass (Mmt)", "Population (B)"), 
    -    area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))
    -flextable::flextable(head(dat)) %>% 
    -  theme_zebra() %>%
    -  flextable::colformat_num(x = ., j = "YEAR", big.mark = "")
    +
    dat0 <- dat %>% 
    +  janitor::clean_names() %>% 
    +  dplyr::select(biomass_mt, population_count, year, area = area_name) %>%
    +  pivot_longer(cols = c("biomass_mt", "population_count"), 
    +               names_to = "var", 
    +               values_to = "val") %>% 
    +  dplyr::mutate(
    +    val = ifelse(var == "biomass_mt", val/1e6, val/1e9), 
    +    var = ifelse(var == "biomass_mt", "Biomass (Mmt)", "Population (B)"), 
    +    area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))
    +flextable::flextable(head(dat)) %>% 
    +  theme_zebra() %>%
    +  flextable::colformat_num(x = ., j = "YEAR", big.mark = "")
    -

    Ex. 4: NBS Pacific cod biomass and abundance.

    BIOMASS_MT

    POPULATION_COUNT

    YEAR

    AREA_NAME

    95,849.983

    68,767,498

    2021

    Inner Domain

    107,096.730

    102,734,142

    2019

    Inner Domain

    76,708.433

    39,605,860

    2023

    Inner Domain

    132,490.152

    66,187,245

    2017

    Inner Domain

    96,500.697

    60,433,135

    2022

    Inner Domain

    7,462.559

    4,724,153

    2010

    Inner Domain

    +

    Ex. 4: NBS Pacific cod biomass and abundance.

    BIOMASS_MT

    POPULATION_COUNT

    YEAR

    AREA_NAME

    7,462.559

    4,724,153

    2010

    Inner Domain

    95,849.983

    68,767,498

    2021

    Inner Domain

    107,096.730

    102,734,142

    2019

    Inner Domain

    76,708.433

    39,605,860

    2023

    Inner Domain

    132,490.152

    66,187,245

    2017

    Inner Domain

    96,500.697

    60,433,135

    2022

    Inner Domain

    -
    figure <- ggplot2::ggplot(
    -  dat = dat0, 
    -  mapping = aes(y = val, x = year, fill = area))  + 
    -  ggplot2::geom_bar(position="stack", stat="identity") +  
    -  ggplot2::facet_grid(rows = vars(var), scales = "free_y") +
    -  ggplot2::scale_y_continuous(name = "Estimate", labels = comma) +
    -  ggplot2::scale_x_continuous(name = "Year", breaks = unique(dat0$year)) +
    -  ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum')  + 
    -  ggplot2::guides(fill=guide_legend(title = "Region Type"))+
    -  ggplot2::scale_fill_grey() +
    -  ggplot2::theme_bw() +
    -  ggplot2::theme(legend.direction = "horizontal", 
    -                 legend.position = "bottom")
    -
    -figure
    +
    figure <- ggplot2::ggplot(
    +  dat = dat0, 
    +  mapping = aes(y = val, x = year, fill = area))  + 
    +  ggplot2::geom_bar(position="stack", stat="identity") +  
    +  ggplot2::facet_grid(rows = vars(var), scales = "free_y") +
    +  ggplot2::scale_y_continuous(name = "Estimate", labels = comma) +
    +  ggplot2::scale_x_continuous(name = "Year", breaks = unique(dat0$year)) +
    +  ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum')  + 
    +  ggplot2::guides(fill=guide_legend(title = "Region Type"))+
    +  ggplot2::scale_fill_grey() +
    +  ggplot2::theme_bw() +
    +  ggplot2::theme(legend.direction = "horizontal", 
    +                 legend.position = "bottom")
    +
    +figure
    @@ -830,86 +884,86 @@

    -

    7.0.9 Ex. GOA Pacific Ocean perch biomass and line plot

    +
    +

    7.0.10 Ex. GOA Pacific Ocean perch biomass and line plot

    Pacific Ocean perch biomass totals for GOA between 1984-2021 from GAP_PRODUCTS.AKFIN_BIOMASS

    -
    dat <- RODBC::sqlQuery(channel = channel, 
    -                       query = 
    -"
    --- Select columns for output data
    -SELECT 
    -SURVEY_DEFINITION_ID, 
    -BIOMASS_MT, 
    -BIOMASS_VAR, 
    -YEAR
    -
    --- Identify what tables to pull data from
    -FROM GAP_PRODUCTS.AKFIN_BIOMASS
    -
    --- Filter data results
    -WHERE SPECIES_CODE = 30060 
    -AND SURVEY_DEFINITION_ID = 47 
    -AND AREA_ID = 99903 
    -AND YEAR BETWEEN 1984 AND 2023;") %>% 
    -  janitor::clean_names() %>% 
    -  dplyr::mutate(biomass_kmt = biomass_mt/1000, 
    -                # **approximate** 95% confidence interval
    -                biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, 
    -                biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) 
    +
    dat <- RODBC::sqlQuery(channel = channel, 
    +                       query = 
    +"
    +-- Select columns for output data
    +SELECT 
    +SURVEY_DEFINITION_ID, 
    +BIOMASS_MT, 
    +BIOMASS_VAR, 
    +YEAR
    +
    +-- Identify what tables to pull data from
    +FROM GAP_PRODUCTS.AKFIN_BIOMASS
    +
    +-- Filter data results
    +WHERE SPECIES_CODE = 30060 
    +AND SURVEY_DEFINITION_ID = 47 
    +AND AREA_ID = 99903 
    +AND YEAR BETWEEN 1984 AND 2023;") %>% 
    +  janitor::clean_names() %>% 
    +  dplyr::mutate(biomass_kmt = biomass_mt/1000, 
    +                # **approximate** 95% confidence interval
    +                biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, 
    +                biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) 
    -
    flextable::flextable(head(dat)) %>%
    -  theme_zebra() %>%
    -  flextable::colformat_num(x = ., j = "year", big.mark = "")
    +
    flextable::flextable(head(dat)) %>%
    +  theme_zebra() %>%
    +  flextable::colformat_num(x = ., j = "year", big.mark = "")
    -

    Ex. 5: GOA Pacific Ocean perch biomass and line plot.

    survey_definition_id

    biomass_mt

    biomass_var

    year

    biomass_kmt

    biomass_kci_up

    biomass_kci_dw

    47

    483,622.6

    11,803,384,787

    1993

    483.6226

    700.9093

    266.33581

    47

    771,412.8

    41,434,152,202

    1996

    771.4128

    1,178.5204

    364.30515

    47

    727,063.5

    150,983,542,178

    1999

    727.0635

    1,504.1955

    -50.06854

    47

    673,155.1

    49,285,342,922

    2001

    673.1551

    1,117.1611

    229.14901

    47

    457,421.6

    5,186,126,529

    2003

    457.4216

    601.4511

    313.39204

    47

    764,901.4

    21,499,807,010

    2005

    764.9014

    1,058.1577

    471.64517

    +

    Ex. 5: GOA Pacific Ocean perch biomass and line plot.

    survey_definition_id

    biomass_mt

    biomass_var

    year

    biomass_kmt

    biomass_kci_up

    biomass_kci_dw

    47

    157,295.1

    2,221,176,968

    1990

    157.2951

    251.5538

    63.03638

    47

    483,622.6

    11,803,384,787

    1993

    483.6226

    700.9093

    266.33581

    47

    771,412.8

    41,434,152,202

    1996

    771.4128

    1,178.5204

    364.30515

    47

    727,063.5

    150,983,542,178

    1999

    727.0635

    1,504.1955

    -50.06854

    47

    673,155.1

    49,285,342,922

    2001

    673.1551

    1,117.1611

    229.14901

    47

    457,421.6

    5,186,126,529

    2003

    457.4216

    601.4511

    313.39204

    -
    a_mean <- dat %>% 
    -  dplyr::group_by(survey_definition_id) %>% 
    -  dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), 
    -                   minyr = min(year, na.rm = TRUE), 
    -                   maxyr = max(year, na.rm = TRUE)) 
    -
    -figure <-
    -  ggplot(data = dat, 
    -         mapping = aes(x = year, 
    -                       y = biomass_kmt)) +
    -  ggplot2::geom_point(size = 2.5, color = "grey40") + 
    -  ggplot2::scale_x_continuous(
    -    name = "Year", 
    -    labels = scales::label_number(
    -      accuracy = 1, 
    -      big.mark = ""))   +
    -  ggplot2::scale_y_continuous(
    -    name = "Biomass (Kmt)", 
    -    labels = comma) +
    -  ggplot2::geom_segment(
    -    data = a_mean,
    -    mapping = aes(x = minyr, 
    -                  xend = maxyr, 
    -                  y = biomass_kmt, 
    -                  yend = biomass_kmt),
    -    linetype = "dashed", 
    -    linewidth = 2) +
    -  ggplot2::geom_errorbar(
    -    mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),
    -                 position = position_dodge(.9),
    -    alpha = 0.5, width=.2) +
    -  ggplot2::ggtitle(
    -    label = "GOA Pacific Ocean Perch Biomass 1984-2021", 
    -    subtitle = paste0("Mean = ", 
    -                      formatC(x = a_mean$biomass_kmt, 
    -                              digits = 2, 
    -                              big.mark = ",", 
    -                              format = "f"), 
    -                      " Kmt")) +
    -  ggplot2::theme_bw()
    -
    -figure
    +
    a_mean <- dat %>% 
    +  dplyr::group_by(survey_definition_id) %>% 
    +  dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), 
    +                   minyr = min(year, na.rm = TRUE), 
    +                   maxyr = max(year, na.rm = TRUE)) 
    +
    +figure <-
    +  ggplot(data = dat, 
    +         mapping = aes(x = year, 
    +                       y = biomass_kmt)) +
    +  ggplot2::geom_point(size = 2.5, color = "grey40") + 
    +  ggplot2::scale_x_continuous(
    +    name = "Year", 
    +    labels = scales::label_number(
    +      accuracy = 1, 
    +      big.mark = ""))   +
    +  ggplot2::scale_y_continuous(
    +    name = "Biomass (Kmt)", 
    +    labels = comma) +
    +  ggplot2::geom_segment(
    +    data = a_mean,
    +    mapping = aes(x = minyr, 
    +                  xend = maxyr, 
    +                  y = biomass_kmt, 
    +                  yend = biomass_kmt),
    +    linetype = "dashed", 
    +    linewidth = 2) +
    +  ggplot2::geom_errorbar(
    +    mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),
    +                 position = position_dodge(.9),
    +    alpha = 0.5, width=.2) +
    +  ggplot2::ggtitle(
    +    label = "GOA Pacific Ocean Perch Biomass 1984-2021", 
    +    subtitle = paste0("Mean = ", 
    +                      formatC(x = a_mean$biomass_kmt, 
    +                              digits = 2, 
    +                              big.mark = ",", 
    +                              format = "f"), 
    +                      " Kmt")) +
    +  ggplot2::theme_bw()
    +
    +figure
    diff --git a/docs/content/akfin-oracle-sql-r_files/figure-html/test-1-plot-1.png b/docs/content/akfin-oracle-sql-r_files/figure-html/test-1-plot-1.png index 4b5f98a..90e4e90 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-html/test-1-plot-1.png and b/docs/content/akfin-oracle-sql-r_files/figure-html/test-1-plot-1.png differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-html/test-2-plot-1.png b/docs/content/akfin-oracle-sql-r_files/figure-html/test-2-plot-1.png index 5ed3d99..f7407a7 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-html/test-2-plot-1.png and b/docs/content/akfin-oracle-sql-r_files/figure-html/test-2-plot-1.png differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-html/test-3-plot-1.png b/docs/content/akfin-oracle-sql-r_files/figure-html/test-3-plot-1.png index 979c8cc..12edd76 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-html/test-3-plot-1.png and b/docs/content/akfin-oracle-sql-r_files/figure-html/test-3-plot-1.png differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-html/test-4-fig-1.png b/docs/content/akfin-oracle-sql-r_files/figure-html/test-4-fig-1.png index e220d08..e1a455b 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-html/test-4-fig-1.png and b/docs/content/akfin-oracle-sql-r_files/figure-html/test-4-fig-1.png differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-html/test-5-fig-1.png b/docs/content/akfin-oracle-sql-r_files/figure-html/test-5-fig-1.png index caded95..bcb96c9 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-html/test-5-fig-1.png and b/docs/content/akfin-oracle-sql-r_files/figure-html/test-5-fig-1.png differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-1-plot-1.pdf b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-1-plot-1.pdf index 784351a..5587735 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-1-plot-1.pdf and b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-1-plot-1.pdf differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-2-plot-1.pdf b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-2-plot-1.pdf index d5edc11..ef82bfd 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-2-plot-1.pdf and b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-2-plot-1.pdf differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-3-plot-1.pdf b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-3-plot-1.pdf index 26794a6..1dfe52e 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-3-plot-1.pdf and b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-3-plot-1.pdf differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-4-fig-1.pdf b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-4-fig-1.pdf index 9d8cc0d..1ecb192 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-4-fig-1.pdf and b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-4-fig-1.pdf differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-5-fig-1.pdf b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-5-fig-1.pdf index 66c9279..1e87c4c 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-5-fig-1.pdf and b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-5-fig-1.pdf differ diff --git a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-6-fig-1.pdf b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-6-fig-1.pdf index 0a2934d..0b8f4c6 100644 Binary files a/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-6-fig-1.pdf and b/docs/content/akfin-oracle-sql-r_files/figure-pdf/test-6-fig-1.pdf differ diff --git a/docs/content/foss-api-r.html b/docs/content/foss-api-r.html index 88d716a..104418b 100644 --- a/docs/content/foss-api-r.html +++ b/docs/content/foss-api-r.html @@ -385,7 +385,7 @@

    flextable::colformat_num(x = ., j = c("year", "cruise", "species_code", "tsn", "ak_survey_id"), big.mark = "")

    -

    Ex. 1: Load the first 25 rows (default) of data.

    year

    srvy

    survey

    survey_id

    cruise

    haul

    stratum

    station

    vessel_name

    vessel_id

    date_time

    latitude_dd

    longitude_dd

    species_code

    common_name

    scientific_name

    taxon_confidence

    cpue_kgha

    cpue_kgkm2

    cpue_kg1000km2

    cpue_noha

    cpue_nokm2

    cpue_no1000km2

    weight_kg

    count

    bottom_temperature_c

    surface_temperature_c

    depth_m

    distance_fished_km

    net_width_m

    net_height_m

    area_swept_ha

    duration_hr

    tsn

    ak_survey_id

    links

    2002

    AI

    Aleutian Islands Bottom Trawl Survey

    52

    200201

    6

    722

    307-63

    Vesteraalen

    94

    05/17/2002 18:56:58

    53.737

    -167.016

    95020

    feathery bryozoan

    Eucratea loricata

    Low

    0.017

    1.749

    1,749.445

    0.044

    0

    4.1

    5.3

    187

    1.561

    16.112

    7.25

    2.515

    0.28

    155809

    1917453

    [[data.frame]]

    2002

    AI

    Aleutian Islands Bottom Trawl Survey

    52

    200201

    6

    722

    307-63

    Vesteraalen

    94

    05/17/2002 18:56:58

    53.737

    -167.016

    79000

    squid unid.

    Decapodiformes

    High

    0.022

    2.227

    2,226.567

    3.181

    318.081

    318,080.93

    0.056

    8

    4.1

    5.3

    187

    1.561

    16.112

    7.25

    2.515

    0.28

    1917454

    [[data.frame]]

    2002

    AI

    Aleutian Islands Bottom Trawl Survey

    52

    200201

    6

    722

    307-63

    Vesteraalen

    94

    05/17/2002 18:56:58

    53.737

    -167.016

    24191

    shortfin eelpout

    Lycodes brevipes

    High

    0.036

    3.578

    3,578.410

    0.795

    79.520

    79,520.23

    0.090

    2

    4.1

    5.3

    187

    1.561

    16.112

    7.25

    2.515

    0.28

    165258

    1917455

    [[data.frame]]

    +

    Ex. 1: Load the first 25 rows (default) of data.

    year

    srvy

    survey

    survey_id

    cruise

    haul

    stratum

    station

    vessel_name

    vessel_id

    date_time

    latitude_dd

    longitude_dd

    species_code

    common_name

    scientific_name

    taxon_confidence

    cpue_kgha

    cpue_kgkm2

    cpue_kg1000km2

    cpue_noha

    cpue_nokm2

    cpue_no1000km2

    weight_kg

    count

    bottom_temperature_c

    surface_temperature_c

    depth_m

    distance_fished_km

    net_width_m

    net_height_m

    area_swept_ha

    duration_hr

    tsn

    ak_survey_id

    links

    2002

    AI

    Aleutian Islands Bottom Trawl Survey

    52

    200201

    6

    722

    307-63

    Vesteraalen

    94

    05/17/2002 18:56:58

    53.737

    -167.016

    95020

    feathery bryozoan

    Eucratea loricata

    Low

    0.017

    1.749

    1,749.445

    0.044

    0

    4.1

    5.3

    187

    1.561

    16.112

    7.25

    2.515

    0.28

    155809

    1917453

    [[data.frame]]

    2002

    AI

    Aleutian Islands Bottom Trawl Survey

    52

    200201

    6

    722

    307-63

    Vesteraalen

    94

    05/17/2002 18:56:58

    53.737

    -167.016

    79000

    squid unid.

    Decapodiformes

    High

    0.022

    2.227

    2,226.567

    3.181

    318.081

    318,080.93

    0.056

    8

    4.1

    5.3

    187

    1.561

    16.112

    7.25

    2.515

    0.28

    1917454

    [[data.frame]]

    2002

    AI

    Aleutian Islands Bottom Trawl Survey

    52

    200201

    6

    722

    307-63

    Vesteraalen

    94

    05/17/2002 18:56:58

    53.737

    -167.016

    24191

    shortfin eelpout

    Lycodes brevipes

    High

    0.036

    3.578

    3,578.410

    0.795

    79.520

    79,520.23

    0.090

    2

    4.1

    5.3

    187

    1.561

    16.112

    7.25

    2.515

    0.28

    165258

    1917455

    [[data.frame]]

    @@ -418,7 +418,7 @@

    Ex. 3: Filter by Year flextable::colformat_num(x = ., j = c("year", "species_code"), big.mark = "")

    -

    Ex. 3: Filter by Year.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    2022

    AI

    793

    80540

    0.361

    2022

    AI

    793

    401

    0.903

    2022

    AI

    793

    20006

    1.661

    +

    Ex. 3: Filter by Year.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    2022

    AI

    793

    80540

    0.361

    2022

    AI

    793

    401

    0.903

    2022

    AI

    793

    20006

    1.661

    @@ -441,7 +441,7 @@

    Ex. 4: Filter flextable::colformat_num(x = ., j = c("year", "species_code"), big.mark = "")

    -

    Ex. 4: Filter by species name.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    2002

    AI

    722

    21740

    775.322

    2002

    AI

    722

    21740

    10,685.806

    2002

    AI

    721

    21740

    0.640

    +

    Ex. 4: Filter by species name.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    2002

    AI

    722

    21740

    775.322

    2002

    AI

    722

    21740

    10,685.806

    2002

    AI

    721

    21740

    0.640

    @@ -464,7 +464,7 @@

    flextable::colformat_num(x = ., j = c("year", "species_code"), big.mark = "")

    -

    Ex. 5: Combination of year and name filters.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    2022

    AI

    793

    21740

    7,853.632

    2022

    AI

    721

    21740

    7,235.010

    2022

    AI

    722

    21740

    22,754.334

    +

    Ex. 5: Combination of year and name filters.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    2022

    AI

    793

    21740

    7,853.632

    2022

    AI

    721

    21740

    7,235.010

    2022

    AI

    722

    21740

    22,754.334

    @@ -486,7 +486,7 @@

    Ex. flextable::colformat_num(x = ., j = c("year", "species_code"), big.mark = "")

    -

    Ex. 6: Combination of year, srvy, stratum.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    1989

    EBS

    10

    66548

    1.164

    1989

    EBS

    10

    69322

    1.164

    1989

    EBS

    10

    43000

    2.353

    +

    Ex. 6: Combination of year, srvy, stratum.

    year

    srvy

    stratum

    species_code

    cpue_kgkm2

    1989

    EBS

    10

    66548

    1.164

    1989

    EBS

    10

    69322

    1.164

    1989

    EBS

    10

    43000

    2.353

    @@ -518,7 +518,7 @@

    flextable::theme_zebra()

    -

    Ex. 7: Visualize CPUE data in distribution map.

    stratum

    station

    latitude_dd

    longitude_dd

    cpue_kgkm2

    81

    61.66434

    -172.2655

    2,895.258

    81

    62.33740

    -173.1702

    1,235.545

    70

    62.03713

    -171.6528

    0.000

    +

    Ex. 7: Visualize CPUE data in distribution map.

    stratum

    station

    latitude_dd

    longitude_dd

    cpue_kgkm2

    81

    61.66434

    -172.2655

    2,895.258

    81

    62.33740

    -173.1702

    1,235.545

    70

    62.03713

    -171.6528

    0.000

    @@ -533,22 +533,12 @@

    set.breaks = "jenks", # Gets Jenks breaks from classint::classIntervals() in.crs = "+proj=longlat", # Set input coordinate reference system out.crs = "EPSG:3338", # Set output coordinate reference system - grid.cell = c(20000, 20000), # 20x20km grid - key.title = "Pacific Ocean perch") # Include in the legend title

    + grid.cell = c(20000, 20000))$plot + # 20x20km grid + ggplot2::guides(fill=guide_legend(title = "Pacific cod\nCPUE (kg/km2)"))
    [inverse distance weighted interpolation]
     [inverse distance weighted interpolation]
    -
    figure$plot + 
    -  ggplot2::guides(fill=guide_legend(title = "Pacific cod\nCPUE (kg/km2)"))
    -
    -
    -
    -

    -
    Ex. 7: Visualize CPUE data in distribution map.
    -
    -
    -
    diff --git a/docs/content/foss-api-r_files/figure-pdf/test-7-fig-1.pdf b/docs/content/foss-api-r_files/figure-pdf/test-7-fig-1.pdf new file mode 100644 index 0000000..2110650 Binary files /dev/null and b/docs/content/foss-api-r_files/figure-pdf/test-7-fig-1.pdf differ diff --git a/docs/content/intro-news.html b/docs/content/intro-news.html index da80562..d71730a 100644 --- a/docs/content/intro-news.html +++ b/docs/content/intro-news.html @@ -284,11 +284,7 @@

    Table of contents

    @@ -321,38 +317,11 @@

    News

    -
    -

    Future plans

    -
    -

    GOA 2025 Restratification – Mock Data for Testing

    -

    The plan will be, once all are satisfied with the new GAP_PRODUCTS schema and tables, to sunset the historic product tables in 2024 and proceed with only GAP_PRODUCTS for the 2024 post-survey stock assessment season.

    -
      -
    • December 2023 - March 2024: Meeting between GAP and stock assessment groups in early December 2023 to update progress on the GAP_PRODUCTS testing phase. Deadline for Comments and Feedback on GAP_PRODUCTS data structures is March 8, 2024.

    • -
    • September 2024: GAP will only release data products according to the new standard. Current, historical data product tables will be archived in a new schema called "GAP_ARCHIVE".

    • -
    -
    -
    -
    -

    Previous updates

    -
      -
    • September 2023: Provisional data product tables – CPUE, BIOMASS, SIZECOMP, and AGECOMP – as well as provisional support tables – AREA, STRATUM_GROUPS, METADATA_COLUMN, SPECIES_YEAR, SURVEY_DESIGN – are available in the GAP_PRODUCTS Oracle schema with updated 2023 GOA and EBS survey data.

      -
        -
      • Additionally, the inclusion of mock data for the under the new 2025 GOA stratified random survey (labeled in the GAP_PRODUCTS tables as YEAR 2025) will provide stock authors with the opportunity to interact with data from the new survey design to be implemented in 2025.

      • -
      • Provisional AKFIN and FOSS tables are also available in the GAP_PRODUCTS Oracle schema. These include: AKFIN_AGECOMP, AKFIN_AREA, AKFIN_BIOMASS, AKFIN_CATCH, AKFIN_CPUE, AKFIN_CRUISE, AKFIN_HAUL, AKFIN_LENGTH, AKFIN_METADATA_COLUMN, AKFIN_SIZECOMP, AKFIN_SPECIMEN, AKFIN_SURVEY_DESIGN, AKFIN_STRATUM_GROUPS, FOSS_CATCH, FOSS_CPUE_PRESONLY, FOSS_HAUL, and FOSS_TAXON_GROUP.

      • -
    • -
    • May 2023: Release of new, draft, standard data product tables, including restratified GOA data. Stock assessment authors will have the opportunity to explore differences between datasets, test workflows, and provide comments and issues during summer 2023.

    • -
    • February 2023: Decision was made to include the mock restratified GOA data with the development of the new consolidated standard data products.

    • -
    • December 2022: GAP and SSMA discuss integration of the restratification of the GOA survey design into standard data products.

      -
        -
      • Stock assessors requested a "dry run" test to work with new mock restratified GOA survey data before implementation of the new survey design.

      • -
      • This prompted the postponement of the restratified GOA design to 2025.

      • -
    • -
    • October 2022: The data processes and index computation working group convened to address the development of standard survey data products (e.g., biomass/abundance, size composition, age composition, CPUE).

      -
        -
      • Index Computation Working Group: consolidation of index computation methods between the Bering Sea and AI-GOA regions.

      • -
      • Data Processes Working Group: consolidation, clean up, and reorganization of survey oracle schemata, tables, and other data for all surveys.

      • -
    • -
    +
    +

    News/change logs

    +

    Run 2023-06-01 gapindex v2.1.0: Initial compiling and planning notes

    +

    GAP_PRODUCTS ChangeLog (last produced on 2023-11-14) using gapindex v2.1.1: A new version of gapindex (v2.1.1) was used to produced these data. There was a slight change to how subarea biomass totals are calculated. The modified biomass records reflect this change. New 2022 otolith data were available since the last iteration of the GAP_PRODUCTS for Aleutian Island Pacific ocean perch and northern rockifsh and Eastern Bering Sea northern rock sole. Zero-filled CPUE records for four GOA species codes (SPECIES_CODE: 21210, 30010, 30360, 77102, 98101) were added due to how the 1990 data were integrated in the last production run of GAP_PRODUCTS. Two Arctic cod (SPECIES_CODE: 21725) and one plain sculpin (SPECIES_CODE: 21371) count records were modified in the NBS data, which changes the numerical CPUE estimates for those hauls which changes the estimated population abundance and size composition for those species.

    +

    GAP_PRODUCTS ChangeLog (last produced on 2023-11-17) using gapindex v2.1.2: A new version of gapindex (v2.1.2) was used to produced these data. There was a slight change to how subarea biomass totals are calculated that was not fully addressed in v2.1.1. The modified biomass records reflect this change.

    diff --git a/docs/search.json b/docs/search.json index 37ae29c..68a333b 100644 --- a/docs/search.json +++ b/docs/search.json @@ -70,18 +70,11 @@ "text": "Data levels\nGAP produces numerous data products that are subjected to different levels of processing, ranging from raw to highly-derived. The suitability of these data products for analysis varies and there is ambiguity about which data products can be used for which purpose. This ambiguity can create challenges in communicating about data products and potentially lead to misunderstanding and misuse of data. One approach to communicating about the level of processing applied to data products and their suitability for analysis is to describe data products using a Data Processing Level system. Data Processing Level systems are widely used in earth system sciences to characterize the extent of processing that has been applied to data products. For example, the NOAA National Centers for Environmental Information (NCEI) Satellite Program uses a Data Processing Level system to describe data on a scale of 0-4, where Level 0 is raw data and Level 4 is model output or results from analysis. Example of how NASA remote sensing data products are shared through a public data portal with levels of data processing and documentation.\nFor more information, see Sean Rohan’s October 2022 SCRUGS presentation on the topic.\n\nLevel 0: Raw and unprocessed data. Ex: Data on the G drive, some tables in RACE_DATA\nLevel 1A: Data products with QA/QC applied that may or may not be expanded to analysis units, but either not georeferenced or does not include full metadata. Ex: Some tables in RACE_DATA and RACEBASE\nLevel 2: Analysis-ready data products that are derived for a standardized extent and account for zeros and missing/bad data. Ex: CPUE tables, some data products in public-facing archives and repositories\nLevel 3: Data products that are synthesized across a standardized extent, often inputs in a higher-level analytical product. Ex: Abundance indices, some data products in public-facing archives and repositories\nLevel 4: Analytically generated data products that are derived from lower-level data, often to inform management. Ex: Biological reference points from stock assessments, Essential Fish Habitat layers, indicators in Ecosystem Status Reports and Ecosystem and Socioeconomic Profiles" }, { - "objectID": "content/intro-news.html#future-plans", - "href": "content/intro-news.html#future-plans", + "objectID": "content/intro-news.html#newschange-logs", + "href": "content/intro-news.html#newschange-logs", "title": "News", - "section": "Future plans", - "text": "Future plans\n\nGOA 2025 Restratification – Mock Data for Testing\nThe plan will be, once all are satisfied with the new GAP_PRODUCTS schema and tables, to sunset the historic product tables in 2024 and proceed with only GAP_PRODUCTS for the 2024 post-survey stock assessment season.\n\nDecember 2023 - March 2024: Meeting between GAP and stock assessment groups in early December 2023 to update progress on the GAP_PRODUCTS testing phase. Deadline for Comments and Feedback on GAP_PRODUCTS data structures is March 8, 2024.\nSeptember 2024: GAP will only release data products according to the new standard. Current, historical data product tables will be archived in a new schema called \"GAP_ARCHIVE\"." - }, - { - "objectID": "content/intro-news.html#previous-updates", - "href": "content/intro-news.html#previous-updates", - "title": "News", - "section": "Previous updates", - "text": "Previous updates\n\nSeptember 2023: Provisional data product tables – CPUE, BIOMASS, SIZECOMP, and AGECOMP – as well as provisional support tables – AREA, STRATUM_GROUPS, METADATA_COLUMN, SPECIES_YEAR, SURVEY_DESIGN – are available in the GAP_PRODUCTS Oracle schema with updated 2023 GOA and EBS survey data.\n\nAdditionally, the inclusion of mock data for the under the new 2025 GOA stratified random survey (labeled in the GAP_PRODUCTS tables as YEAR 2025) will provide stock authors with the opportunity to interact with data from the new survey design to be implemented in 2025.\nProvisional AKFIN and FOSS tables are also available in the GAP_PRODUCTS Oracle schema. These include: AKFIN_AGECOMP, AKFIN_AREA, AKFIN_BIOMASS, AKFIN_CATCH, AKFIN_CPUE, AKFIN_CRUISE, AKFIN_HAUL, AKFIN_LENGTH, AKFIN_METADATA_COLUMN, AKFIN_SIZECOMP, AKFIN_SPECIMEN, AKFIN_SURVEY_DESIGN, AKFIN_STRATUM_GROUPS, FOSS_CATCH, FOSS_CPUE_PRESONLY, FOSS_HAUL, and FOSS_TAXON_GROUP.\n\nMay 2023: Release of new, draft, standard data product tables, including restratified GOA data. Stock assessment authors will have the opportunity to explore differences between datasets, test workflows, and provide comments and issues during summer 2023.\nFebruary 2023: Decision was made to include the mock restratified GOA data with the development of the new consolidated standard data products.\nDecember 2022: GAP and SSMA discuss integration of the restratification of the GOA survey design into standard data products.\n\nStock assessors requested a \"dry run\" test to work with new mock restratified GOA survey data before implementation of the new survey design.\nThis prompted the postponement of the restratified GOA design to 2025.\n\nOctober 2022: The data processes and index computation working group convened to address the development of standard survey data products (e.g., biomass/abundance, size composition, age composition, CPUE).\n\nIndex Computation Working Group: consolidation of index computation methods between the Bering Sea and AI-GOA regions.\nData Processes Working Group: consolidation, clean up, and reorganization of survey oracle schemata, tables, and other data for all surveys." + "section": "News/change logs", + "text": "News/change logs\n– Run 2023-06-01 gapindex v2.1.0: Initial compiling and planning notes\n– GAP_PRODUCTS ChangeLog (last produced on 2023-11-14) using gapindex v2.1.1: A new version of gapindex (v2.1.1) was used to produced these data. There was a slight change to how subarea biomass totals are calculated. The modified biomass records reflect this change. New 2022 otolith data were available since the last iteration of the GAP_PRODUCTS for Aleutian Island Pacific ocean perch and northern rockifsh and Eastern Bering Sea northern rock sole. Zero-filled CPUE records for four GOA species codes (SPECIES_CODE: 21210, 30010, 30360, 77102, 98101) were added due to how the 1990 data were integrated in the last production run of GAP_PRODUCTS. Two Arctic cod (SPECIES_CODE: 21725) and one plain sculpin (SPECIES_CODE: 21371) count records were modified in the NBS data, which changes the numerical CPUE estimates for those hauls which changes the estimated population abundance and size composition for those species.\n– GAP_PRODUCTS ChangeLog (last produced on 2023-11-17) using gapindex v2.1.2: A new version of gapindex (v2.1.2) was used to produced these data. There was a slight change to how subarea biomass totals are calculated that was not fully addressed in v2.1.1. The modified biomass records reflect this change." }, { "objectID": "content/intro-code-of-conduct.html#what-are-codes-of-conduct", @@ -158,7 +151,7 @@ "href": "content/akfin-oracle-sql-r.html#data-sql-query-examples", "title": "Access data", "section": "Data SQL Query Examples:", - "text": "Data SQL Query Examples:\n\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n\n\n7.0.2 Ex. Select all data from a table\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the R environment.\n\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n\n\n\n7.0.3 Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod.\n\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n\n\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n\n\nEx. 8: CPUE for all stations contained in the Shumagin region\n(AREA_ID = 919).HAULJOINSTRATUMSPECIES_CODELATITUDE_DD_STARTLONGITUDE_DD_STARTCPUE_KGKM2GEAR_TEMPERATURE_C-22,239122172055.43748-160.1269717.630854.5-22,215132172054.58732-161.194576.907634.3-22,168112172054.45823-163.08722,004.496284.9-22,2041102172054.51804-160.74930.000004.7-22,1882102172054.38733-159.69860.000005.5-22,1832102172054.09314-161.69960.000005.3\n\n\n\n\n7.0.4 Ex. EBS Pacific Ocean perch CPUE and akgfmaps map\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from GAP_PRODUCTS.AKFIN_CPUE and map constructed using akgfmaps. Here, we’ll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their RACEBASE analogs.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n\n\nEx. 6: EBS Pacific Ocean perch CPUE and akgfmaps\nmap.CPUE_KGHALATITUDELONGITUDE0.000000058.75863-174.92850.281353357.32545-173.32170.000000057.64161-172.79630.000000059.67831-172.57540.000000060.96936-174.87600.000000058.64012-173.5922\n\n\n\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n\n\n\n\nEx. 6: EBS Pacific Ocean perch CPUE and akgfmaps map.\n\n\n\n\n\n\n7.0.5 Ex. GOA Pacific Ocean perch biomass and abundance\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n\n\nEx. 1: GOA Pacific Ocean perch biomass and abundance.BIOMASS_MTPOPULATION_COUNTYEARDESCRIPTION483,622.6833,902,1611993GOA Region: All Strata483,622.6833,902,1611993GOA Region: All Strata771,412.81,252,616,6031996GOA Region: All Strata771,412.81,252,616,6031996GOA Region: All Strata727,063.51,212,034,9131999GOA Region: All Strata727,063.51,212,034,9131999GOA Region: All Strata\n\n\n\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n\n\n\n\nEx. 1: GOA Pacific Ocean perch biomass and abundance.\n\n\n\n\n\n\n7.0.6 Ex. AI rock sole size compositions and ridge plot\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from ggridges.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10)\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n\n\nEx. 2: AI Rock sole size compositions and ridge plot.LENGTH_MMYEAR180201419020142002014210201422020142302014\n\n\n\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat0, \n mapping = aes(x = length_cm, y = as.factor(year), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n\n\n\n\nEx. 2: AI Rock sole size compositions and ridge plot.\n\n\n\n\n\n\n7.0.7 Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n\n\nEx. 3: EBS Walleye Pollock Age Compositions and Age Pyramid.AGEPOPULATION_COUNTSEX939,37131032,15631115,2003129,9763131,95731131,950,3431\n\n\n\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n\n\n\n\nEx. 3: EBS Walleye Pollock Age Compositions and Age Pyramid.\n\n\n\n\n\n\n7.0.8 Ex. NBS Pacific cod biomass and abundance\nPacific cod biomass and abundance data for the NBS by stratum.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n\n\nEx. 4: NBS Pacific cod biomass and abundance.BIOMASS_MTPOPULATION_COUNTYEARAREA_NAME95,849.98368,767,4982021Inner Domain107,096.730102,734,1422019Inner Domain76,708.43339,605,8602023Inner Domain132,490.15266,187,2452017Inner Domain96,500.69760,433,1352022Inner Domain7,462.5594,724,1532010Inner Domain\n\n\n\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n\n\n\n\nEx. 4: NBS Pacific cod biomass and abundance.\n\n\n\n\n\n\n7.0.9 Ex. GOA Pacific Ocean perch biomass and line plot\nPacific Ocean perch biomass totals for GOA between 1984-2021 from GAP_PRODUCTS.AKFIN_BIOMASS\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n\n\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n\n\nEx. 5: GOA Pacific Ocean perch biomass and line plot.survey_definition_idbiomass_mtbiomass_varyearbiomass_kmtbiomass_kci_upbiomass_kci_dw47483,622.611,803,384,7871993483.6226700.9093266.3358147771,412.841,434,152,2021996771.41281,178.5204364.3051547727,063.5150,983,542,1781999727.06351,504.1955-50.0685447673,155.149,285,342,9222001673.15511,117.1611229.1490147457,421.65,186,126,5292003457.4216601.4511313.3920447764,901.421,499,807,0102005764.90141,058.1577471.64517\n\n\n\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n\n\n\n\nEx. 5: GOA Pacific Ocean perch biomass and line plot." + "text": "Data SQL Query Examples:\n\nlibrary(gapindex)\nlibrary(RODBC)\nlibrary(flextable)\nlibrary(ggplot2)\nlibrary(magrittr)\nlibrary(dplyr)\n\n\n7.0.2 Ex. Select all data from tables\nYou can download all of the tables locally using a variation of the code below. Once connected, pull and save the tables of interest into the R environment.\n\nlocations <- c(\n \"GAP_PRODUCTS.AKFIN_AGECOMP\", \n \"GAP_PRODUCTS.AKFIN_AREA\", \n \"GAP_PRODUCTS.AKFIN_BIOMASS\", \n \"GAP_PRODUCTS.AKFIN_CATCH\", \n \"GAP_PRODUCTS.AKFIN_CPUE\", \n \"GAP_PRODUCTS.AKFIN_CRUISE\", \n \"GAP_PRODUCTS.AKFIN_HAUL\", \n \"GAP_PRODUCTS.AKFIN_LENGTH\", \n \"GAP_PRODUCTS.AKFIN_METADATA_COLUMN\", \n \"GAP_PRODUCTS.AKFIN_SIZECOMP\", \n \"GAP_PRODUCTS.AKFIN_SPECIMEN\", \n \"GAP_PRODUCTS.AKFIN_STRATUM_GROUPS\", \n \"GAP_PRODUCTS.AKFIN_SURVEY_DESIGN\", \n \"GAP_PRODUCTS.AKFIN_TAXONOMIC_CLASSIFICATION\"\n)\n\nfor (i in 1:length(locations)) {\n print(locations[i])\n a <- RODBC::sqlQuery(channel, paste0(\"SELECT * FROM \", locations[i]))\n write.csv(x = a, file = here::here(\"data\", paste0(locations[i], \".csv\")))\n}\n\n\n\n7.0.3 Ex. CPUE for all EBS and NBS stations with associated haul, cruise, and species information.\n\na <- RODBC::sqlQuery(channel = channel, # NOT RACEBASE.HAUL\n query = paste0(\n\"\n-- Select columns for output data\nSELECT\ncr.CRUISEJOIN,\ncr.CRUISE,\ncr.YEAR,\ncr.SURVEY_DEFINITION_ID,\ncr.SURVEY_NAME,\ncr.VESSEL_ID,\ncr.VESSEL_NAME,\ncp.HAULJOIN,\ncp.SPECIES_CODE,\ntt.SPECIES_NAME,\ntt.COMMON_NAME,\ncp.WEIGHT_KG,\ncp.COUNT,\ncp.AREA_SWEPT_KM2,\ncp.CPUE_KGKM2,\ncp.CPUE_NOKM2,\nhh.HAUL,\nhh.STATION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_HAUL hh\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cr\nON hh.CRUISEJOIN = cr.CRUISEJOIN\nLEFT JOIN GAP_PRODUCTS.AKFIN_CPUE cp\nON hh.HAULJOIN = cp.HAULJOIN\nLEFT JOIN GAP_PRODUCTS.TAXONOMIC_CLASSIFICATION tt\nON cp.SPECIES_CODE = tt.SPECIES_CODE\n\n-- Filter for EBS and NBS observations\nWHERE SURVEY_DEFINITION_ID IN (143, 98) -- 143 NBS, 98 EBS\nAND tt.SURVEY_SPECIES = 1\n\n-- Only return the first 3 rows because otherwise this would be a huge table!\nFETCH FIRST 3 ROWS ONLY;\")) \n\nflextable::flextable(head(a)) %>% theme_zebra()\n\n\nEx.: CPUE for all EBS and NBS stations with associated haul, cruise,\nand species information.CRUISEJOINCRUISEYEARSURVEY_DEFINITION_IDSURVEY_NAMEVESSEL_IDVESSEL_NAMEHAULJOINSPECIES_CODESPECIES_NAMECOMMON_NAMEWEIGHT_KGCOUNTAREA_SWEPT_KM2CPUE_KGKM2CPUE_NOKM2HAULSTATION80198,2031,98298Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey1CHAPMAN8771fish egg unid.000.0420210021G-1080198,2031,98298Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey1CHAPMAN8772fish larvae unid.000.0420210021G-1080198,2031,98298Eastern Bering Sea Crab/Groundfish Bottom Trawl Survey1CHAPMAN8773fish unid.000.0420210021G-10\n\n\n\n\n7.0.4 Ex. CPUE for all stations contained in the INPFC Shumagin region (AREA_ID = 919) for Pacific cod.\n\ndat <- RODBC::sqlQuery(channel = channel,\n query =\n\"\n-- Select columns for output data\nSELECT \nHAULJOIN, \nSPECIES_CODE, \nSTRATUM, \nLATITUDE_DD_START, \nLONGITUDE_DD_START,\nCPUE_KGKM2, \nGEAR_TEMPERATURE_C\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_CPUE cpue\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL haul\nUSING (HAULJOIN) \n\n-- Filter for P. Cod observations\nWHERE SPECIES_CODE IN (21720)\n\n-- Select all stratum within the area_id 919 (INPFC Shumagin region)\nAND haul.STRATUM IN\n(\nSELECT \nSTRATUM\nFROM GAP_PRODUCTS.AKFIN_STRATUM_GROUPS \nWHERE AREA_ID = 919\n);\")\n\n\ndat <- dat %>% \n dplyr::select(HAULJOIN, STRATUM, SPECIES_CODE, LATITUDE_DD_START, LONGITUDE_DD_START, CPUE_KGKM2, GEAR_TEMPERATURE_C) %>% \n dplyr::mutate(SPECIES_CODE = as.character(SPECIES_CODE), \n STRATUM = as.character(STRATUM)) %>% \n dplyr::arrange(SPECIES_CODE)\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n\n\nEx. 8: CPUE for all stations contained in the Shumagin region\n(AREA_ID = 919).HAULJOINSTRATUMSPECIES_CODELATITUDE_DD_STARTLONGITUDE_DD_STARTCPUE_KGKM2GEAR_TEMPERATURE_C-22,270132172055.11515-159.3512209.289944.3-22,250132172055.05143-159.96798,700.920175.1-22,238132172055.11365-159.4264363.173254.4-22,214132172054.78608-160.000863.715064.6-22,2021112172054.48341-159.7261618.721204.7-22,2471122172055.59093-160.0740114.730424.0\n\n\n\n\n7.0.5 Ex. EBS Pacific Ocean perch CPUE and akgfmaps map\nPacific Ocean perch catch-per-unit-effort estimates for EBS in 2021 from GAP_PRODUCTS.AKFIN_CPUE and map constructed using akgfmaps. Here, we’ll use AKFIN HAUL and CRUISES data also included in this repo, for convenience, though they are very similar to their RACEBASE analogs.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \n(cp.CPUE_KGKM2/100) CPUE_KGHA, -- akgfmaps is expecting hectares\nhh.LATITUDE_DD_START LATITUDE,\nhh.LONGITUDE_DD_START LONGITUDE\n\n-- Use HAUL data to obtain LATITUDE & LONGITUDE and connect to cruisejoin\nFROM GAP_PRODUCTS.AKFIN_CPUE cp\nLEFT JOIN GAP_PRODUCTS.AKFIN_HAUL hh\nON cp.HAULJOIN = hh.HAULJOIN\n\n-- Use CRUISES data to obtain YEAR and SURVEY_DEFINITION_ID\nLEFT JOIN GAP_PRODUCTS.AKFIN_CRUISE cc\nON hh.CRUISEJOIN = cc.CRUISEJOIN\n\n-- Filter data\nWHERE cp.SPECIES_CODE = 30060 \nAND cc.SURVEY_DEFINITION_ID = 98 \nAND cc.YEAR = 2021;\")\n\n\nflextable::flextable(head(dat)) %>% theme_zebra()\n\n\nEx. 6: EBS Pacific Ocean perch CPUE and akgfmaps\nmap.CPUE_KGHALATITUDELONGITUDE0.0000000060.67043-178.09460.0000000060.31361-176.01380.0000000060.35098-175.38500.0000000060.99712-177.66380.0000000060.96495-176.26340.0241637958.97844-175.7204\n\n\n\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n x = dat, # Pass data as a data frame\n region = \"bs.south\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific Ocean perch\\nCPUE (kg/km2)\")) |> \n change_fill_color(new.scheme = \"grey\", show.plot = FALSE)\n\n\n\n\nEx. 6: EBS Pacific Ocean perch CPUE and akgfmaps map.\n\n\n\n\n\n\n7.0.6 Ex. GOA Pacific Ocean perch biomass and abundance\nBiomass and abundance for Pacific Ocean perch from 1990 – 2023 for the western/central/eastern GOA management areas as well as for the entire region.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT AREA_ID, DESCRIPTION FROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('REGULATORY_AREA', 'REGION') \nAND SURVEY_DEFINITION_ID = 47)\n\n-- Select columns for output data\nSELECT \nBIOMASS_MT,\nPOPULATION_COUNT, \nYEAR, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SPECIES_CODE = 30060\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = description) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = gsub(x = area, pattern = \" - \", replacement = \"\\n\"), \n area = gsub(x = area, pattern = \": \", replacement = \"\\n\"), \n type = sapply(X = strsplit(x = area, split = \"\\n\", fixed = TRUE), `[[`, 2)) %>% \n dplyr::arrange(type) %>% \n dplyr::mutate(\n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\n\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n\n\nEx. 1: GOA Pacific Ocean perch biomass and abundance.BIOMASS_MTPOPULATION_COUNTYEARDESCRIPTION157,295.1317,129,4081990GOA Region: All Strata157,295.1317,129,4081990GOA Region: All Strata483,622.6833,902,1611993GOA Region: All Strata483,622.6833,902,1611993GOA Region: All Strata771,412.81,252,616,6031996GOA Region: All Strata771,412.81,252,616,6031996GOA Region: All Strata\n\n\n\n# install.packages(\"scales\")\nlibrary(scales)\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(x = year, y = val, color = type)) +\n ggplot2::geom_point(size = 3) + \n ggplot2::facet_grid(cols = vars(area), rows = vars(var), scales = \"free_y\") + \n ggplot2::scale_x_continuous(name = \"Year\", n.breaks = 3) +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::labs(title = 'GOA Pacific Ocean perch biomass and abundance 1990 – 2023') + \n ggplot2::guides(color=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_color_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n\n\n\n\nEx. 1: GOA Pacific Ocean perch biomass and abundance.\n\n\n\n\n\n\n7.0.7 Ex. AI rock sole size compositions and ridge plot\nNorthern and Southern rock sole size composition data from 1991 – 2022 for the Aleutian Islands, with Ridge plot from ggridges.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' \nAND SURVEY_DEFINITION_ID = 52)\n\n-- Select columns for output data\nSELECT \nLENGTH_MM, \nYEAR\nFROM GAP_PRODUCTS.AKFIN_SIZECOMP SIZECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = SIZECOMP.AREA_ID\n\n-- Filter data results\nWHERE SIZECOMP.SURVEY_DEFINITION_ID IN 52 \nAND SIZECOMP.SPECIES_CODE IN (10261, 10262)\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::mutate(length_cm = length_mm/10) %>% \n head() %>% \n flextable::flextable() %>% \n flextable::theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\ndat0\n\n\nEx. 2: AI Rock sole size compositions and ridge plot.length_mmyearlength_cm110199711130199713140199714150199715160199716170199717\n\n\n\n# install.packages(\"ggridges\")\nlibrary(ggridges)\nfigure <- \n ggplot2::ggplot(\n data = dat, \n mapping = aes(x = LENGTH_MM, y = as.factor(YEAR), fill = stat(x))) +\n ggridges::theme_ridges(center_axis_labels = TRUE) + \n ggridges::geom_density_ridges_gradient(scale = 4, show.legend = FALSE) + \n ggplot2::scale_y_discrete(name = \"Year\", expand = c(0.01, 0)) +\n ggplot2::scale_x_continuous(name = \"Length (cm)\", expand = c(0.01, 0)) +\n # ggplot2::scale_fill_grey() +\n ggplot2::labs(title = 'AI Rock sole Size Compositions 1991 – 2022') \n\nfigure\n\n\n\n\nEx. 2: AI Rock sole size compositions and ridge plot.\n\n\n\n\n\n\n7.0.8 Ex. EBS Walleye Pollock Age Compositions and Age Pyramid\nWalleye pollock age composition for the EBS Standard Area from 1982 – 2022 and the EBS + NW Area from 1987 – 2022, with age pyramid plot.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE = 'REGION' AND \nSURVEY_DEFINITION_ID = 98)\n\n-- Select columns for output data\nSELECT \nAGECOMP.AGE, \nAGECOMP.POPULATION_COUNT, \nAGECOMP.SEX\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_AGECOMP AGECOMP\nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = AGECOMP.AREA_ID\n\n-- Filter data results\nWHERE SPECIES_CODE = 21740\nAND AGE >= 0\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::filter(sex %in% c(1,2)) %>%\n dplyr::mutate(\n sex = ifelse(sex == 1, \"M\", \"F\"),\n population_count = # change male population to negative\n ifelse(sex==\"M\", population_count*(-1), population_count*1)/1e9) \n\nflextable::flextable(head(dat)) %>% theme_zebra()\n\n\nEx. 3: EBS Walleye Pollock Age Compositions and Age Pyramid.AGEPOPULATION_COUNTSEX1148,791,451212120,673,58021342,580,05421447,229,37821525,140,52321619,473,2552\n\n\n\nfigure <- ggplot2::ggplot(\n data = dat0, \n mapping = \n aes(x = age,\n y = population_count, \n fill = sex)) +\n ggplot2::scale_fill_grey() +\n ggplot2::geom_bar(stat = \"identity\") +\n ggplot2::coord_flip() +\n ggplot2::scale_x_continuous(name = \"Age\") +\n ggplot2::scale_y_continuous(name = \"Population (billions)\", labels = abs) +\n ggplot2::ggtitle(label = \"EBS Walleye Pollock Age Compositions 1982 – 2022\") + \n ggplot2::guides(fill = guide_legend(title = \"Sex\"))+\n ggplot2::theme_bw()\n\nfigure\n\n\n\n\nEx. 3: EBS Walleye Pollock Age Compositions and Age Pyramid.\n\n\n\n\n\n\n7.0.9 Ex. NBS Pacific cod biomass and abundance\nPacific cod biomass and abundance data for the NBS by stratum.\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Manipulate data to join to\nWITH FILTERED_STRATA AS (\nSELECT \nAREA_ID, \nAREA_NAME, \nDESCRIPTION \nFROM GAP_PRODUCTS.AKFIN_AREA\nWHERE AREA_TYPE in ('STRATUM') AND \nSURVEY_DEFINITION_ID = 143) \n\n-- Select columns for output data\nSELECT \nBIOMASS.BIOMASS_MT, \nBIOMASS.POPULATION_COUNT, \nBIOMASS.YEAR, \nSTRATA.AREA_NAME\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS BIOMASS \nJOIN FILTERED_STRATA STRATA \nON STRATA.AREA_ID = BIOMASS.AREA_ID\n\n-- Filter data results\nWHERE BIOMASS.SURVEY_DEFINITION_ID IN 143 \nAND BIOMASS.SPECIES_CODE = 21720\")\n\n\ndat0 <- dat %>% \n janitor::clean_names() %>% \n dplyr::select(biomass_mt, population_count, year, area = area_name) %>%\n pivot_longer(cols = c(\"biomass_mt\", \"population_count\"), \n names_to = \"var\", \n values_to = \"val\") %>% \n dplyr::mutate(\n val = ifelse(var == \"biomass_mt\", val/1e6, val/1e9), \n var = ifelse(var == \"biomass_mt\", \"Biomass (Mmt)\", \"Population (B)\"), \n area = factor(area, levels = unique(area), labels = unique(area), ordered = TRUE))\nflextable::flextable(head(dat)) %>% \n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"YEAR\", big.mark = \"\")\n\n\nEx. 4: NBS Pacific cod biomass and abundance.BIOMASS_MTPOPULATION_COUNTYEARAREA_NAME7,462.5594,724,1532010Inner Domain95,849.98368,767,4982021Inner Domain107,096.730102,734,1422019Inner Domain76,708.43339,605,8602023Inner Domain132,490.15266,187,2452017Inner Domain96,500.69760,433,1352022Inner Domain\n\n\n\nfigure <- ggplot2::ggplot(\n dat = dat0, \n mapping = aes(y = val, x = year, fill = area)) + \n ggplot2::geom_bar(position=\"stack\", stat=\"identity\") + \n ggplot2::facet_grid(rows = vars(var), scales = \"free_y\") +\n ggplot2::scale_y_continuous(name = \"Estimate\", labels = comma) +\n ggplot2::scale_x_continuous(name = \"Year\", breaks = unique(dat0$year)) +\n ggplot2::labs(title = 'NBS Pacific cod biomass and abundance by stratum') + \n ggplot2::guides(fill=guide_legend(title = \"Region Type\"))+\n ggplot2::scale_fill_grey() +\n ggplot2::theme_bw() +\n ggplot2::theme(legend.direction = \"horizontal\", \n legend.position = \"bottom\")\n\nfigure\n\n\n\n\nEx. 4: NBS Pacific cod biomass and abundance.\n\n\n\n\n\n\n7.0.10 Ex. GOA Pacific Ocean perch biomass and line plot\nPacific Ocean perch biomass totals for GOA between 1984-2021 from GAP_PRODUCTS.AKFIN_BIOMASS\n\ndat <- RODBC::sqlQuery(channel = channel, \n query = \n\"\n-- Select columns for output data\nSELECT \nSURVEY_DEFINITION_ID, \nBIOMASS_MT, \nBIOMASS_VAR, \nYEAR\n\n-- Identify what tables to pull data from\nFROM GAP_PRODUCTS.AKFIN_BIOMASS\n\n-- Filter data results\nWHERE SPECIES_CODE = 30060 \nAND SURVEY_DEFINITION_ID = 47 \nAND AREA_ID = 99903 \nAND YEAR BETWEEN 1984 AND 2023;\") %>% \n janitor::clean_names() %>% \n dplyr::mutate(biomass_kmt = biomass_mt/1000, \n # **approximate** 95% confidence interval\n biomass_kci_up = (biomass_mt + (2*sqrt(biomass_var)))/1000, \n biomass_kci_dw = (biomass_mt - (2*sqrt(biomass_var)))/1000) \n\n\nflextable::flextable(head(dat)) %>%\n theme_zebra() %>%\n flextable::colformat_num(x = ., j = \"year\", big.mark = \"\")\n\n\nEx. 5: GOA Pacific Ocean perch biomass and line plot.survey_definition_idbiomass_mtbiomass_varyearbiomass_kmtbiomass_kci_upbiomass_kci_dw47157,295.12,221,176,9681990157.2951251.553863.0363847483,622.611,803,384,7871993483.6226700.9093266.3358147771,412.841,434,152,2021996771.41281,178.5204364.3051547727,063.5150,983,542,1781999727.06351,504.1955-50.0685447673,155.149,285,342,9222001673.15511,117.1611229.1490147457,421.65,186,126,5292003457.4216601.4511313.39204\n\n\n\na_mean <- dat %>% \n dplyr::group_by(survey_definition_id) %>% \n dplyr::summarise(biomass_kmt = mean(biomass_kmt, na.rm = TRUE), \n minyr = min(year, na.rm = TRUE), \n maxyr = max(year, na.rm = TRUE)) \n\nfigure <-\n ggplot(data = dat, \n mapping = aes(x = year, \n y = biomass_kmt)) +\n ggplot2::geom_point(size = 2.5, color = \"grey40\") + \n ggplot2::scale_x_continuous(\n name = \"Year\", \n labels = scales::label_number(\n accuracy = 1, \n big.mark = \"\")) +\n ggplot2::scale_y_continuous(\n name = \"Biomass (Kmt)\", \n labels = comma) +\n ggplot2::geom_segment(\n data = a_mean,\n mapping = aes(x = minyr, \n xend = maxyr, \n y = biomass_kmt, \n yend = biomass_kmt),\n linetype = \"dashed\", \n linewidth = 2) +\n ggplot2::geom_errorbar(\n mapping = aes(ymin = biomass_kci_dw, ymax = biomass_kci_up),\n position = position_dodge(.9),\n alpha = 0.5, width=.2) +\n ggplot2::ggtitle(\n label = \"GOA Pacific Ocean Perch Biomass 1984-2021\", \n subtitle = paste0(\"Mean = \", \n formatC(x = a_mean$biomass_kmt, \n digits = 2, \n big.mark = \",\", \n format = \"f\"), \n \" Kmt\")) +\n ggplot2::theme_bw()\n\nfigure\n\n\n\n\nEx. 5: GOA Pacific Ocean perch biomass and line plot." }, { "objectID": "content/akfin-api-r.html#ex.-1-load-lingcod-data", @@ -263,7 +256,7 @@ "href": "content/foss-api-r.html#ex.-7-visualize-cpue-data-in-distribution-map", "title": "Access via API and R", "section": "Ex. 7: Visualize CPUE data in distribution map", - "text": "Ex. 7: Visualize CPUE data in distribution map\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using akgfmaps.\n\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n\n\nEx. 7: Visualize CPUE data in distribution map.stratumstationlatitude_ddlongitude_ddcpue_kgkm28161.66434-172.26552,895.2588162.33740-173.17021,235.5457062.03713-171.65280.000\n\n\n\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000), # 20x20km grid\n key.title = \"Pacific Ocean perch\") # Include in the legend title\n\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]\n\nfigure$plot + \n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n\n\n\n\nEx. 7: Visualize CPUE data in distribution map." + "text": "Ex. 7: Visualize CPUE data in distribution map\nPacific cod catch-per-unit-effort estimates for NBS in 2021 and map constructed using akgfmaps.\n\n# res <- httr::GET(\n# url = paste0(api_link, \"?offset=0&limit=10000\"), \n# query = list(year = 2021, srvy = \"EBS\", species_code = 30060))\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\",\"species_code\":21720}'))\ndata_catch <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, cpue_kgkm2) \n\n# zero-fill data (imperfectly, but effective for this example)\nres <- httr::GET(\n url = paste0(api_link, '?q={\"year\":2021,\"srvy\":\"NBS\"}offset=0&limit=10000'))\ndata_haul <- jsonlite::fromJSON(base::rawToChar(res$content))$items %>% \n dplyr::select(stratum, station, latitude_dd, longitude_dd) %>%\n dplyr::mutate(across(where(is.numeric), round, 3)) %>% \n dplyr::distinct()\n\ndata <- dplyr::left_join(data_haul, data_catch) %>% \n dplyr::mutate(cpue_kgkm2 = ifelse(is.na(cpue_kgkm2), 0, cpue_kgkm2), \n dplyr::across(dplyr::everything(), as.numeric)) \n\nflextable::flextable(data[1:3,]) %>% \n flextable::theme_zebra() \n\n\nEx. 7: Visualize CPUE data in distribution map.stratumstationlatitude_ddlongitude_ddcpue_kgkm28161.66434-172.26552,895.2588162.33740-173.17021,235.5457062.03713-171.65280.000\n\n\n\n# devtools::install_github(\"afsc-gap-products/akgfmaps\", build_vignettes = TRUE)\nlibrary(akgfmaps)\n\nfigure <- akgfmaps::make_idw_map(\n CPUE_KGHA = data$cpue_kgkm2, # calculates the same, regardless of units. \n LATITUDE = data$latitude_dd, \n LONGITUDE = data$longitude_dd, \n region = \"bs.north\", # Predefined EBS area\n set.breaks = \"jenks\", # Gets Jenks breaks from classint::classIntervals()\n in.crs = \"+proj=longlat\", # Set input coordinate reference system\n out.crs = \"EPSG:3338\", # Set output coordinate reference system\n grid.cell = c(20000, 20000))$plot + # 20x20km grid\n ggplot2::guides(fill=guide_legend(title = \"Pacific cod\\nCPUE (kg/km2)\"))\n\n[inverse distance weighted interpolation]\n[inverse distance weighted interpolation]" }, { "objectID": "content/foss-api-py.html", diff --git a/docs/sitemap.xml b/docs/sitemap.xml index cde5a04..8b3f559 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -2,102 +2,102 @@ https://afsc-gap-products.github.io/gap_products/index.html - 2023-11-08T23:33:55.157Z + 2023-11-30T15:53:06.927Z https://afsc-gap-products.github.io/gap_products/content/intro-survey-background.html - 2023-11-08T23:33:55.197Z + 2023-11-30T15:53:06.957Z https://afsc-gap-products.github.io/gap_products/content/intro-workflow.html - 2023-11-08T23:33:55.205Z + 2023-11-30T15:53:06.975Z https://afsc-gap-products.github.io/gap_products/content/intro-news.html - 2023-11-08T23:33:55.214Z + 2023-11-30T15:53:06.989Z https://afsc-gap-products.github.io/gap_products/content/intro-code-of-conduct.html - 2023-11-08T23:33:55.221Z + 2023-11-30T15:53:06.999Z https://afsc-gap-products.github.io/gap_products/content/product-intro.html - 2023-11-08T23:33:55.252Z + 2023-11-30T15:53:07.018Z https://afsc-gap-products.github.io/gap_products/content/product-metadata.html - 2023-11-08T23:33:55.274Z + 2023-11-30T15:53:07.057Z https://afsc-gap-products.github.io/gap_products/content/akfin-intro.html - 2023-11-08T23:33:55.304Z + 2023-11-30T15:53:07.069Z https://afsc-gap-products.github.io/gap_products/content/akfin-metadata.html - 2023-11-08T23:33:55.345Z + 2023-11-30T15:53:07.161Z https://afsc-gap-products.github.io/gap_products/content/akfin-oracle-sql-r.html - 2023-11-08T23:33:55.435Z + 2023-11-30T15:53:07.377Z https://afsc-gap-products.github.io/gap_products/content/akfin-api-r.html - 2023-11-08T23:33:55.445Z + 2023-11-30T15:53:07.393Z https://afsc-gap-products.github.io/gap_products/content/foss-intro.html - 2023-11-08T23:33:55.476Z + 2023-11-30T15:53:07.404Z https://afsc-gap-products.github.io/gap_products/content/foss-metadata.html - 2023-11-08T23:33:55.500Z + 2023-11-30T15:53:07.438Z https://afsc-gap-products.github.io/gap_products/content/foss-platform.html - 2023-11-08T23:33:55.511Z + 2023-11-30T15:53:07.459Z https://afsc-gap-products.github.io/gap_products/content/foss-api-r.html - 2023-11-08T23:33:55.558Z + 2023-11-30T15:53:07.537Z https://afsc-gap-products.github.io/gap_products/content/foss-api-py.html - 2023-11-08T23:33:55.604Z + 2023-11-30T15:53:07.660Z https://afsc-gap-products.github.io/gap_products/content/foss-oracle-r.html - 2023-11-08T23:33:55.634Z + 2023-11-30T15:53:07.695Z https://afsc-gap-products.github.io/gap_products/content/other-intro.html - 2023-11-08T23:33:55.653Z + 2023-11-30T15:53:07.724Z https://afsc-gap-products.github.io/gap_products/content/other-pkgs.html - 2023-11-08T23:33:55.661Z + 2023-11-30T15:53:07.739Z https://afsc-gap-products.github.io/gap_products/content/end-contact-us.html - 2023-11-08T23:33:55.669Z + 2023-11-30T15:53:07.755Z https://afsc-gap-products.github.io/gap_products/content/end-run-notes.html - 2023-11-08T23:33:55.681Z + 2023-11-30T15:53:07.766Z https://afsc-gap-products.github.io/gap_products/content/end-acknowledgements.html - 2023-11-08T23:33:55.690Z + 2023-11-30T15:53:07.784Z https://afsc-gap-products.github.io/gap_products/content/end-refs.html - 2023-11-08T23:33:55.726Z + 2023-11-30T15:53:07.798Z https://afsc-gap-products.github.io/gap_products/GAP-Production-Data-Documentation.pdf - 2023-11-08T23:33:38.237Z + 2023-11-30T15:52:43.363Z https://afsc-gap-products.github.io/gap_products/GAP-Production-Data-Documentation.docx - 2023-11-08T23:33:50.664Z + 2023-11-30T15:53:00.319Z