You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
using clin_group_by() with clin_auto_page(), if clin_auto_page drop is set to TRUE then running write_clindoc results in an error #91
Currently when using clin_group_by() with clin_auto_page(), if clin_auto_page drop is set to TRUE then running write_clindoc results in an error “Error in x$data[rows, columns, drop = FALSE] : subscript out of bounds”. Using these options together would be ideal for many by-visit continuous summaries like Vital Signs or Labs, where the Parameter is a subtitle and we want to keep all summary stats (n, mean, sd, median, min, max) for a visit together on a page. For example:
I think this could be possible with this example. The challenge is when you toss in other features like captions. The more you want to customize pagination, the less you can rely on word to do it.
With clin_group_by(), you can rely on the natural flow of pages and it's more like you're just stacking several pages together. Once a caption is in place, you need the flextable to end on each individual page, because the table in word won't apply the caption on the bottom until it hits the last row (of the table in word itself, not of the page).
This is fixed as of clinify 0.4.0 (now on CRAN). Your example with clin_group_by("PARAM") |> clin_auto_page("AVISITN", drop = TRUE) now writes without the "subscript out of bounds" error. It came from pagination losing the table's configuration once the page_by column was dropped. Thanks for the reprex!
Activity
mstackhouse commentedon Oct 17, 2025
Would you be able to prepare this as a reprex?
I think this could be possible with this example. The challenge is when you toss in other features like captions. The more you want to customize pagination, the less you can rely on word to do it.
With
clin_group_by(), you can rely on the natural flow of pages and it's more like you're just stacking several pages together. Once a caption is in place, you need the flextable to end on each individual page, because the table in word won't apply the caption on the bottom until it hits the last row (of the table in word itself, not of the page).PRawlinson-tfs commentedon Oct 20, 2025
Sure, thanks! If you run this code do you get the error?
df <- data.frame(PARAM=c('Parameter: SYSBP', 'Parameter: SYSBP', 'Parameter: SYSBP', 'Parameter: SYSBP', 'Parameter: SYSBP',
'Parameter: SYSBP', 'Parameter: SYSBP', 'Parameter: SYSBP', 'Parameter: SYSBP', 'Parameter: SYSBP',
'Parameter: DIABP', 'Parameter: DIABP', 'Parameter: DIABP', 'Parameter: DIABP', 'Parameter: DIABP',
'Parameter: DIABP', 'Parameter: DIABP', 'Parameter: DIABP', 'Parameter: DIABP', 'Parameter: DIABP'),
AVISITN=c(3,3,3,3,3,
4,4,4,4,4,
3,3,3,3,3,
4,4,4,4,4),
col1=c('DAY 1', 'n', 'Mean (SD)', 'Median', 'Min, Max',
'DAY 5', 'n', 'Mean (SD)', 'Median', 'Min, Max',
'DAY 1', 'n', 'Mean (SD)', 'Median', 'Min, Max',
'DAY 5', 'n', 'Mean (SD)', 'Median', 'Min, Max'),
stat_1=c('', '90', '127.6 (15.53)', '126.0', '85, 175',
'', '87', '124.0 (13.79)', '124.0', '80, 150',
'', '90', '88.8 (14.72)', '89.0', '65, 109',
'', '87', '85.9 (13.10', '86.0', '61, 109'),
stat_2=c('', '80', '124.1 (14.81)', '124.5.0', '85, 161',
'', '85', '126.5 (15.14)', '125.0', '92, 175',
'', '80', '86.7 (14.72)', '87.2', '63, 101',
'', '85', '87.9 (13.10', '86.0', '61, 111')
)
library(clinify)
ct <- clintable(df) |>
clin_group_by("PARAM") |>
clin_auto_page("AVISITN", drop=TRUE)
write_clindoc(
x = ct,
file ='table.docx'
)
mstackhouse commentedon Nov 4, 2026
This is fixed as of clinify 0.4.0 (now on CRAN). Your example with
clin_group_by("PARAM") |> clin_auto_page("AVISITN", drop = TRUE)now writes without the "subscript out of bounds" error. It came from pagination losing the table's configuration once thepage_bycolumn was dropped. Thanks for the reprex!