You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
b<- list.files(path="./code/", pattern=".Rmd") # find the files that are already there
231
+
b<-b[b!="0_figtab.Rmd"]
224
232
bb<- strsplit(x=b, split="_")
225
233
sections_no<- unlist(lapply(bb, `[[`, 1))
226
234
bb<- strsplit(x=b, split="[0-9]+_")
@@ -519,22 +527,31 @@ tolower2<-function(str0,
519
527
#' This function alows you to take a string of words and combine them into a sentance list. For example, 'apples', 'oranges', 'pears' would become 'apples, oranges, and pears'. This function uses oxford commas.
520
528
#' @param x Character strings you want in your string.
521
529
#' @param oxford T/F: would you like to use an oxford comma? Default = TRUE
522
-
#' @param sep string. default = "," but ";" might be what you need!
530
+
#' @param sep string. default = ", " but "; " or " " might be what you need!
531
+
#' @param sep_last string. default = " and " but " & " or " , " might be what you need!
#' Reference a figure, table, or equation (or other list elements!)
1698
+
#' Reference a figure, table, or equation with an anchored tag
1617
1699
#'
1618
1700
#' @param list_obj A list object created by list_figures or list_tables.
1619
1701
#' @param nickname A unique string that is used to identify the plot or table in list_figures or list_tables, respectively.
1620
1702
#' @param sublist A string of the sublist in list_figures or list_tables you want the contents returned from.
1703
+
#' @param exact T/F. If TRUE, 'nickname' must match the name of the list item exactly. If FALSE, crossref will return all entries with that string fragment. Default = TRUE.
1704
+
#' @param text T/F. If TRUE, will output results prepared for a text output. If FALSE, will output each element. Default = TRUE.
1621
1705
#' @return The item in the list.
1622
1706
#' @export
1623
1707
#' @examples
1624
1708
#' list_figures <- c()
1625
-
#' pp <- plot(x = 1, y = 1)
1709
+
#' table_raw <- data.frame(x = 1, y = 1)
1710
+
#' pp <- plot(x = table_raw$x, y = table_raw$y)
1626
1711
#' list_figures <- NMFSReports::save_figures(
1627
1712
#' figure = pp,
1628
1713
#' list_figures = list_figures,
1629
1714
#' header = "blah blah blah",
1630
-
#' nickname = "example_figure", # a unique name you can refer back to
1715
+
#' nickname = "example_1", # a unique name you can refer back to
1631
1716
#' cnt_chapt_content = "003",
1632
1717
#' cnt = "012")
1633
1718
#' list_figures <- NMFSReports::save_figures(
1634
1719
#' figure = pp,
1635
1720
#' list_figures = list_figures,
1636
1721
#' header = "blah blah blah",
1637
-
#' nickname = "example_figure_other", # a unique name you can refer back to
1722
+
#' nickname = "example2", # a unique name you can refer back to
1638
1723
#' cnt_chapt_content = "003",
1639
1724
#' cnt = "013")
1640
1725
#' list_figures
1641
-
#' refnum <- NMFSReports::crossref(
1726
+
#' refnum <- crossref(
1642
1727
#' list_obj = list_figures,
1643
-
#' nickname = "example_figure",
1728
+
#' nickname = "example_1",
1644
1729
#' sublist = "number")
1645
1730
#' refnum
1646
1731
#' print(paste0("Please refer to figure ", refnum,
1647
1732
#' " to see this figure, not the other figure."))
1733
+
#' # example using a partial phrase with `exact = FALSE`
1734
+
#' crossref(
1735
+
#' list_obj = list_figures,
1736
+
#' nickname = "example_",
1737
+
#' sublist = "number",
1738
+
#' exact = FALSE)
1739
+
#' # using a wildard with `exact = FALSE`
1740
+
#' crossref(
1741
+
#' list_obj = list_figures,
1742
+
#' nickname = "example*1",
1743
+
#' sublist = "number",
1744
+
#' exact = FALSE)
1745
+
#' crossref(
1746
+
#' list_obj = list_figures,
1747
+
#' nickname = "example*",
1748
+
#' sublist = "number",
1749
+
#' exact = FALSE,
1750
+
#' text = FALSE)
1751
+
#' refnum <- crossref(
1752
+
#' list_obj = list_figures,
1753
+
#' nickname = "example*",
1754
+
#' sublist = "number",
1755
+
#' exact = FALSE,
1756
+
#' text = TRUE)
1757
+
#' refnum
1758
+
#' print(paste0("Please refer to figure ", refnum,
0 commit comments