rtables
rtables copied to clipboard
col_info setter and getter refactoring
post-processing for col_info to be more flexible, for example adding total N's
These exist.
> col_info
standardGeneric for "col_info" defined from package "rtables"
function (obj)
standardGeneric("col_info")
<bytecode: 0x7fde00810158>
<environment: 0x7fde00809660>
Methods may be defined for arguments: obj
Use showMethods(col_info) for currently available ones.
> `col_info<-`
standardGeneric for "col_info<-" defined from package "rtables"
function (obj, value)
standardGeneric("col_info<-")
<bytecode: 0x7fde0083a610>
<environment: 0x7fde00827b50>
Methods may be defined for arguments: obj, value
Use showMethods(col_info<-) for currently available ones.
df <- data.frame(cat =c( "really long thing its so long",
"reasonable thing",
"short"),
value = c(6, 3, 10))
lyt <- basic_table(show_colcounts = TRUE) %>%
split_rows_by("cat", section_div = " ") %>%
analyze("value")
tbl <- build_table(lyt, df)
tbl
gives
all obs
(N=3)
———————————————————————————————————————
really long thing its so long
Mean 6.00
reasonable thing
Mean 3.00
short
Mean 10.00
and then
col_counts(tbl) <- 17L
tbl
gives
all obs
(N=17)
———————————————————————————————————————
really long thing its so long
Mean 6.00
reasonable thing
Mean 3.00
short
Mean 10.00