ref_range: Reference a range of figure numbers

View source: R/ref_range.R

ref_rangeR Documentation

Reference a range of figure numbers

Description

Often users will want to reference a range of figures that pertain to a particular data type. For example, you may want to reference the conditional age-at-length figures for a particular fleet. But what happens when the number of figures changes when you add or remove fleets or years included in the model? Worst case, you have to find everywhere in the markdown or LaTeX code that this figure type is referenced and change each line. Instead, you can use this function to find the references for you. All you need is to supply the a bit of the files that you are looking for and which fleet(s) is of interest to you.

Usage

ref_range(
  figuredata,
  grep,
  column = "file",
  fleets = get_fleet(col = "num"),
  fleettype = "",
  encapsulate = TRUE
)

Arguments

figuredata

A data frame of specifications for figures within your document. This data frame is most often automatically generated and specific to your model.

grep

A character string to search for in figuredata.

column

The column name that you want to search for grep in. Typically this will be "file".

fleets

Either numeric values or a valid character string that can be used to find the rows of the fleet table that are of interest. Depending on how you made your csv files via r4ss::SS_plot the references to fleets in the csv might be different. Select the appropriate column of get_fleet based on how you made the figures.

fleettype

A value to append to fleets. The default is nothing, which leads to all types being included. But, if you only wanted to include "mkt0" fleets, then you could use "mkt0".

encapsulate

A logical value specifying if you want the result to be encapsulated in round brackets.

Details

Try testing this function out before you include it in your .Rmd file. All you will need is the file path to the csv that contains the information in figuredata and you can use utils::read.csv right in the call to this function so you don't pollute your workspace. The result of this function should look exactly like how you want it to appear in your document, except the @ symbol will be double escaped instead of just single escaped. Trust me, it will still work like this.

Value

A character string formatted for markdown.

Author(s)

Kelli F. Johnson


iantaylor-NOAA/Lingcod_2021 documentation built on Oct. 30, 2024, 6:42 p.m.