See the span_split argument passed to stable() and then tab_spanners().

st_span_split(x, ..., split = TRUE)

Arguments

x

an stobject

...

passed to colsplit()

split

passed to colsplit(), if split is FALSE, then an error is generated

Details

There can only be one span_split per table; if st_span_split is called more than once in a pipeline, a warning will be issued on every call after the first one and only the latest span_split data will be retained in the table.

Examples

library(dplyr)

file <- system.file("datasets", "with-dots.RDS", package = "pmtables")

data <- readRDS(file)

st_new(data) %>% st_span_split('.') %>% st_make()
#>  [1] "\\setlength{\\tabcolsep}{5pt} "                                                      
#>  [2] "\\begin{threeparttable}"                                                             
#>  [3] "\\renewcommand{\\arraystretch}{1.3}"                                                 
#>  [4] "\\begin{tabular}[h]{lllllll}"                                                        
#>  [5] "\\hline"                                                                             
#>  [6] "\\multicolumn{1}{c}{} & \\multicolumn{3}{c}{Normal} & \\multicolumn{3}{c}{ESRD} \\\\"
#>  [7] "\\cmidrule(lr){2-4}"                                                                 
#>  [8] "\\cmidrule(lr){5-7}"                                                                 
#>  [9] "STUDY & WT & CRCL & ALB & WT & CRCL & ALB \\\\"                                      
#> [10] "\\hline"                                                                             
#> [11] "12-DEMO-001 & 71.4 & 104 & 4.20 & 78.5 & 26.0 & 2.10 \\\\"                           
#> [12] "12-DEMO-001 & 81.7 & 104 & 3.83 & 89.9 & 26.1 & 1.92 \\\\"                           
#> [13] "12-DEMO-001 & 89.4 & 122 & 4.63 & 98.4 & 30.6 & 2.32 \\\\"                           
#> [14] "12-DEMO-001 & 94.0 & 93.2 & 4.94 & 103 & 23.3 & 2.47 \\\\"                           
#> [15] "12-DEMO-001 & 67.9 & 100 & 4.25 & 74.7 & 25.1 & 2.13 \\\\"                           
#> [16] "12-DEMO-001 & 76.6 & 99.2 & 4.54 & 84.2 & 24.8 & 2.27 \\\\"                          
#> [17] "12-DEMO-002 & 77.6 & 106 & 4.31 & 85.4 & 26.4 & 2.16 \\\\"                           
#> [18] "12-DEMO-002 & 61.3 & 113 & 4.04 & 67.4 & 28.2 & 2.02 \\\\"                           
#> [19] "12-DEMO-002 & 71.2 & 106 & 4.63 & 78.3 & 26.4 & 2.32 \\\\"                           
#> [20] "12-DEMO-002 & 74.1 & 112 & 4.44 & 81.5 & 28.0 & 2.22 \\\\"                           
#> [21] "12-DEMO-002 & 71.6 & 98.9 & 4.49 & 78.8 & 24.7 & 2.25 \\\\"                          
#> [22] "12-DEMO-002 & 72.4 & 105 & 3.89 & 79.6 & 26.3 & 1.94 \\\\"                           
#> [23] "12-DEMO-002 & 73.6 & 103 & 4.52 & 81.0 & 25.8 & 2.26 \\\\"                           
#> [24] "\\hline"                                                                             
#> [25] "\\end{tabular}"                                                                      
#> [26] "\\end{threeparttable}"                                                               
#> attr(,"class")
#> [1] "stable"