Reputation: 1040
I am trying to play around with the formatting of the labels in summarytools::ctable with no luck.
I would like to keep the longer version of the question name on top of the table, and the shorter version of the question name inside the table (or removed altogether).
library(magrittr)
library(dplyr)
library(summarytools)
mtcars %<>% rename(really_long_variable_name_for_vs = vs,
really_long_variable_name_for_gear = gear)
ctable(mtcars$really_long_variable_name_for_gear,mtcars$really_long_variable_name_for_vs)
ctable(mtcars$really_long_variable_name_for_gear,mtcars$really_long_variable_name_for_vs,dnn = c('gear short', 'vs short'))
But I want the SHORT version of the name to appear inside the table (or not at all) And the LONG version of the var name to appear outside the table
Desired output:
I tried playing around with the options -- but no luck:
ctable(mtcars$gear,mtcars$really_long_variable_name_for_vs,
omit_headings = TRUE,
display.labels = FALSE,
dfSummary.labels.col = FALSE)
Upvotes: 0
Views: 102
Reputation: 10401
In principle, you would use the print method to do that, modifying the Row.variable and Col.variable attributes. However, I realize it's not been correctly implemented. So what you can do is modify the Row.x.Col attribute directly (not documented):
ct <- ctable(...)
attr(ct, "data_info")$Row.x.Col <- "long_variable_name * other_long_variable_name"
Upvotes: 0