Skip to content

Commit 2c06903

Browse files
Update vignette; add KQ meanings to template; add notes
1 parent 2b49886 commit 2c06903

3 files changed

Lines changed: 138 additions & 133 deletions

File tree

R/utils_rda.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# RDA utility functions
33
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
44

5-
# TODO: update new fxns to work with a specified 'dir' instead of default 'getwd()'?
5+
# TODO: update key quantities functions to work with a specified 'dir' instead of default 'getwd()'?
6+
# TODO: update key quantities functions for plots that need to extract values from KQs csv to calculate their own, dependent KQs (none present in current plotting functions)
67

78
#' Substitute key quantities' values into template
89
#'
Lines changed: 132 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,133 @@
11
key_quantity,value,meaning,dependent_on_other_kq,dependent_kq,dependent_on_other_fxn_args,fxn_with_other_args
2-
B.BMSY.end.yr,,,,,,
3-
B.end.year,,,,,,
4-
B.max,,,,,,
5-
B.min,,,,,,
6-
B.ref.pt,,,,,,
7-
B.start.year,,,,,,
8-
B.units,,,,,,
9-
Bend,,,,,,
10-
Bmsy,,,,,,
11-
Btarg,,,,,,
12-
caa.age.max,,,,,,
13-
caa.age.min,,,,,,
14-
caa.end.year,,,,,,
15-
caa.start.year,,,,,,
16-
cal.length.max,,,,,,
17-
cal.length.min,,,,,,
18-
cpue.end.year,,,,,,
19-
cpue.max,,,,,,
20-
cpue.min,,,,,,
21-
cpue.start.year,,,,,,
22-
cpue.units,,,,,,
23-
F.FMSY.end.yr,,,,,,
24-
F.end.year,,,,,,
25-
F.max,,,,,,
26-
F.min,,,,,,
27-
F.ref.pt,,,,,,
28-
F.start.year,,,,,,
29-
fecundity.length.max,,,,,,
30-
fecundity.length.min,,,,,,
31-
fecundity.length.units,,,,,,
32-
fecundity.max,,,,,,
33-
fecundity.min,,,,,,
34-
fecundity.units,,,,,,
35-
fork.length.max,,,,,,
36-
fork.length.min,,,,,,
37-
fork.length.units,,,,,,
38-
Ftarg,,,,,,
39-
kobe.end.year,,,,,,
40-
landings.end.year,,,,,,
41-
landings.max,,,,,,
42-
landings.min,,,,,,
43-
landings.start.year,,,,,,
44-
landings.units,,,,,,
45-
M.age.max,,,,,,
46-
M.age.min,,,,,,
47-
M.rate.max,,,,,,
48-
M.rate.min,,,,,,
49-
mod.fit.abun.end.year,,,,,,
50-
mod.fit.abun.start.year,,,,,,
51-
mod.fit.catch.end.year,,,,,,
52-
mod.fit.catch.max,,,,,,
53-
mod.fit.catch.min,,,,,,
54-
mod.fit.catch.start.year,,,,,,
55-
mod.fit.catch.units,,,,,,
56-
mod.fit.discards.end.year,,,,,,
57-
mod.fit.discards.max,,,,,,
58-
mod.fit.discards.min,,,,,,
59-
mod.fit.discards.start.year,,,,,,
60-
mod.fit.discards.units,,,,,,
61-
overfished.status.is.isnot,,,,,,
62-
overfishing.status.is.isnot,,,,,,
63-
pop.baa.age.max,,,,,,
64-
pop.baa.age.min,,,,,,
65-
pop.baa.end.year,,,,,,
66-
pop.baa.fish.max,,,,,,
67-
pop.baa.fish.min,,,,,,
68-
pop.baa.start.year,,,,,,
69-
pop.naa.age.max,,,,,,
70-
pop.naa.age.min,,,,,,
71-
pop.naa.end.year,,,,,,
72-
pop.naa.fish.max,,,,,,
73-
pop.naa.fish.min,,,,,,
74-
pop.naa.start.year,,,,,,
75-
proj.catch.end.year,,,,,,
76-
proj.catch.min,,,,,,
77-
proj.catch.start.year,,,,,,
78-
proj.catch.units,,,,,,
79-
prop.mat.length.max,,,,,,
80-
prop.mat.length.min,,,,,,
81-
prop.mat.length.units,,,,,,
82-
R0,,,,,,
83-
recruit.dev.end.year,,,,,,
84-
recruit.dev.max,,,,,,
85-
recruit.dev.min,,,,,,
86-
recruit.dev.start.year,,,,,,
87-
recruitment.end.year,,,,,,
88-
recruitment.max,,,,,,
89-
recruitment.min,,,,,,
90-
recruitment.start.year,,,,,,
91-
recruitment.units,,,,,,
92-
rel.B.max,,,,,,
93-
rel.B.min,,,,,,
94-
rel.F.max,,,,,,
95-
rel.F.min,,,,,,
96-
rel.recruitment.max,,,,,,
97-
rel.recruitment.min,,,,,,
98-
rel.ssb.max,,,,,,
99-
rel.ssb.min,,,,,,
100-
selectivity.end.year,,,,,,
101-
selectivity.length.max,,,,,,
102-
selectivity.length.min,,,,,,
103-
selectivity.length.units,,,,,,
104-
selectivity.start.year,,,,,,
105-
spr.max,,,,,,
106-
spr.min,,,,,,
107-
spr.ref.pt,,,,,,
108-
sr.age.min,,,,,,
109-
sr.ssb.max,,,,,,
110-
sr.ssb.min,,,,,,
111-
sr.ssb.units,,,,,,
112-
ssb.end.year,,,,,,
113-
ssb.max,,,,,,
114-
ssb.min,,,,,,
115-
ssb.ref.pt,,,,,,
116-
ssb.start.year,,,,,,
117-
ssb.units,,,,,,
118-
tot.catch.max,,,,,,
119-
tot.catch.min,,,,,,
120-
total.length.max,,,,,,
121-
total.length.min,,,,,,
122-
total.length.units,,,,,,
123-
vonb.age.max,,,,,,
124-
vonb.age.min,,,,,,
125-
vonb.length.max,,,,,,
126-
vonb.length.min,,,,,,
127-
vonb.length.units,,,,,,
128-
wl.length.max,,,,,,
129-
wl.length.min,,,,,,
130-
wl.length.units,,,,,,
131-
wl.weight.max,,,,,,
132-
wl.weight.min,,,,,,
133-
wl.weight.units,,,,,,
2+
B.BMSY.end.yr,,biomass relative to BMSY in the final year,,,,
3+
B.end.year,,final year of the biomass time series,,,,
4+
B.max,,maximum biomass,,,,
5+
B.min,,minimum biomass,,,,
6+
B.ref.pt,,biomass limit reference point,,,,
7+
B.start.year,,start year of the biomass time series,,,,
8+
B.units,,units of biomass measurement,,,,
9+
Bend,,biomass at the end of the time series,,,,
10+
Bmsy,,biomass at maximum sustainable yield,,,,
11+
Btarg,,target biomass reference point,,,,
12+
caa.age.max,,maximum age in catch-at-age data,,,,
13+
caa.age.min,,minimum age in catch-at-age data,,,,
14+
caa.end.year,,final year for catch-at-age data,,,,
15+
caa.start.year,,start year for catch-at-age data,,,,
16+
cal.length.max,,maximum length in catch-at-length histograms,,,,
17+
cal.length.min,,minimum length in catch-at-length histograms,,,,
18+
cpue.end.year,,final year of the CPUE time series,,,,
19+
cpue.max,,maximum catch per unit effort,,,,
20+
cpue.min,,minimum catch per unit effort,,,,
21+
cpue.start.year,,start year of the CPUE time series,,,,
22+
cpue.units,,units for catch per unit effort,,,,
23+
F.FMSY.end.yr,,fishing mortality relative to FMSY in the final year,,,,
24+
F.end.year,,final year of the fishing mortality time series,,,,
25+
F.max,,maximum fishing mortality,,,,
26+
F.min,,minimum fishing mortality,,,,
27+
F.ref.pt,,fishing mortality limit reference point,,,,
28+
F.start.year,,start year of the fishing mortality time series,,,,
29+
fecundity.length.max,,maximum fish length for fecundity relationship,,,,
30+
fecundity.length.min,,minimum fish length for fecundity relationship,,,,
31+
fecundity.length.units,,length units for fecundity measurement,,,,
32+
fecundity.max,,maximum observed fecundity,,,,
33+
fecundity.min,,minimum observed fecundity,,,,
34+
fecundity.units,,units for fecundity (number of eggs),,,,
35+
fork.length.max,,maximum fork length,,,,
36+
fork.length.min,,minimum fork length,,,,
37+
fork.length.units,,units for fork length,,,,
38+
Ftarg,,target fishing mortality reference point,,,,
39+
kobe.end.year,,final year displayed on the Kobe plot,,,,
40+
landings.end.year,,final year of historical landings data,,,,
41+
landings.max,,maximum historical landings,,,,
42+
landings.min,,minimum historical landings,,,,
43+
landings.start.year,,start year of historical landings data,,,,
44+
landings.units,,units for landings,,,,
45+
M.age.max,,maximum age for natural mortality,,,,
46+
M.age.min,,minimum age for natural mortality,,,,
47+
M.rate.max,,maximum natural mortality rate,,,,
48+
M.rate.min,,minimum natural mortality rate,,,,
49+
mod.fit.abun.end.year,,final year for model fit to abundance index,,,,
50+
mod.fit.abun.start.year,,start year for model fit to abundance index,,,,
51+
mod.fit.catch.end.year,,final year for model fit to catch data,,,,
52+
mod.fit.catch.max,,maximum model estimated catch,,,,
53+
mod.fit.catch.min,,minimum model estimated catch,,,,
54+
mod.fit.catch.start.year,,start year for model fit to catch data,,,,
55+
mod.fit.catch.units,,units for model estimated catch,,,,
56+
mod.fit.discards.end.year,,final year for model fit to discards,,,,
57+
mod.fit.discards.max,,maximum estimated discards,,,,
58+
mod.fit.discards.min,,minimum estimated discards,,,,
59+
mod.fit.discards.start.year,,start year for model fit to discards,,,,
60+
mod.fit.discards.units,,units for estimated discards,,,,
61+
overfished.status.is.isnot,,indicator of overfished status,,,,
62+
overfishing.status.is.isnot,,indicator of overfishing status,,,,
63+
pop.baa.age.max,,maximum age for biomass-at-age data,,,,
64+
pop.baa.age.min,,minimum age for biomass-at-age data,,,,
65+
pop.baa.end.year,,final year for biomass-at-age data,,,,
66+
pop.baa.fish.max,,maximum bubble size for biomass-at-age,,,,
67+
pop.baa.fish.min,,minimum bubble size for biomass-at-age,,,,
68+
pop.baa.start.year,,start year for biomass-at-age data,,,,
69+
pop.naa.age.max,,maximum age for numbers-at-age data,,,,
70+
pop.naa.age.min,,minimum age for numbers-at-age data,,,,
71+
pop.naa.end.year,,final year for numbers-at-age data,,,,
72+
pop.naa.fish.max,,maximum bubble size for numbers-at-age,,,,
73+
pop.naa.fish.min,,minimum bubble size for numbers-at-age,,,,
74+
pop.naa.start.year,,start year for numbers-at-age data,,,,
75+
proj.catch.end.year,,final year of catch projections,,,,
76+
proj.catch.min,,minimum forecasted catch,,,,
77+
proj.catch.start.year,,start year of catch projections,,,,
78+
proj.catch.units,,units for projected catch,,,,
79+
prop.mat.length.max,,maximum length for maturity schedule,,,,
80+
prop.mat.length.min,,minimum length for maturity schedule,,,,
81+
prop.mat.length.units,,length units for maturity data,,,,
82+
R0,,unfished equilibrium recruitment,,,,
83+
recruit.dev.end.year,,final year of recruitment deviations,,,,
84+
recruit.dev.max,,maximum recruitment deviation,,,,
85+
recruit.dev.min,,minimum recruitment deviation,,,,
86+
recruit.dev.start.year,,start year of recruitment deviations,,,,
87+
recruitment.end.year,,final year of estimated recruitment,,,,
88+
recruitment.max,,maximum estimated recruitment,,,,
89+
recruitment.min,,minimum estimated recruitment,,,,
90+
recruitment.start.year,,start year of estimated recruitment,,,,
91+
recruitment.units,,units for recruitment,,,,
92+
rel.B.max,,maximum relative biomass,,,,
93+
rel.B.min,,minimum relative biomass,,,,
94+
rel.F.max,,maximum relative fishing mortality,,,,
95+
rel.F.min,,minimum relative fishing mortality,,,,
96+
rel.recruitment.max,,maximum relative recruitment (R/R0),,,,
97+
rel.recruitment.min,,minimum relative recruitment (R/R0),,,,
98+
rel.ssb.max,,maximum relative spawning stock biomass,,,,
99+
rel.ssb.min,,minimum relative spawning stock biomass,,,,
100+
selectivity.end.year,,final year for selectivity estimates,,,,
101+
selectivity.length.max,,maximum length for gear selectivity,,,,
102+
selectivity.length.min,,minimum length for gear selectivity,,,,
103+
selectivity.length.units,,units for selectivity length,,,,
104+
selectivity.start.year,,start year for selectivity estimates,,,,
105+
spr.max,,maximum spawning potential ratio,,,,
106+
spr.min,,minimum spawning potential ratio,,,,
107+
spr.ref.pt,,spawning potential ratio reference point,,,,
108+
sr.age.min,,age of newly recruited fish in SR model,,,,
109+
sr.ssb.max,,maximum SSB in stock-recruit relationship,,,,
110+
sr.ssb.min,,minimum SSB in stock-recruit relationship,,,,
111+
sr.ssb.units,,units for SSB in stock-recruit relationship,,,,
112+
ssb.end.year,,final year of the SSB time series,,,,
113+
ssb.max,,maximum spawning stock biomass,,,,
114+
ssb.min,,minimum spawning stock biomass,,,,
115+
ssb.ref.pt,,spawning stock biomass reference point,,,,
116+
ssb.start.year,,start year of the SSB time series,,,,
117+
ssb.units,,units for spawning stock biomass,,,,
118+
tot.catch.max,,maximum total catch,,,,
119+
tot.catch.min,,minimum total catch,,,,
120+
total.length.max,,maximum total length,,,,
121+
total.length.min,,minimum total length,,,,
122+
total.length.units,,units for total length,,,,
123+
vonb.age.max,,maximum age for von Bertalanffy growth,,,,
124+
vonb.age.min,,minimum age for von Bertalanffy growth,,,,
125+
vonb.length.max,,maximum length for von Bertalanffy growth,,,,
126+
vonb.length.min,,minimum length for von Bertalanffy growth,,,,
127+
vonb.length.units,,units for length in growth model,,,,
128+
wl.length.max,,maximum length for weight-length relationship,,,,
129+
wl.length.min,,minimum length for weight-length relationship,,,,
130+
wl.length.units,,length units for weight-length conversion,,,,
131+
wl.weight.max,,maximum weight for weight-length relationship,,,,
132+
wl.weight.min,,minimum weight for weight-length relationship,,,,
133+
wl.weight.units,,weight units for weight-length conversion,,,,

