Pass original table attributes assigned through like rtf_page
, rtf_title
, rtf_body
... to subsetted table
because original attributes won't be automatically carried over.
Arguments
- tbl
A data frame with attributes.
- row
a numeric vector for the row index to keep in the subsetted data.
- col
a numeric vector for the column index to keep in the subsetted data.
Examples
library(dplyr)
data(r2rtf_tbl1)
sub_table <- r2rtf_tbl1 %>%
rtf_body() %>%
r2rtf:::rtf_subset(row = 1:2, col = c(1, 4:5))
attributes(sub_table)
#> $names
#> [1] "Trt" "N2" "Mean2"
#>
#> $row.names
#> [1] 1 2
#>
#> $class
#> [1] "data.frame" "rtf_text" "rtf_border"
#>
#> $border_top
#> [,1] [,2] [,3]
#> [1,] "" "" ""
#> [2,] "" "" ""
#>
#> $border_left
#> [,1] [,2] [,3]
#> [1,] "single" "single" "single"
#> [2,] "single" "single" "single"
#>
#> $border_right
#> [,1] [,2] [,3]
#> [1,] "single" "single" "single"
#> [2,] "single" "single" "single"
#>
#> $border_bottom
#> [,1] [,2] [,3]
#> [1,] "" "" ""
#> [2,] "" "" ""
#>
#> $border_first
#> [,1] [,2] [,3]
#> [1,] "single" "single" "single"
#> [2,] "single" "single" "single"
#>
#> $border_last
#> [,1] [,2] [,3]
#> [1,] "single" "single" "single"
#> [2,] "single" "single" "single"
#>
#> $text_font
#> [,1] [,2] [,3]
#> [1,] 1 1 1
#> [2,] 1 1 1
#>
#> $text_font_size
#> [,1] [,2] [,3]
#> [1,] 9 9 9
#> [2,] 9 9 9
#>
#> $text_justification
#> [,1] [,2] [,3]
#> [1,] "c" "c" "c"
#> [2,] "c" "c" "c"
#>
#> $text_convert
#> [,1] [,2] [,3]
#> [1,] TRUE TRUE TRUE
#> [2,] TRUE TRUE TRUE
#>
#> $text_indent_first
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 0 0
#>
#> $text_indent_left
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 0 0
#>
#> $text_indent_right
#> [,1] [,2] [,3]
#> [1,] 0 0 0
#> [2,] 0 0 0
#>
#> $strwidth
#> [,1] [,2] [,3]
#> [1,] 0.5763889 0.125 0.53125
#> [2,] 0.3914931 0.125 0.53125
#>
#> $border_width
#> [1] 15
#>
#> $cell_height
#> [1] 0.15
#>
#> $cell_justification
#> [1] "c"
#>
#> $text_space_before
#> [1] 15
#>
#> $text_space_after
#> [1] 15
#>
#> $page
#> $page$width
#> [1] 8.5
#>
#> $page$height
#> [1] 11
#>
#> $page$orientation
#> [1] "portrait"
#>
#> $page$margin
#> [1] 1.25000 1.00000 1.75000 1.25000 1.75000 1.00625
#>
#> $page$nrow
#> [1] 40
#>
#> $page$col_width
#> [1] 6.25
#>
#> $page$border_first
#> [1] "double"
#>
#> $page$border_last
#> [1] "double"
#>
#> $page$page_title
#> [1] "all"
#>
#> $page$page_footnote
#> [1] "last"
#>
#> $page$page_source
#> [1] "last"
#>
#> $page$use_color
#> [1] FALSE
#>
#>
#> $rtf_colheader
#> $rtf_colheader[[1]]
#> X1 X2 X3 X4 X5 X6 X7 X8
#> 1 Trt N1 Mean1 N2 Mean2 N3 Mean3 CI
#>
#>
#> $text_space
#> [1] 1
#>
#> $text_new_page
#> [1] FALSE
#>
#> $text_hyphenation
#> [1] TRUE
#>
#> $use_color
#> [1] FALSE
#>
#> $cell_vertical_justification
#> [1] "top"
#>
#> $last_row
#> [1] TRUE
#>
#> $rtf_by_subline
#> $rtf_by_subline$new_page
#> [1] FALSE
#>
#> $rtf_by_subline$by_var
#> NULL
#>
#> $rtf_by_subline$id
#> NULL
#>
#>
#> $rtf_pageby
#> $rtf_pageby$new_page
#> [1] FALSE
#>
#> $rtf_pageby$by_var
#> NULL
#>
#> $rtf_pageby$id
#> NULL
#>
#>
#> $col_rel_width
#> [1] 1 1 1
#>