Retain the current behavior of writing the name of the output file into the table annotation
As noted in the attached vignette, the big change here is ability to add both the output file name and output path (directory) into the table annotation; this means we need to lock in the final location for the table as we build the table; the vignette shows this.
tab_notes() gains the following arguments
output_dir where (what directory) to save the file; respects pmtables.dir
path.type how to render output_dir in the annotation;
See implementation details
New function: format_table_path(); does equivalent of what we already do in mrggsave
Current default
Currently, we can take in the output file name and that gets
included in a table note. However, the decision about where
to save that file is deferred until we actually call
stable_save().
The changes to pmtables include accepting the output file path
when we create the table. Now, if the user passes the output path
and it is included in the table annotation, we have to respect that
information when saving; it can't be changed after the annotation
is created.
Implementation detail
Currently, it is the tab_notes() function that handles all the
arguments for R source file, output file, output directory etc. But
this is a but of a misnomer now, because the function doing more
than just writing a note and saving the file name for later; real
decisions about output file locations are being made.
I have added a non-exported function tab_files() that handles
all the file / path manipulation and arguments that get passed
to tab_notes() eventually go to tab_files(). In the future,
I will open up tab_files() since that more accurately reflects
where the file / path proecessing is taking place.
Summary
tab_notes()
gains the following argumentsoutput_dir
where (what directory) to save the file; respectspmtables.dir
path.type
how to renderoutput_dir
in the annotation;format_table_path()
; does equivalent of what we already do inmrggsave
Current default
Currently, we can take in the output file name and that gets included in a table note. However, the decision about where to save that file is deferred until we actually call
stable_save()
.The changes to pmtables include accepting the output file path when we create the table. Now, if the user passes the output path and it is included in the table annotation, we have to respect that information when saving; it can't be changed after the annotation is created.
Implementation detail
Currently, it is the
tab_notes()
function that handles all the arguments for R source file, output file, output directory etc. But this is a but of a misnomer now, because the function doing more than just writing a note and saving the file name for later; real decisions about output file locations are being made.I have added a non-exported function
tab_files()
that handles all the file / path manipulation and arguments that get passed totab_notes()
eventually go totab_files()
. In the future, I will open uptab_files()
since that more accurately reflects where the file / path proecessing is taking place.source-path.pdf