demog_table: Make a table of demographics for a set of simulations

View source: R/demog_table.R

demog_tableR Documentation

Make a table of demographics for a set of simulations

Description

demog_table makes a table of the demographics of a set of simulations and, if appliable, observed data. UNDER CONSTRUCTION.

Usage

demog_table(
  demog_dataframe,
  demog_parameters = NA,
  sims_to_include = NA,
  sim_file_labels = NA,
  mean_type = "geometric",
  variability_type = "90% CI",
  variability_format = "to",
  break_down_by_sex = TRUE,
  include_SorO_column = F,
  rounding = NA,
  save_table = NA,
  sort_column,
  page_orientation = "landscape",
  fontsize = 11
)

Arguments

demog_dataframe

the output from running extractDemog. Optionally (and we recommend) with added observed demographic data, perhaps from observed overlay XML files.

demog_parameters

Which demographic parameters do you want to include? Options are NA to include all of the parameters in demog_dataframe or a chraacter vector of the columns in demog_dataframe that you want to include. No need to include any columns that are not a demographic parameter because we'll ignore them, e.g., you don't need to tell us to include the columns "File" or "Individual", etc.)

sims_to_include

optionally specify which simulation files you'd like to include in the annotated output. Acceptable input:

NA (default)

get all the simulations included in demog_dataframe

a character vector of the file names you want

The items in the character vector must exactly match file names in the column "File" of the demog_dataframe, including the file extension

a regular expression

This will include in the output only files that match the regular expression. This must have length = 1, and it IS case sensitive. For example, say you only want to look at development or verification simulations and you included "dev" or "ver" in those file names, respectively. Here is how you could specify that (the vertical pipe | means "or" for regular expressions): sim_to_include = "dev|ver"

sim_file_labels

optionally specify labels to use in lieu of simulation file names in the table. This should be a named character vector where the names are the simulation file name and the values are what you'd like to have appear in the table instead. Be sure that the file name matches perfectly, including the file extension! The order you list here will be the order the simulations appear in your table. Example: sim_file_labels = c("mdz-5mg-sd-hv.xlsx" = "Healthy subjects", "mdz-5mg-sd-cpa.xlsx" = "Child-Pugh A", "mdz-5mg-sd-cpb.xlsx" = "Child-Pugh B", "mdz-5mg-sd-cpc.xlsx" = "Child-Pugh C")

mean_type

What kind of means and CVs or confidence intervals do you want listed in the output table? Options are "arithmetic" or "geometric" (default).

variability_type

What statistic would you like to use for reporting the variability? Options are:

"90% CI" (default)

90% confidence interval; this will be geometric or arithmetic based on your choice for mean_type

"CV"

coefficient of variation; this will be geometric or arithmetic based on your choice for mean_type

"SD"

arithmetic standard deviation

"none"

to get no variability stats included in the table

variability_format

formatting used to indicate the variability When the variability is concatenated. Options are "to" (default) to get output like "X to Y", "hyphen" to get output like "X - Y", "brackets" to get output like "[X, Y]", or "parentheses" for the eponymous symbol if you're an American and a bracket if you're British, e.g., "(X, Y)". (Sorry for the ambiguity; this was written by an American who didn't originally realize that there was another name for parentheses.)

break_down_by_sex

TRUE (default) or FALSE for whether to break down the data by sex.

include_SorO_column

TRUE or FALSE (default) for whether to include a column indicating whether the data were simulated or observed. TRUE will always include it and FALSE will only include it when there were both simulated and observed data present.

rounding

option for what rounding to perform, if any. Options are:

NA or "Consultancy"

All output will be rounded according to Simcyp Consultancy Team standards: to three significant figures when the value is < 100 or to the ones place if the value is >= 100. Please see the function round_consultancy, which does the rounding here.

"none"

No rounding will be performed.

"significant X" where "X" is a number

Output will be rounded to X significant figures. "signif X" also works fine.

"round X" where "X" is a number

Output will be rounded to X digits

"Word only"

Output saved to Word or a csv file will be rounded using the function round_consultancy, but nothing will be rounded in the output R object. This can be useful when you want to have nicely rounded and formatted output in a Word file but you also want to use the results from pksummary_mult to make forest plots, which requires numbers that are not rounded.

save_table

optionally save the output table and, if requested, the QC info, by supplying a file name in quotes here, e.g., "My nicely formatted table.docx" or "My table.csv", depending on whether you'd prefer to have the table saved as a Word or csv file. Do not include any slashes, dollar signs, or periods in the file name. (You can also save the table to a Word file later with the function formatTable_Simcyp.) If you supply only the file extension, e.g., save_table = "docx", the name of the file will be "PK summary table" with that extension. If you supply something other than just "docx" or just "csv" for the file name but you leave off the file extension, we'll assume you want it to be ".csv". All PK info will be included in a single Word or csv file, and, if checkDataSource = TRUE, that will be saved in a single csv file.

sort_column

optionally specify a column to sort by. If none are supplied, the table will not be sorted. If you would like to sort by more than one column, we recommend sorting before using this function, e.g., MyPKTable <- MyPKTable %>% arrange(Study, Dose) to sort by the column "Study" and then by the column "Dose" and then supply "MyPKTable" to formatTable_Simcyp. (This is just an example; your table must include those two columns for that to work.)

page_orientation

set the page orientation for the Word file output to "portrait" (default) or "landscape"

fontsize

the numeric font size for Word output. Default is 11 point. This only applies when you save the table as a Word file.

Value

a formatted table

Examples

# none yet


shirewoman2/Consultancy documentation built on June 1, 2025, 6:05 p.m.