Skip to content

use table_name#22

Open
jacobdum wants to merge 8 commits intomainfrom
basename
Open

use table_name#22
jacobdum wants to merge 8 commits intomainfrom
basename

Conversation

@jacobdum
Copy link
Collaborator

@jacobdum jacobdum commented Jan 12, 2026

  • Added support for stratifying OUTPUTS/figures and OUTPUTS/tables into subdirectories. User points to the parent directory in the function call, while the magic string in the .docx is relative to the parent directory.

add_tables() input .docx file:

Screenshot 2026-01-12 at 11 24 41 AM

Before:

> library(reportifyr)

> initialize_report_project(
+   project_dir = here::here(),
+   report_dir_name = NULL,
+   outputs_dir_name = NULL
+ )

reportifyr has already been initialized. Syncing with config file now.
Nothing to do

> module_dir <- here::here("scripts", "02_add_tables")
> tables_path  <- here::here("OUTPUTS", "tables")
> config <- here::here("report", "config.yaml")

> file.exists(... = "OUTPUTS/tables/DEC1/theoph-pk-parameters.csv")
[1] TRUE

> reportifyr::add_tables(
+     docx_in = file.path(module_dir, "template.docx"),
+     docx_out = file.path(module_dir, "template-tabs.docx"),
+     tables_path = tables_path,
+     config_yaml = config,
+     debug = FALSE
+ )

Error: \{rpfy\}:theoph-pk-parameters.csv has not been found in the document
Screenshot 2026-01-12 at 11 31 04 AM

After:

> library(reportifyr)

> initialize_report_project(
+   project_dir = here::here(),
+   report_dir_name = NULL,
+   outputs_dir_name = NULL
+ )

reportifyr has already been initialized. Syncing with config file now.
Nothing to do

> module_dir <- here::here("scripts", "02_add_tables")
> tables_path  <- here::here("OUTPUTS", "tables")
> config <- here::here("report", "config.yaml")

> file.exists(... = "OUTPUTS/tables/DEC1/theoph-pk-parameters.csv")
[1] TRUE

> reportifyr::add_tables(
+     docx_in = file.path(module_dir, "template.docx"),
+     docx_out = file.path(module_dir, "template-tabs.docx"),
+     tables_path = tables_path,
+     config_yaml = config,
+     debug = FALSE
+ )

0.497 sec elapsed
4.286 sec elapsed
Screenshot 2026-01-12 at 11 54 08 AM

add_footnotes() input .docx file:

Screenshot 2026-01-12 at 4 35 11 PM

Before:

> library(reportifyr)

> initialize_report_project(
+   project_dir = here::here(),
+   report_dir_name = NULL,
+   outputs_dir_name = NULL
+ )

reportifyr has already been initialized. Syncing with config file now.
Nothing to do

> module_dir <- here::here("scripts", "02_add_tables")
> tables_path  <- here::here("OUTPUTS", "tables")
> standard_footnotes <- here::here("report", "standard_footnotes.yaml")
> config <- here::here("report", "config.yaml")

> add_footnotes(
+   docx_in = file.path(module_dir, "template.docx"),
+   docx_out = file.path(module_dir, "template-draft.docx"),
+   figures_path = figures_path,
+   tables_path = tables_path,
+   standard_footnotes_yaml = standard_footnotes,
+   config_yaml = config,
+   include_object_path = FALSE,
+   footnotes_fail_on_missing_metadata = TRUE,
+   debug = FALSE
+ )
1.915 sec elapsed

Appears to be a silent failure as output .docx is:

Screenshot 2026-01-12 at 4 40 25 PM

After:

> library(reportifyr)

> initialize_report_project(
+   project_dir = here::here(),
+   report_dir_name = NULL,
+   outputs_dir_name = NULL
+ )

reportifyr has already been initialized. Syncing with config file now.
Nothing to do

> module_dir <- here::here("scripts", "02_add_tables")
> tables_path  <- here::here("OUTPUTS", "tables")
> standard_footnotes <- here::here("report", "standard_footnotes.yaml")
> config <- here::here("report", "config.yaml")

> add_footnotes(
+   docx_in = file.path(module_dir, "template.docx"),
+   docx_out = file.path(module_dir, "template-draft.docx"),
+   figures_path = figures_path,
+   tables_path = tables_path,
+   standard_footnotes_yaml = standard_footnotes,
+   config_yaml = config,
+   include_object_path = FALSE,
+   footnotes_fail_on_missing_metadata = TRUE,
+   debug = FALSE
+ )
1.037 sec elapsed

Actual success as output .docx is:

Screenshot 2026-01-12 at 4 43 09 PM Screenshot 2026-01-12 at 4 36 39 PM

@jacobdum jacobdum requested a review from mduncans January 12, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants