Closed Schiano-NOAA closed 6 hours ago
yeah - pretty straightforward, though I've added a couple of tweaks.
a comma()
function to facilitate formatting
#' function to format numbers to text with 1,000s comma
#'
#' @param number value to format
#'
#' @export comma
#'
comma <- function( number ) {
format(round(as.numeric( number ), digits = 0), big.mark = ",")
}
I use comma()
on each of the exec_summ
cells, then use main_table()
.
# have to muck with the data formats...
for(i in 2:5){
for(j in c(3:7, 11:13)){
exec_summ[j,i] = comma(exec_summ[j,i])
}
}
safe::main_table(exec_summ, year, tier=3, c1, c2, c3)
Note that `exec_summ` is a .csv of data outputs, so it is akin to your standard converted model results.
Awesome! The comma function you included will also be very helpful for other plots and tables as well. I will tag you once it is committed to the repo.
Could we add the
R/main_table.R
function to the satf package we are developing? I would be making adjustments so it works with the standard converted model results, but use your main flextable code in the function.