RR sheets are organized into blocks – one left, usually also one right – for each
stock. Each block has management units for rows and fisheries for columns, with some
summary columns and some summary rows. This function translates those into longform; see details. This function is designed to be robust to the addition or subtraction of rows or columns within blocks, and additions of new blocks that have "Return Year" in the second column, first row and "Wild" in the final row, first column. However, changes in the number of columns between the left and right blocks (e.g., shifting the black separator column from N to something else) will break this function. However, it appears that this is typically addressed by creating a "continued" block for blocks that would exceed the number of columns. The combine_continued
argument controls handling of these blocks.
Details
To translate each block into compatible longform dataframes, we add several identifiers. $stock
identifies which stock is in use, year
and sheetname
identify
which datasheet the data comes from, block
identifies whether the data comes from the right
or left blocks, and then management_unit_name
and col_name
identify the row and column identifiers from within each block. Because the columns for right-hand blocks sometimes include super-columns (e.g., "Stillaguamish/Snohomish" has "Aggregate Totals", "Stillaguamish Origin", and Snohomish Origin"). col_name_super
identifies these. This is given it's own block
and stock
value.
We also have have a specieal block for "Ar 13D Net CWT..." in columns P-Q.