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
Describe the bug
In some of the tables I generated using r2rtf, the first page has a different nrow from the other pages. In the example below, when I set nrow = 25, the page 1 has more blank rows at the bottom while the other pages fit. But if you change the nrow from 25 to 26, the first page will fit while the other pages will split into two pages.
Expected behavior
How can we have the nrow consistent among different pages?
To reproduce
library(r2rtf)
#> Warning: package 'r2rtf' was built under R version 4.1.3
library(glue)
#> Warning: package 'glue' was built under R version 4.1.3
library(dplyr)
#> Warning: package 'dplyr' was built under R version 4.1.3#> #> Attaching package: 'dplyr'#> The following objects are masked from 'package:stats':#> #> filter, lag#> The following objects are masked from 'package:base':#> #> intersect, setdiff, setequal, unionn_trt<-100n_placebo<-50# Create empty dataframedf<-data.frame(matrix(ncol=6, nrow=200))
# Assign column names
colnames(df) <- c("Column1", "Column2", "Column3", "Column4", "Column5", "Column6")
# Generate random character data
set.seed(123) # For reproducibilityfor (iin1:6) {
df[, i] <- replicate(200, paste(sample(letters, 35, replace=TRUE), collapse=""))
}
df %>%
# rtf_page(orientation = "landscape") %>%
rtf_page(orientation="landscape",
# width = ifelse(orientation == "portrait", 8.5, 11),# height = ifelse(orientation == "portrait", 11, 8.5),# nrow = ifelse(orientation == "portrait", 40, 24)width=11,
height=8.5,
nrow=25
) %>%
rtf_page_header(text="[CONFIDENTIAL] CSR \\line Protocol StudyID Page \\pagenumber of \\pagefield",
text_justification="j",
text_font_size=8,
text_convert=TRUE
) %>%
rtf_footnote(
footnote= c("Note: At each level of subject summarization, a subject is counted once for the most severe event if the subject reported one or more events. * Indicates p-value < 0.05. MedDRA 23.0 used for coding",
"[1] All odds ratios, relative risks and risk differences are for comparing the Cabozantinib only arm to the Placebo arm",
"All point estimates and confidence intervals are from Proc Freq, odds ratio p-values from Proc Logistic, Relative risk p-values from Proc Genmod and Risk difference CMH p-value from proc Freq. P-values for the odds ratio and relative risk are not generated unless the event rate is at least 5% in both the treatment arms.",
"Source Data: ADSL, ADAE",
"Data Cut Date: 19AUG2020 Data Extraction Date: 13NOV2020",
"Source: Data transfer: 20210316"
),
as_table=FALSE, #If TRUE, the footnotes will be inside the table# text_space_before = 5,text_font_size=7,
text_convert=FALSE#Tell R don't interpret special characters
) %>%
rtf_title(title= c(
"Table 14.3.1.5.7.1",
"Subject Incidence of Treatment-Emergent Adverse Events by Preferred Term with Odds Ratio, Relative Risk and Risk Difference",
"(sorted by Descending Risk Difference)",
"Population: Safety"
),
text_font_size=9
) %>%
# rtf_subline(text= subline) %>%
rtf_colheader(colheader=" |Treatment 1| |Oddsd Ratio [1]|Relative Risk [1]|Risk Difference [1]",
col_rel_width= c(5,3,3,3,3,3),
border_left="",
border_right="",
border_bottom="",
text_font_size=8 ) %>%
rtf_colheader(colheader=" |Only|Placebo|(95% CI)|(95% CI)|(95% CI)",
col_rel_width= c(5,3,3,3,3,3),
border_left="",
border_right="",
border_top="",
text_font_size=8 ) %>%
rtf_colheader(colheader= glue('Preferred Term|(N={n_trt})|(N={n_placebo})|p-value|p-value|p-value'),
col_rel_width= c(5,3,3,3,3,3),
border_top="",
border_left="",
border_right="",
text_justification= c('l',rep('c',5)),
text_font_size=8) %>%
rtf_body(col_rel_width= c(5,3,3,3,3,3),
text_justification= c('l',rep('c',5)),
border_left="",
border_right="",
text_font_size=8) %>%
rtf_encode(page_footnote='all') %>%
write_rtf(paste0("test1",".rtf"))
Describe the bug
In some of the tables I generated using r2rtf, the first page has a different nrow from the other pages. In the example below, when I set nrow = 25, the page 1 has more blank rows at the bottom while the other pages fit. But if you change the nrow from 25 to 26, the first page will fit while the other pages will split into two pages.
Expected behavior
How can we have the nrow consistent among different pages?
To reproduce
Created on 2023-06-15 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: