View source: R/save_table_to_Word.R
save_table_to_Word | R Documentation |
save_table_to_Word
will save a DIY PK table to Word using the same
template file as is used for the function pk_table. UNDER CONSTRUCTION.
I haven't done almost any error catching here yet. -LSh
save_table_to_Word(
PKtable,
save_table,
existing_exp_details = NA,
mean_type = "geometric",
single_table = FALSE,
include_dose_num = NA,
prettify_columns = TRUE,
fontsize = 11,
merge_columns = NA,
bold_cells = list(c(0, NA), c(NA, 1)),
center_1st_column = FALSE,
merge_shaded_cells = TRUE,
highlight_so_cutoffs = NA,
highlight_so_colors = NA,
highlight_gmr_colors = NA
)
PKtable |
PK table (really, a data.frame or tibble) that includes the
columns File, Statistic, Tissue, CompoundID, and then also columns named in
the standard way (prettified or un-prettified) for PK parameters from the
SimcypConsultancy package. Well, that is, your input for PKtable must meet
those criteria if you want it to be formatted in any way or if you want to
split it into multiple tables using the argument |
save_table |
save the output table by supplying a file name in quotes here, e.g., "My nicely formatted table.docx". Do not include any slashes, dollar signs, or periods in the file name. |
existing_exp_details |
If you have already run
|
mean_type |
What kind of means and CVs do you want listed in the output table? Options are "arithmetic" or "geometric" (default). |
single_table |
TRUE (default) or FALSE for whether to save all the PK
data in a single table or break the data up by tissue, compound ID, and
file into multiple tables. This only applies to the Word output. If you
want to save the file with multiple tables, we do need your PK table to be
structures in a specific way so that we know where to separate things and
how to format the resulting individual tables. Your entry for
|
include_dose_num |
NA (default), TRUE, or FALSE on whether to include the dose number when listing the PK parameter. By default, the parameter will be labeled, e.g., "Dose 1 Cmax ratio" or "Last dose AUCtau ratio", if you have PK data for both the first dose and the last dose. Also by default, if you have data only for the first dose or only for the last dose, the dose number will be omitted and it will be labeled, e.g., "AUCtau ratio" or "Cmax ratio". Set this to TRUE or FALSE as desired to override the default behavior and get exactly what you want. |
prettify_columns |
TRUE (default) or FALSE for whether to make easily
human-readable column names for any columns with PK parameters. TRUE makes
pretty column names such as "Dose 1 AUCinf (h*ng/mL)" whereas FALSE leaves
the column with the R-friendly name from |
fontsize |
the numeric font size for Word output. Default is 11 point. This only applies when you save the table as a Word file. |
highlight_so_cutoffs |
optionally specify cutoffs for highlighting any
simulated-to-observed ratios. Anything that is above those values or below
the inverse of those values will be highlighted. To figure out what cells
to highlight, this looks for a column titled "Statistic" or "Stat", then
looks for what row contains "S/O" or "simulated (something something)
observed" (as in, we'll use some wildcards to try to match your specific
text). Next, it looks for any values in that same row that are above those
cutoffs. This overrides anything else you specified for highlighting. The
default is NA, for not highlighting based on S/O value. Acceptable
input for, say, highlighting values that are > 125% or < 80% of the
observed and also, with a second color, values that are > 150% or < 66%
would be: |
highlight_so_colors |
optionally specify a set of colors to use in the
Word file output for highlighting S/O values outside the limits you
specified with
If you do specify your own bespoke colors, you'll need to make sure that
you supply one color for every value in |
saves a table to a Word file
MyPKTable <- tibble(Statistic = c("Simulated", "CV%", "Observed", "S/O"),
AUCinf = c(2756, 32.5, 1801, 1.53),
Cmax = c(852, 45.8, 775, 1.1),
`Half life` = c(7.75, 5.7, 6.05, 1.28))
## Not run:
save_table_to_Word(MyPKTable, save_table = "My PK table.docx")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.