vignettes/how-caps-alttext-are-made.Rmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ After the final plot has been created within the function, key quantities are ca
4444

4545
**NOTE**: While we extract key quantities as accurately as we can, we cannot guarantee that each quantity will be calculated perfectly. Input data varies widely. It’s always your responsibility to check the accuracy of your figures' alt text.
4646

47+
**NOTE**: The key quantities are exported to a file saved to your working directory ("key_quantities.csv") via `export_kqs()`.
48+
4749
Next, the function `insert_kqs()` imports an empty or partially-filled template with captions and alternative text ("captions_alt_text_template.csv" or "captions_alt_text.csv", respectively), depending on if the user has already created a "captions_alt_text.csv" file in their working directory. The .csv file is imported as a dataframe.
4850

4951
The key quantities are substituted into the dataframe's appropriate placeholders. For example, "The y axis shows biomass in B.units, which spans from **B.min** to B.max." will changed to "The y axis shows biomass in B.units, which spans from **100** to B.max."
5052

5153
Finally, the function exports the updated dataframe as a new .csv, or overwrites the old version, to "captions_alt_text.csv".
5254

55+
**NOTE**: If you export a plot with the same filename (e.g., you exported a biomass plot, then decided to slightly change it and reexport), you will be prompted in the console to decide if you want to overwrite your original plot. You will NOT be prompted to decide if you want to overwrite your original plot's caption and alternative text with an updated version from your new plot, which may have different key quantities. To get updated key quantities, you must 1) revert the plot's caption and alternative text in "captions_alt_text.csv" to contain the placeholders present in the "captions_alt_text_template.csv" OR 2) edit those entries manually.
56+
5357
## Connecting the tables & figures with the captions & alternative text
5458

5559
The function `create_rda()` creates an R data ("rda") file containing a package with 1) the figure or table, 2) caption, 3) alternative text (if a figure) OR a LaTeX version of a table (if a table). To make this package of files, the following steps occur:

0 commit comments

Comments
 (0)