Systematically save your report tables for your report

save_tables(
  table_raw = NULL,
  table_print = NULL,
  list_tables = c(),
  header = "",
  footnotes = "",
  filename0 = "x",
  cnt_chapt_content = "001",
  cnt = "1",
  path = NULL,
  output_type = c("csv"),
  type = "Table",
  alttext = "",
  filename_desc = "",
  nickname = "",
  message = FALSE
)

Arguments

table_raw

Optional. The data.frame that has no rounding and no dividing of numbers (good to save this for record keeping). Default = NA.

table_print

The data.frame as table will be seen in the report.

list_tables

Save tables in a list

header

The name and title of the figure. Default = "".

footnotes

Any footnote you want attached to this figure.

filename0

The filename set at the begining of the chapter

cnt_chapt_content

The order number that this exists in the chapter.

cnt

The figure number

path

The path the file needs to be saved to. Default = "NULL", meaning it wont save anything and will override all other saving elements.

output_type

Default = c("csv"). Can be anything supported by utils::write.table.

type

Default = "Table", but can be anything that the element needs to be called (e.g., "Graphic", "Fig.", "Graph") to fit in the phrase "Table 1. This is my spreadsheet!".

alttext

String with what the alternative text is.

filename_desc

Additional description text for the filename that will be added at the name of file before the filename extention, before the "_raw" or "_print". Default = "". Can be use to add a species name, location, or anything else that would make it easier to know what that file shows.

nickname

A unique name that can be used to identify the figure so it can be referenced later in the report.

message

TRUE/FALSE. Default = FALSE. If TRUE, it will print information about where your plot has been saved to.

Examples

# Select data and make plot
table_raw<-data.frame(x = rnorm(n = 10),
                      y = rnorm(n = 10),
                      col = rep_len(x = c("a", "b"), length.out = 5))
table_print <- table_raw
table_print[,c("x", "y")] <- NMFSReports::mod_number(table_print[,c("x", "y")],
                                                     divideby = 1,
                                                     comma_seperator = TRUE,
                                                     digits = 2)
save_tables(table_raw = table_raw,
           table_print=table_print,
           header = "Here is a table!",
           footnote = "A footnote for this table!")
#> [[1]]
#> [[1]]$raw
#>             x           y col
#> 1   1.0379533  2.06876529   a
#> 2   0.5254896 -0.62656591   b
#> 3   0.3251739 -1.51211413   a
#> 4   0.5311803  0.58992218   b
#> 5   0.2754395 -2.44141879   a
#> 6   1.9727076  2.70386548   a
#> 7  -0.1917737 -0.16820244   b
#> 8   1.2696531 -1.03183454   a
#> 9   0.1977604 -0.94837687   b
#> 10 -1.1071036  0.06503036   a
#> 
#> [[1]]$print
#>        x     y col
#> 1   1.04  2.07   a
#> 2   0.53 -0.63   b
#> 3   0.33 -1.51   a
#> 4   0.53  0.59   b
#> 5   0.28 -2.44   a
#> 6   1.97  2.70   a
#> 7  -0.19 -0.17   b
#> 8   1.27 -1.03   a
#> 9   0.20 -0.95   b
#> 10 -1.11  0.07   a
#> 
#> [[1]]$caption
#> [1] "Table [1](){#}. -- Here is a table!^[A footnote for this table!]"
#> 
#> [[1]]$header
#> [1] "Table [1](){#}. -- Here is a table!"
#> 
#> [[1]]$nickname
#> [1] ""
#> 
#> [[1]]$alttext
#> [1] ""
#> 
#> [[1]]$number
#> [1] "1"
#> 
#> [[1]]$footnotes
#> [1] "A footnote for this table!"
#> 
#> [[1]]$filename
#> [1] "001_tab_1"
#> 
#>